class RGL::DijkstraVisitor
Dijkstra shortest path algorithm has the following event points:
* examine_vertex * examine_edge * edge_relaxed * edge_not_relaxed * finish_vertex
Attributes
distance_map[RW]
parents_map[RW]
Public Instance Methods
reset()
click to toggle source
Returns visitor into initial state.
Calls superclass method
RGL::GraphVisitor#reset
# File lib/rgl/dijkstra_visitor.rb, line 24 def reset super @distance_map = Hash.new(INFINITY) @parents_map = {} end
set_source(source)
click to toggle source
Initializes visitor with a new source.
# File lib/rgl/dijkstra_visitor.rb, line 33 def set_source(source) reset color_map[source] = :GRAY distance_map[source] = 0 end