Computing important network metrics

This recipe covers the methods used to compute some of the common metrics used on social networks.

Getting ready

If you have not yet installed the igraph package, do it now. If you worked through the earlier recipes in this chapter, you should have the data files directed-graph.Rdata, undirected-graph.Rdata, and bipartite-graph.Rdata and should ensure that they are in your R working directory. If not, you should download these data files and place them in your R working directory.

How to do it...

To compute important network metrics, follow these steps:

  1. Load the data files:
    > load("undirected-graph.Rdata")
    > load("directed-graph.Rdata")
    > load("bipartite-graph.Rdata")
  2. The degree centrality can be measured as follows: ...

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.