module RGL::GraphVisitor

def self.included(base)

def self.included(base)
  # when GraphVisitor is included into a class/module, add class methods as well
  base.extend ClassMethods
end

def attach_distance_map(map = Hash.new(0))


+distance_to_root+, which answers the distance to the start vertex.
After the +distance_map+ is attached, the visitor has a new method

{https://www.boost.org/libs/graph/doc/distance_recorder.html distance_recorder}.
This is similar to BGLs

vertex to the start vertex.
Attach a map to the visitor which records the distance of a visited
def attach_distance_map(map = Hash.new(0))
  @distance_map = map
  # add distance map support to the current visitor instance
  extend(DistanceMapSupport)
end

def finished_vertex?(v)


Returns true if vertex _v_ is colored :BLACK (i.e. finished).
def finished_vertex?(v)
  @color_map[v] == :BLACK
end

def follow_edge?(u, v)


Shall we follow the edge (u,v); i.e. v has color :WHITE
def follow_edge?(u, v)
  @color_map[v] == :WHITE
end

def initialize(graph)

Parameters:
  • graph (Graph) --
def initialize(graph)
  super(graph)
  reset
end

def reset


Mark each vertex unvisited (i.e. :WHITE)
def reset
  @color_map = Hash.new(:WHITE)
end