pub fn dijkstra_distances_with_mode(
graph: &Graph,
source: VertexId,
weights: &[f64],
mode: DijkstraMode,
) -> IgraphResult<Vec<Option<f64>>>Expand description
Mode-aware Dijkstra distances. Counterpart of
igraph_distances_dijkstra(_, _, source, vss_all(), weights, mode).
§Examples
use rust_igraph::{Graph, dijkstra_distances_with_mode, DijkstraMode};
// Directed path 0→1→2: OUT reaches forward, IN reaches backward,
// ALL collapses to undirected.
let mut g = Graph::new(3, true).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
let w = [1.0, 2.0];
assert_eq!(
dijkstra_distances_with_mode(&g, 0, &w, DijkstraMode::Out).unwrap(),
vec![Some(0.0), Some(1.0), Some(3.0)]
);
assert_eq!(
dijkstra_distances_with_mode(&g, 0, &w, DijkstraMode::In).unwrap(),
vec![Some(0.0), None, None]
);