[][src]Function pathfinding::directed::bfs::bfs_loop

pub fn bfs_loop<N, FN, IN>(start: &N, successors: FN) -> Option<Vec<N>> where
    N: Eq + Hash + Clone,
    FN: FnMut(&N) -> IN,
    IN: IntoIterator<Item = N>, 

Return one of the shortest loop from start to start if it exists, None otherwise.

  • start is the starting node.
  • successors returns a list of successors for a given node.

Except the start node which will be included both at the beginning and the end of the path, a node will never be included twice in the path as determined by the Eq relationship.