class RGL::DFSIterator

Iterator for a depth first search, starting at a given vertex. The only difference from {BFSIterator} is that +@waiting+ is a stack, instead of a queue.

Note that this is different from {DFSVisitor}, which is used in the recursive version for depth first search (see {Graph#depth_first_search}).

@see Graph#dfs_iterator

Public Instance Methods

next_vertex() click to toggle source
    # File lib/rgl/traversal.rb
145 def next_vertex
146   # waiting is a stack
147   @waiting.pop
148 end