pub fn all_st_mincuts(
graph: &Graph,
source: VertexId,
target: VertexId,
capacity: Option<&[f64]>,
) -> IgraphResult<StMinCuts>Expand description
List all minimum (s,t) edge cuts of a directed graph (Provan-Shier).
§Arguments
graph— directed input graph. Undirected graphs are rejected.source— source vertex id.target— target vertex id (must differ fromsource).capacity— optional per-edge capacities in edge-id order. WhenNone, every edge has unit capacity. All capacities must be strictly positive.
§Errors
IgraphError::InvalidArgumentwhengraphis undirected, whensource == target, whencapacity.len() != ecount(), or when any capacity is not strictly positive.IgraphError::VertexOutOfRangewhensourceortargetis not a valid vertex id.
§Examples
use rust_igraph::all_st_mincuts;
use rust_igraph::Graph;
// Path 0→1→2→3→4: the single min cut value is 1 and there are four
// distinct minimum cuts, one per edge.
let mut g = Graph::new(5, true).unwrap();
for (u, v) in [(0, 1), (1, 2), (2, 3), (3, 4)] {
g.add_edge(u, v).unwrap();
}
let res = all_st_mincuts(&g, 0, 4, None).unwrap();
assert_eq!(res.value, 1.0);
assert_eq!(res.cuts.len(), 4);