I have 500 random networks stored in a list
for (x in seq_len(500L)) {
+ gs[[x]] <- erdos.renyi.game(361, 695, type = "gnm")
I am able to calculate the transitivity for each network individually using
transitivity(gs[[1]])
How do I calculate the transitivity for all the networks and output the values into an excel sheet so as to do some statistical analysis. Anyt thoughts please.
Use an *apply function, specifically sapply or lapply.
library(igraph)
gs <- list()
for (x in seq_len(500L)) {
gs[[x]] <- erdos.renyi.game(361, 695, type = "gnm")
}
gs.trans <- sapply(gs, transitivity)
write.csv(gs.trans, file="Graph_transivity.txt")