Skip to main content

louvain_communities

Function louvain_communities 

Source
pub fn louvain_communities(conn: &Connection) -> Result<CommunityResult>
Expand description

Compute communities using the full two-phase Louvain algorithm.

  • Phase 1: each node greedily moves to the adjacent community that maximises modularity gain (local optimisation).
  • Phase 2: all communities are collapsed into super-nodes; the graph is rebuilt with aggregated edge weights and Phase 1 is repeated.

The two phases alternate until no further improvement is possible.