O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating adjacency matrices and edge lists

We can represent social network data in different formats. We cover two common representations:

  • Sparse adjacency matrices
  • Edge lists

Taking data from the Meetup.com social networking site (from the previous recipe in this chapter--Downloading social network data using public APIs), this recipe shows how you can convert a data frame with membership information to a sparse adjacency matrix and then to an edge list.

In this application, nodes represent users of Meetup.com and an edge connects two nodes if they are members of at least one common group. The number of common groups for a pair of people will represent the weight of the connection.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required