pub fn modularity(adj: &Array2<f64>, assignments: &[usize]) -> f64Expand description
Compute Newman-Girvan modularity Q for a given partition.
Q = (1/2m) * sum_{i,j} [ A_{ij} - k_i * k_j / (2m) ] * delta(c_i, c_j)
where m is the total edge weight, k_i is the weighted degree of node i,
and c_i is the community assignment of node i.