Function pathfinding::directed::dijkstra::dijkstra_partial
source · pub fn dijkstra_partial<N, C, FN, IN, FS>(
start: &N,
successors: FN,
stop: FS
) -> (HashMap<N, (N, C)>, Option<N>)Expand description
Determine some 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.
startis the starting node.successorsreturns a list of successors for a given node, along with the cost for moving from the node to the successor.stopis a function which is called every time a node is examined (includingstart). Atruereturn value will stop the algorithm.
The result is a map where every node examined before the algorithm stopped (not including
start) is associated with an optimal parent node and a cost from the start node, as well
as the node which caused the algorithm to stop if any.
The build_path function can be used to build a full path from the starting point to one
of the reachable targets.