if (requireNamespace("igraph", quietly = TRUE)) {
g <- igraph::make_graph("Zachary")
# Consensus from 50 Louvain runs
cc <- community_consensus(g, method = "louvain", n_runs = 50)
print(cc)
# Stricter threshold for more robust communities
cc2 <- community_consensus(g, threshold = 0.7, n_runs = 100)
}
Run the code above in your browser using DataLab