Skip to main content

compute_modularity

Function compute_modularity 

Source
pub fn compute_modularity(
    node_count: usize,
    edges: &[(usize, usize, f64)],
    partition: &[usize],
) -> f64
Expand description

Compute modularity of a given partition.

§Arguments

  • node_count - Number of nodes
  • edges - Edges as (from_idx, to_idx, weight)
  • partition - Community assignment for each node (indexed by node index)

§Returns

Modularity score (typically 0.3-0.7 for good community structure).