Class: RGL::DijkstraVisitor

### Home Classes Methods

### In Files

- lib/rgl/dijkstra_visitor.rb

### Parent

Object

### Methods

- #reset
- #set_source

### Included Modules

- RGL::GraphVisitor

### Class/Module Index

Quicksearch

- RGL
- RGL::AdjacencyGraph
- RGL::BFSIterator
- RGL::BellmanFordAlgorithm
- RGL::BellmanFordVisitor
- RGL::BidirectionalGraph
- RGL::BipartiteBFSIterator
- RGL::DFSIterator
- RGL::DFSVisitor
- RGL::DOT
- RGL::DOT::Digraph
- RGL::DOT::DirectedEdge
- RGL::DOT::Edge
- RGL::DOT::Element
- RGL::DOT::Graph
- RGL::DOT::Node
- RGL::DOT::Port
- RGL::DOT::Subgraph
- RGL::DijkstraAlgorithm
- RGL::DijkstraVisitor
- RGL::DirectedAdjacencyGraph
- RGL::Edge
- RGL::Edge::DirectedEdge
- RGL::Edge::UnDirectedEdge
- RGL::EdgePropertiesMap
- RGL::EdmondsKarpAlgorithm
- RGL::EdmondsKarpAlgorithm::EdmondsKarpBFSIterator
- RGL::Graph
- RGL::Graph::TarjanSccVisitor
- RGL::GraphIterator
- RGL::GraphVisitor
- RGL::GraphVisitor::ClassMethods
- RGL::GraphVisitor::DistanceMapSupport
- RGL::ImplicitGraph
- RGL::MutableGraph
- RGL::MutableGraph::MutableGraphParser
- RGL::NoEdgeError
- RGL::NoVertexError
- RGL::NonNegativeEdgePropertiesMap
- RGL::NotDirectedError
- RGL::NotUndirectedError
- RGL::PrimAlgorithm
- RGL::TopsortIterator
- Enumerable
- Object

No matching classes.

# 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.

    # 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.