BreadthFirst
A SearchStrategy visiting a Graph breadth-first, i.e. level by level: all nodes at depth 0 (the source), then all nodes at depth 1, and so on. Each yielded Visit.state is the depth (an Int, starting at 0) at which the corresponding node was reached.
graph.asSequence(BreadthFirst(), sourceNode).forEach { (depth, node) -> println("$node at depth $depth") }Content copied to clipboard
Parameters
maxDepth
caps the traversal to nodes at depth at most maxDepth; a non-positive value (the default, -1) means "unbounded"