Skip to main content

inter_community_edge_ratio

Function inter_community_edge_ratio 

Source
pub fn inter_community_edge_ratio(graph: &Graph) -> IgraphResult<f64>
Expand description

Compute the inter-community edge ratio.

Fraction of edges whose endpoints belong to different communities (using greedy partition). Values near 0 indicate strong community structure (few inter-community edges); values near 1 indicate weak or no community structure. Returns 0.0 for trivial or edgeless graphs.

§Examples

use rust_igraph::{Graph, inter_community_edge_ratio};

// Two disconnected K_2s: no inter-community edges → 0.0
let g = Graph::from_edges(&[(0,1),(2,3)], false, Some(4)).unwrap();
assert!(inter_community_edge_ratio(&g).unwrap() < 0.01);