pub fn graph_toughness(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the toughness of a graph.
τ(G) = min_{S ⊂ V, ω(G-S)>1} |S| / ω(G-S)
where ω(G-S) is the number of connected components of G after
removing vertex set S. A graph is t-tough if τ(G) ≥ t.
Returns f64::INFINITY for complete graphs (no vertex set
disconnects them into multiple components). Returns 0.0 for
disconnected graphs.
Brute-force — suitable for graphs with ≤ ~20 vertices.
§Examples
use rust_igraph::{Graph, graph_toughness};
// Path 0-1-2: removing {1} → 2 components → τ = 1/2
let g = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
let t = graph_toughness(&g).unwrap();
assert!((t - 0.5).abs() < 0.01);