Skip to main content

edge_connectivity_ratio

Function edge_connectivity_ratio 

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

Compute the edge connectivity ratio.

r = 2m / (n·(n-1)) for undirected, m / (n·(n-1)) for directed

Identical to density() for simple graphs but computed directly from edge and vertex counts without checking simplicity. Returns 0.0 for graphs with fewer than 2 vertices.

§Examples

use rust_igraph::{Graph, edge_connectivity_ratio};

// K_3: 3 edges, n=3 → 2·3/(3·2) = 1.0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((edge_connectivity_ratio(&g).unwrap() - 1.0).abs() < 1e-10);