cluster_louvain_graph: Louvain community detection

View source: R/clu_louvain.R

cluster_louvain_graphR Documentation

Louvain community detection

Description

Graph community detection using igraph::cluster_louvain.

Usage

cluster_louvain_graph(weights = NULL)

Arguments

weights

optional edge weights to pass to cluster_louvain

Details

Accepts an igraph object and returns community memberships. Requires the igraph package.

Value

returns a Louvain clustering object.

References

Blondel, V. D., Guillaume, J.-L., Lambiotte, R., & Lefebvre, E. (2008). Fast unfolding of communities in large networks. J. Statistical Mechanics.

Examples

if (requireNamespace("igraph", quietly = TRUE)) {
 g <- igraph::sample_gnp(n = 20, p = 0.15)
 model <- cluster_louvain_graph()
 model <- fit(model, g)
 clu <- cluster(model, g)
 table(clu)
}

daltoolbox documentation built on Feb. 10, 2026, 9:06 a.m.