Louvain Community Detection & Modularity

The Louvain algorithm greedily maximizes modularity Q = Σ[A_ij - k_i·k_j/(2m)] · δ(c_i,c_j). The resolution parameter γ controls the granularity: larger γ finds smaller communities. Nodes are color-coded by detected community.

Generate a graph and run community detection.