pub fn edge_disjoint_paths(
graph: &Graph,
source: VertexId,
target: VertexId,
) -> IgraphResult<i64>Expand description
Maximum number of pairwise edge-disjoint paths from source to
target.
Counterpart of igraph_edge_disjoint_paths in
references/igraph/src/flow/flow.c:2326. By Menger’s theorem
(1927) this equals the s-t edge connectivity (and, on unit
capacities, the s-t maximum flow); see
st_edge_connectivity
for the connectivity-flavoured spelling.
§Arguments
graph— input graph (directed or undirected).source— source vertex id (0 ≤ source < vcount()).target— sink vertex id (0 ≤ target < vcount(),target != source).
§Returns
The maximum number of edge-disjoint source → target paths as
i64. Returns 0 when no source → target path exists.
§Errors
Same as max_flow_value:
IgraphError::VertexOutOfRangeifsourceortargetis outside[0, vcount()).IgraphError::InvalidArgumentifsource == target. (igraph C returnsIGRAPH_UNIMPLEMENTEDfor this case; we useInvalidArgumentfor parity with the rest of our flow module.)IgraphError::Internalif the unit-capacity max-flow value is not representable asi64(unreachable in practice).
§Examples
use rust_igraph::{Graph, edge_disjoint_paths};
// Two parallel unit-cap paths 0→1→3 and 0→2→3 → 2 edge-disjoint paths.
let mut g = Graph::new(4, true).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(1, 3).unwrap();
g.add_edge(0, 2).unwrap();
g.add_edge(2, 3).unwrap();
assert_eq!(edge_disjoint_paths(&g, 0, 3).unwrap(), 2);