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 24 def reset 25 super 26 27 @distance_map = Hash.new(INFINITY) 28 @parents_map = {} 29 end
set_source(source)
click to toggle source
Initializes visitor with a new 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