Skip to main content

bellman_ford_paths_with_mode

Function bellman_ford_paths_with_mode 

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

Multi-target Bellman-Ford shortest paths with directed-mode selection.

Like bellman_ford_paths but allows choosing how directed edges are followed:

ยงExamples

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

let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
let res = bellman_ford_paths_with_mode(&g, 0, &[2], &[1.0, 1.0], DijkstraMode::All).unwrap();
assert!(res[0].is_some());