pub fn modularity_upper_bound_ratio(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the modularity upper bound ratio.
Runs a greedy label-propagation-style partition (assign each vertex to the community of its most frequent neighbor label), then computes modularity Q of that partition divided by the theoretical maximum (1 - 1/k where k is the number of communities found). Values near 1 indicate the graph is highly modular; values near 0 indicate weak community structure. Returns 0.0 for trivial or edgeless graphs.
ยงExamples
use rust_igraph::{Graph, modularity_upper_bound_ratio};
// Two disconnected K_2s: perfect community structure
let g = Graph::from_edges(&[(0,1),(2,3)], false, Some(4)).unwrap();
let r = modularity_upper_bound_ratio(&g).unwrap();
assert!(r > 0.5);