pub fn st_vertex_connectivity(
graph: &Graph,
source: VertexId,
target: VertexId,
mode: VconnNei,
) -> IgraphResult<i64>Expand description
Vertex connectivity between two vertices.
Counterpart of igraph_st_vertex_connectivity in
references/igraph/src/flow/flow.c:1922. Returns the minimum
number of internal vertices whose removal disconnects source
from target.
§Arguments
graph— input graph (directed or undirected). Undirected input is treated as if every edge is two anti-parallel directed arcs (IGRAPH_TO_DIRECTED_MUTUAL), matching igraph C.source— source vertex id (0 ≤ source < vcount()).target— target vertex id (0 ≤ target < vcount(),target != source).mode— how to handle a directsource → targetedge. SeeVconnNei.
§Returns
The s-t vertex connectivity as i64. Returns 0 when source
and target are in disjoint components. When mode is
VconnNei::Negative and a direct edge exists, returns -1.
§Errors
IgraphError::InvalidArgumentifsource == target,vcount() < 2, ormode == VconnNei::Errorand a direct edgesource → targetexists.IgraphError::VertexOutOfRangeifsourceortargetis outside[0, vcount()).IgraphError::Internalif the unit-capacity max-flow value is not representable asi64(unreachable in practice: the value is bounded above byvcount()).
§Examples
use rust_igraph::{Graph, VconnNei, st_vertex_connectivity};
// Path 0 — 1 — 2 — 3 — 4 — 5 (undirected). Any single internal
// vertex separates endpoints → s-t vertex connectivity = 1.
let mut g = Graph::new(6, false).unwrap();
for (u, v) in [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5)] {
g.add_edge(u, v).unwrap();
}
assert_eq!(
st_vertex_connectivity(&g, 0, 5, VconnNei::Error).unwrap(),
1
);