pub fn all_st_cuts(
graph: &Graph,
source: VertexId,
target: VertexId,
) -> IgraphResult<StCuts>Expand description
List all (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).
§Errors
IgraphError::InvalidArgumentwhengraphis undirected or whensource == target.IgraphError::VertexOutOfRangewhensourceortargetis not a valid vertex id.
§Examples
use rust_igraph::all_st_cuts;
use rust_igraph::Graph;
// Two parallel routes 0 ⇒ 2: 0→1→2 and 0→2 (here a single path 0→1→2).
let mut g = Graph::new(3, true).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
let res = all_st_cuts(&g, 0, 2).unwrap();
// Two cuts: {0} (edge 0) and {0,1} (edge 1).
assert_eq!(res.partition1s, vec![vec![0], vec![0, 1]]);
assert_eq!(res.cuts, vec![vec![0], vec![1]]);