public class DijkstraShortestPathFinder extends Object implements GraphWalker
DijsktraIterator| Constructor and Description |
|---|
DijkstraShortestPathFinder(Graph graph,
DijkstraIterator iterator)
Constructs a new path finder.
|
DijkstraShortestPathFinder(Graph graph,
Graphable source,
DijkstraIterator.EdgeWeighter weighter)
Constructs a new path finder.
|
DijkstraShortestPathFinder(Graph graph,
Graphable source,
DijkstraIterator.EdgeWeighter weighter,
DijkstraIterator.NodeWeighter nweighter)
Constructs a new path finder.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.public DijkstraShortestPathFinder(Graph graph, Graphable source, DijkstraIterator.EdgeWeighter weighter, DijkstraIterator.NodeWeighter nweighter)
graph - Graph to calculate paths for.source - Node to calculate paths from.weighter - Associates weights with edges in the graph.nweighter - Associates weights with nodes in the graph.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 GraphWalkerelement - The component being visited.traversal - The traversal controlling the sequence of graph component visits.GraphWalker.visit(Graphable, GraphTraversal)public void finish()
finish in interface GraphWalkerGraphWalker.finish()Copyright © 1996–2019 Geotools. All rights reserved.