Skip to main content

get_all_shortest_paths_dijkstra_with_mode

Function get_all_shortest_paths_dijkstra_with_mode 

Source
pub fn get_all_shortest_paths_dijkstra_with_mode(
    graph: &Graph,
    source: VertexId,
    weights: &[f64],
    mode: DijkstraMode,
) -> IgraphResult<AllShortestPathsDijkstra>
Expand description

Find all shortest paths from source with direction control.

For undirected graphs, mode is ignored.

§Errors

Same as get_all_shortest_paths_dijkstra.

§Examples

use rust_igraph::{Graph, DijkstraMode, get_all_shortest_paths_dijkstra_with_mode};

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_dijkstra_with_mode(
    &g, 0, &[1.0, 1.0, 1.0, 1.0], DijkstraMode::Out,
).unwrap();
assert_eq!(r.paths[3].len(), 2);