Class DijkstraAlgorithm
java.lang.Object
org.apache.xmlgraphics.util.dijkstra.DijkstraAlgorithm
This is an implementation of Dijkstra's algorithm to find the shortest path for a directed
graph with non-negative edge weights.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRun Dijkstra's shortest path algorithm.protected IteratorgetDestinations(Vertex origin) Returns an iterator over all valid destinations for a given vertex.intgetLowestPenalty(Vertex vertex) Returns the lowest penalty from the start point to a given vertex.protected intgetPenalty(Vertex start, Vertex end) Returns the penalty between two vertices.getPredecessor(Vertex vertex) Returns the vertex's predecessor on the shortest path.
-
Field Details
-
INFINITE
public static final int INFINITEInfinity value for distances.- See Also:
-
-
Constructor Details
-
DijkstraAlgorithm
Main Constructor.- Parameters:
edgeDirectory- the edge directory this instance should work on
-
-
Method Details
-
getPenalty
-
getDestinations
-
execute
Run Dijkstra's shortest path algorithm. After this method is finished you can usegetPredecessor(Vertex)to reconstruct the best/shortest path starting from the destination backwards.- Parameters:
start- the starting vertexdestination- the destination vertex.
-
getLowestPenalty
-
getPredecessor
-