Graph traversal.
Depth-first search
Same thing, but for a single connected component
(only prefix_component
is tail-recursive)
This is a variant of the iterators above where you can move on
step by step. The abstract type iterator
represents the current
state of the iteration. The step
function returns the next state.
In each state, function get
returns the currently visited vertex.
On the final state both get
and step
raises exception Exit
.
Note: the iterator type is persistent (i.e. is not modified by the
step
function) and thus can be used in backtracking algorithms.
Breadth-first search
Provide a more efficient version of depth-first algorithm when graph vertices are marked.
Graph traversal with marking. Only applies to imperative graphs with marks.