library(igraph)
g <- threshold_graph(10, 0.3)
if (FALSE) {
plot(g)
# star graphs and complete graphs are threshold graphs
complete <- threshold_graph(10, 1) # complete graph
plot(complete)
star <- threshold_graph(10, 0) # star graph
plot(star)
}
# centrality scores are perfectly rank correlated
cor(degree(g), closeness(g), method = "kendall")
Run the code above in your browser using DataLab