Skip to main content

modularity

Function modularity 

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

Newman-Girvan modularity of a partition, treating the graph as undirected.

Exists so louvain can be tested against what it claims to maximise rather than against its own output. A community detector that returns one node per community satisfies “modularity did not decrease from the singleton partition” by being that partition; measuring Q is what tells the two apart.