|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.graph.path.DijkstraShortestPathFinder
Calculates node paths in a graph using Dijkstra's Shortest Path Algorithm. Dijsktras algorithm calculates a shortest path from a specefied node (the source node of the underlying dijkstra iteration) to every other node in the graph.
DijsktraIterator
Constructor Summary | |
DijkstraShortestPathFinder(Graph graph,
DijkstraIterator iterator)
Constructs a new path finder. |
|
DijkstraShortestPathFinder(Graph graph,
Graphable source,
DijkstraIterator.EdgeWeighter weighter)
Constructs a new path finder. |
Method Summary | |
void |
calculate()
Performs the graph traversal and calculates the shortest path from the source node to every other node in the graph. |
void |
finish()
Does nothing. |
double |
getCost(Graphable g)
Returns the cost associated with a node calculated during the graph traversal. |
DijkstraIterator |
getIterator()
|
Path |
getPath(Graphable g)
Returns a path from g to the source. |
GraphTraversal |
getTraversal()
|
int |
visit(Graphable element,
GraphTraversal traversal)
Does nothing except signal the traversal to continue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DijkstraShortestPathFinder(Graph graph, DijkstraIterator iterator)
graph
- The graph to calculate paths for.iterator
- The dijsktra iterator to used to calculate shortest paths.public DijkstraShortestPathFinder(Graph graph, Graphable source, DijkstraIterator.EdgeWeighter weighter)
graph
- Graph to calculate paths for.source
- Node to calculate paths from.weighter
- Associates weights with edges in the graph.Method Detail |
public void calculate()
public Path getPath(Graphable g)
g
- The start node of the path to be calculated.
Walk.riterator()
public double getCost(Graphable g)
g
- The node whose cost is desired.
public DijkstraIterator getIterator()
public GraphTraversal getTraversal()
public int visit(Graphable element, GraphTraversal traversal)
visit
in interface GraphWalker
element
- The component being visited.traversal
- The traversal controlling the sequence of graph
component visits.
GraphWalker.visit(Graphable, GraphTraversal)
public void finish()
finish
in interface GraphWalker
GraphWalker.finish()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |