pub fn bellman_ford_path_to_with_mode(
graph: &Graph,
source: VertexId,
target: VertexId,
weights: &[f64],
mode: DijkstraMode,
) -> IgraphResult<Option<(Vec<VertexId>, Vec<u32>)>>Expand description
Returns the shortest path from source to target using
Bellman-Ford with directed-mode selection.
mode selects how directed edges are followed:
DijkstraMode::Outfollows out-edges,DijkstraMode::Infollows in-edges,DijkstraMode::Allignores edge direction.
Returns Some((vertices, edges)) if a finite-weight path exists,
None if target is unreachable.
ยงExamples
use rust_igraph::{Graph, bellman_ford_path_to_with_mode, DijkstraMode};
let mut g = Graph::new(3, true).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
let p = bellman_ford_path_to_with_mode(&g, 2, 0, &[1.0, 1.0], DijkstraMode::In)
.unwrap().unwrap();
assert_eq!(p.0, vec![2, 1, 0]);