Function pathfinding::directed::astar::astar_bag[][src]

pub fn astar_bag<N, C, FN, IN, FH, FS>(
    start: &N,
    successors: FN,
    heuristic: FH,
    success: FS
) -> Option<(AstarSolution<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

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).

The shortest paths starting from start up to a node for which success returns true are computed and returned in an iterator along with the cost (which, by definition, is the same for each shortest path), wrapped in a Some. If no paths are found, None is returned.

A node will never be included twice in the path as determined by the Eq relationship.

Each path comprises both the start and an end node. Note that while every path shares the same start node, different paths may have different end nodes.