| community_louvain | R Documentation |
Multi-level modularity optimization using the Louvain algorithm. Fast and widely used for large networks.
community_louvain(x, weights = NULL, resolution = 1, seed = NULL, ...)
com_lv(x, weights = NULL, resolution = 1, seed = NULL, ...)
x |
Network input |
weights |
Edge weights. NULL uses network weights, NA for unweighted. |
resolution |
Resolution parameter. Higher values = more communities. Default 1 (standard modularity). |
seed |
Random seed for reproducibility. Default NULL. |
... |
Additional arguments passed to |
A cograph_communities object
A cograph_communities object. See detect_communities.
Blondel, V.D., Guillaume, J.L., Lambiotte, R., & Lefebvre, E. (2008). Fast unfolding of communities in large networks. Journal of Statistical Mechanics, P10008.
if (requireNamespace("igraph", quietly = TRUE)) {
g <- igraph::make_graph("Zachary")
comm <- community_louvain(g)
igraph::membership(comm)
# Reproducible result with seed
comm1 <- community_louvain(g, seed = 42)
comm2 <- community_louvain(g, seed = 42)
identical(igraph::membership(comm1), igraph::membership(comm2))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.