org.geotools.graph.traverse
Class DijkstraTraversal

java.lang.Object
  extended byorg.geotools.graph.traverse.AbstractGraphTraversal
      extended byorg.geotools.graph.traverse.SourceGraphTraversal
          extended byorg.geotools.graph.traverse.DijkstraTraversal
All Implemented Interfaces:
GraphTraversal

public class DijkstraTraversal
extends SourceGraphTraversal

Traverses a graph using Dijkstras shortest path alorithm.


Nested Class Summary
static interface DijkstraTraversal.CostFunction
          Represents a cost function to be used by dijkstras algorithm to calculate node costs.
 class DijkstraTraversal.CostNode
          Simple data structure used to track cost of nodes and path from source.
 
Field Summary
 
Fields inherited from interface org.geotools.graph.traverse.GraphTraversal
CONTINUE, STOP
 
Constructor Summary
DijkstraTraversal(Graph graph, GraphWalker walker, GraphComponent source, DijkstraTraversal.CostFunction cf)
           
 
Method Summary
 java.util.Collection getActiveElements()
          Returns the active elements of the traversal.
 DijkstraTraversal.CostNode getCostNode(GraphComponent element)
           
 void initEdges()
          Initializes the edges of a graph by delegating initialization to the walker.
protected  void initHeap(java.util.Collection elements)
           
 void initNodes()
          Initializes the nodes of a graph by delegating initialization to the walker.
protected  void walk()
           
 
Methods inherited from class org.geotools.graph.traverse.SourceGraphTraversal
getSource, walkEdges, walkNodes
 
Methods inherited from class org.geotools.graph.traverse.AbstractGraphTraversal
finish, getGraph, getWalker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DijkstraTraversal

public DijkstraTraversal(Graph graph,
                         GraphWalker walker,
                         GraphComponent source,
                         DijkstraTraversal.CostFunction cf)
Method Detail

initNodes

public void initNodes()
Description copied from class: AbstractGraphTraversal
Initializes the nodes of a graph by delegating initialization to the walker.

Specified by:
initNodes in interface GraphTraversal
Overrides:
initNodes in class AbstractGraphTraversal
See Also:
GraphTraversal.initNodes()

initEdges

public void initEdges()
Description copied from class: AbstractGraphTraversal
Initializes the edges of a graph by delegating initialization to the walker.

Specified by:
initEdges in interface GraphTraversal
Overrides:
initEdges in class AbstractGraphTraversal
See Also:
GraphTraversal.initNodes()

getCostNode

public DijkstraTraversal.CostNode getCostNode(GraphComponent element)

getActiveElements

public java.util.Collection getActiveElements()
Description copied from class: SourceGraphTraversal
Returns the active elements of the traversal. That is elements that are in the process of being visited, or are queued to be visited.

Specified by:
getActiveElements in class SourceGraphTraversal

initHeap

protected void initHeap(java.util.Collection elements)

walk

protected void walk()
Specified by:
walk in class SourceGraphTraversal