pub fn even_tarjan_reduction(graph: &Graph) -> IgraphResult<EvenTarjanResult>Expand description
Compute the Even-Tarjan reduction of a graph.
For each vertex i in the original graph (with n vertices), the
reduced graph contains vertices i' = i and i'' = i + n, connected
by a directed edge i' โ i'' with capacity 1.
For each directed edge (from, to) in the original graph, two edges
are added: from'' โ to' and to'' โ from', both with infinite
capacity.
This reduction converts vertex-connectivity problems into edge-connectivity problems on the reduced graph.
ยงExamples
use rust_igraph::{Graph, even_tarjan_reduction};
let mut g = Graph::new(3, true).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
let result = even_tarjan_reduction(&g).unwrap();
// 2*3 = 6 vertices
assert_eq!(result.graph.vcount(), 6);
// 3 vertex-split edges + 2*2 = 7 edges
assert_eq!(result.graph.ecount(), 7);
assert_eq!(result.capacity.len(), 7);
// First 3 capacities are 1.0 (vertex splits)
assert_eq!(result.capacity[0], 1.0);
assert_eq!(result.capacity[1], 1.0);
assert_eq!(result.capacity[2], 1.0);
// Remaining are infinity
assert_eq!(result.capacity[3], f64::INFINITY);