Get startedGet started for free

Transitivity randomizations

As you did for the average path length, let's investigate if the global transitivity of the Forrest Gump network is significantly higher than we would expect by chance for random networks of the same size and density. You can compare Forrest Gump's global transitivity to 1000 other random networks.

This exercise is part of the course

Network Analysis in R

View Course

Exercise instructions

  • One thousand random networks are stored in the list object gl. Using lapply() and transitivity() calculate the global transitivity of each of these networks. Assign these results to gl.tr.
  • Using unlist() convert gl.tr to a numeric vector gl.trs.
  • Investigate the summary statistics of the transitivities of the random networks using summary().
  • Calculate the proportion of random graphs that have a transitivity higher than the transitivity of Forrest Gump's network, which you previously calculated and assigned to g.tr.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

library(igraph)

# Calculate average transitivity of 1000 random graphs
gl.tr <- ___(gl, ___)
gl.trs <- ___(gl.tr)

# Get summary statistics of transitivity scores
___(gl.trs)

# Calculate the proportion of graphs with a transitivity score higher than Forrest Gump's network
mean(gl.trs > ___)
Edit and Run Code