Skip to main content

modularity

Function modularity 

Source
pub fn modularity<N>(
    nodes: &[N],
    edges: &[(N, N, f32)],
    assignment: &[(N, usize)],
    resolution: f64,
) -> f64
where N: Clone + Ord,
Expand description

Public modularity helper over the abstract graph for a given node→community labelling (as produced by louvain). Exposed for tests and callers that want to score a partition. Edges are treated as undirected; resolution is the γ parameter. Returns 0.0 for an edgeless graph.