Skip to main content

Module shortest_path

Module shortest_path 

Source
Available on crate feature algorithms only.
Expand description

Unit-hop shortest paths on a hypergraph (xgi/algorithms/shortest_path.py).

XGI’s Dijkstra uses a fixed increment of 1 per hop, i.e. BFS levels over the node-neighbour relation. We hand-roll that BFS (unit-weight exact parity; keeps the algorithm independent of the rustworkx-core dijkstra return type).

Functions§

shortest_path_length
Distances from every source. XGI parity: shortest_path_length.
single_source_shortest_path_length
Distances from source to every node (unit hops). Unreachable nodes get f64::INFINITY; source gets 0. Keys in node_ids() order. None if source is absent. XGI parity: single_source_shortest_path_length.