Plotting social network data

This recipe covers the features in the igraph package to create graph objects, plot them, and extract network information from graph objects.

Getting ready

If you have not already installed the igraph package, do it now using the following code:

> install.packages("igraph")

Also, download the users_edgelist_upper.Rdata file from the book's data files to your R working directory. Alternately, if you worked through the previous recipe Creating adjacency matrices and edge lists from this chapter, you will have created the file and ensured that it is in your R working directory.

How to do it...

To plot social network data using igraph, follow these steps:

  1. Load the data. The following code will restore, from the saved file, a ...

Get R: Recipes for Analysis, Visualization and Machine Learning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.