Network Randomizations

Phân tích Mạng lưới trong 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")
Phân tích Mạng lưới trong 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.

Phân tích Mạng lưới trong 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) 
)
Phân tích Mạng lưới trong R

Comparing to the original network

hist(gl.apls, breaks = 20)

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

Phân tích Mạng lưới trong R

Let's practice!

Phân tích Mạng lưới trong R

Preparing Video For Download...