Skip to main content

vertex_connectivity_ratio

Function vertex_connectivity_ratio 

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

Compute the vertex connectivity ratio.

kappa / (n - 1) where kappa is the vertex connectivity (minimum number of vertices whose removal disconnects the graph). Ranges from 0 (disconnected or tree) to 1 (complete graph). Returns 0.0 for graphs with fewer than 2 vertices.

For efficiency this uses an approximation: the minimum degree as an upper bound on vertex connectivity, since computing exact vertex connectivity is expensive. For simple undirected graphs, kappa <= delta (minimum degree) always holds, and for many graph families equality holds.

§Examples

use rust_igraph::{Graph, vertex_connectivity_ratio};

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