pub fn get_all_shortest_paths_with_mode(
graph: &Graph,
source: VertexId,
mode: AllShortestPathsMode,
) -> IgraphResult<AllShortestPaths>Expand description
Find all shortest paths from source with direction control.
For undirected graphs, mode is ignored.
§Errors
InvalidArgumentifsource >= vcount().
§Examples
use rust_igraph::{Graph, get_all_shortest_paths_with_mode, AllShortestPathsMode};
// Directed diamond: 0→1, 0→2, 1→3, 2→3.
let mut g = Graph::new(4, true).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(0, 2).unwrap();
g.add_edge(1, 3).unwrap();
g.add_edge(2, 3).unwrap();
let r = get_all_shortest_paths_with_mode(&g, 0, AllShortestPathsMode::Out).unwrap();
assert_eq!(r.paths[3].len(), 2);
// In mode from vertex 3
let r_in = get_all_shortest_paths_with_mode(&g, 3, AllShortestPathsMode::In).unwrap();
assert_eq!(r_in.paths[0].len(), 2); // two paths back to 0