Skip to main content

modularity

Function modularity 

Source
pub fn modularity<T>(
    graph: &SparseGraph<T>,
    labels: &[usize],
    resolution: f64,
) -> f64
where T: BixverseFloat + Send + Sync + Sum,
Expand description

Modularity of a partition.

Q = 1/2m * sum_c (e_c - gamma * K_c^2 / 2m), with e_c twice the internal edge weight and K_c the summed degree of cluster c. Self-loops count once per CSR entry, as in igraph.

§Params

  • graph - Undirected SparseGraph
  • labels - Community per node
  • resolution - Resolution parameter (gamma)

§Returns

The modularity