Skip to main content

louvain

Function louvain 

Source
pub fn louvain(graph: &Subgraph) -> BTreeMap<String, usize>
Expand description

Louvain community detection, local-moving phase (§5.4).

Returns node id -> community index. Communities are renumbered densely from zero in order of first appearance, so the result is stable and comparable.

This is phase one of the two-phase Louvain method: nodes are moved greedily to whichever neighbouring community most increases modularity, repeatedly, until no move helps. It does not then aggregate each community into a single node and recurse, which is what the full method does to find coarser structure. For subgraph-sized analytics the local moving phase is the part that carries the signal; the aggregation phase would matter on graphs far larger than the byte budget admits.