Network Randomizations

Network Analysis in R

James Curley

Associate Professor, University of Texas at Austin

Random graphs

erdos.renyi.game(n = gorder(g), p.or.m = edge_density(g), type = "gnp")
Network Analysis in R

Random graphs & randomization tests

  1. Generate 1000 random graphs based on the original network - e.g. with the same number of vertices and approximate density.

  2. Calculate the average path length of the original network.

  3. Calculate the average path length of the 1000 random networks.

  4. Determine how many random networks have an average path length greater or less than the original network's average path length.

Network Analysis in R

Generate 1000 random graphs:

gl <- vector('list',1000)

for(i in 1:1000){
    gl[[i]] <- erdos.renyi.game(
                    n = gorder(g), 
                    p.or.m = edge_density(g), 
                    type = "gnp"
                     ) 
}

Calculate average path length of 1000 random graphs:

gl.apls <- unlist(
  lapply(gl, mean_distance, directed = FALSE) 
)
Network Analysis in R

Comparing to the original network

hist(gl.apls, breaks = 20)

abline(
  v = mean_distance(
    g, directed=FALSE
    ),
      col = "red", 
      lty = 3, 
      lwd = 2
)

Network Analysis in R

Let's practice!

Network Analysis in R

Preparing Video For Download...