Function pathfinding::directed::dijkstra::dijkstra_all [−][src]
pub fn dijkstra_all<N, C, FN, IN>(
start: &N,
successors: FN
) -> HashMap<N, (N, C)> where
N: Eq + Hash + Clone,
C: Zero + Ord + Copy,
FN: FnMut(&N) -> IN,
IN: IntoIterator<Item = (N, C)>,
Determine all reachable nodes from a starting point as well as the minimum cost to reach them and a possible optimal parent node using the Dijkstra search algorithm.
start
is the starting node.successors
returns a list of successors for a given node, along with the cost for moving from the node to the successor.
The result is a map where every reachable node (not including start
) is associated with
an optimal parent node and a cost.
The build_path
function can be used to build a full path from the starting point to one
of the reachable targets.