pub fn distances_cutoff_multi(
graph: &Graph,
sources: &[VertexId],
cutoff: Option<u32>,
mode: DistancesCutoffMode,
) -> IgraphResult<Vec<Option<u32>>>Expand description
Multi-source unweighted distances with cutoff, direction-aware.
Returns a flat Vec<Option<u32>> of length sources.len() * n in
row-major order, where result[i * n + j] is the shortest-path
distance from sources[i] to vertex j (or None if unreachable /
past the cutoff).
ยงExamples
use rust_igraph::{Graph, distances_cutoff_multi, DistancesCutoffMode};
let mut g = Graph::with_vertices(5);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 3).unwrap();
g.add_edge(3, 4).unwrap();
let d = distances_cutoff_multi(&g, &[0, 2], Some(1), DistancesCutoffMode::Out).unwrap();
let n = 5;
// Row 0 (from 0, cutoff 1): only 0 and 1 reachable
assert_eq!(d[0], Some(0));
assert_eq!(d[1], Some(1));
assert_eq!(d[2], None);
// Row 1 (from 2, cutoff 1): 1, 2, 3
assert_eq!(d[n + 1], Some(1));
assert_eq!(d[n + 2], Some(0));
assert_eq!(d[n + 3], Some(1));
assert_eq!(d[n + 4], None);