Function pathfinding::directed::astar::astar_bag_collect

source ·
pub fn astar_bag_collect<N, C, FN, IN, FH, FS>(
    start: &N,
    successors: FN,
    heuristic: FH,
    success: FS,
) -> Option<(Vec<Vec<N>>, C)>
where N: Eq + Hash + Clone, C: Zero + Ord + Copy, FN: FnMut(&N) -> IN, IN: IntoIterator<Item = (N, C)>, FH: FnMut(&N) -> C, FS: FnMut(&N) -> bool,
Expand description

Compute all shortest paths using the A* search algorithm. Whereas astar (non-deterministic-ally) returns a single shortest path, astar_bag returns all shortest paths (in a non-deterministic order).

This is a utility function which collects the results of the astar_bag function into a vector. Most of the time, it is more appropriate to use astar_bag directly.

§Warning

The number of results with the same value might be very large in some graphs. Use with caution.