Skip to main content

max_flow_efficiency

Function max_flow_efficiency 

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

Compute the max-flow efficiency ratio.

For each pair of vertices, the max-flow equals the edge connectivity between them. We approximate this using the minimum degree of the two endpoints (an upper bound on the local edge connectivity). Returns the average over all pairs divided by the global minimum degree. Values near 1 indicate uniform connectivity; values < 1 indicate some pairs have weaker connections. Returns 0.0 for disconnected or trivial graphs.

§Examples

use rust_igraph::{Graph, max_flow_efficiency};

// K_4: all pairs have connectivity 3, min_deg=3 → ratio=1.0
let g = Graph::from_edges(
    &[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
assert!((max_flow_efficiency(&g).unwrap() - 1.0).abs() < 1e-10);