pub fn calculate_modularity<N, E, Ix>( graph: &Graph<N, E, Ix>, communities: &HashMap<NodeIndex<Ix>, usize>, m: f64, ) -> f64where N: Node + Debug, E: EdgeWeight + Into<f64> + Copy, Ix: IndexType,
Calculate modularity for a given partition