pub fn get_shortest_paths_with_mode(
graph: &Graph,
source: VertexId,
mode: ShortestPathMode,
) -> IgraphResult<Vec<Vec<VertexId>>>Expand description
Returns one shortest path from source to every vertex, with
direction control for directed graphs.
For undirected graphs, mode is ignored and all edges are
traversed bidirectionally.
§Errors
InvalidArgumentifsource >= vcount().
§Examples
use rust_igraph::{Graph, get_shortest_paths_with_mode, ShortestPathMode};
// Directed: 0→1→2
let mut g = Graph::new(3, true).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
// Forward
let fwd = get_shortest_paths_with_mode(&g, 0, ShortestPathMode::Out).unwrap();
assert_eq!(fwd[2], vec![0, 1, 2]);
// Backward from 2
let bwd = get_shortest_paths_with_mode(&g, 2, ShortestPathMode::In).unwrap();
assert_eq!(bwd[0], vec![2, 1, 0]);