class RGL::DijkstraVisitor
Dijkstra shortest path algorithm has the following event points:
* examine_vertex * examine_edge * edge_relaxed * edge_not_relaxed * finish_vertex
Attributes
Public Instance Methods
Source
# File lib/rgl/dijkstra_visitor.rb 24 def reset 25 super 26 27 @distance_map = Hash.new(INFINITY) 28 @parents_map = {} 29 end
Returns visitor into initial state.
Calls superclass method
RGL::GraphVisitor#reset
Source
# File lib/rgl/dijkstra_visitor.rb 33 def set_source(source) 34 reset 35 36 color_map[source] = :GRAY 37 distance_map[source] = 0 38 end
Initializes visitor with a new source.