Skip to main content

shortest_path

Function shortest_path 

Source
pub fn shortest_path<V>(
    q: &GraphQuery<V>,
    weight: &TraversalWeight<V>,
    from: &Pattern<V>,
    to: &Pattern<V>,
) -> Option<Vec<Pattern<V>>>
where V: GraphValue + Clone, V::Id: Clone + Eq + Hash + Ord,
Expand description

Find the minimum-cost path from from to to using Dijkstra’s algorithm.

  • Same node: returns Some(vec![node]) immediately.
  • No path: returns None.
  • Uses f64::INFINITY cost to mark impassable edges.