Package com.graphhopper.routing
Class Dijkstra
java.lang.Object
com.graphhopper.routing.AbstractRoutingAlgorithm
com.graphhopper.routing.Dijkstra
- All Implemented Interfaces:
RoutingAlgorithm
Implements a single source shortest path algorithm
http://en.wikipedia.org/wiki/Dijkstra's_algorithm
- Author:
- Peter Karich
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SPTEntry
protected PriorityQueue<SPTEntry>
protected com.carrotsearch.hppc.IntObjectMap<SPTEntry>
Fields inherited from class com.graphhopper.routing.AbstractRoutingAlgorithm
edgeExplorer, graph, maxVisitedNodes, nodeAccess, timeoutMillis, traversalMode, weighting
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalcPath
(int from, int to) Calculates the best path between the specified nodes.protected boolean
finished()
getName()
int
Returns the visited nodes after searching.protected void
initCollections
(int size) protected void
runAlgo()
protected void
updateBestPath
(EdgeIteratorState edgeState, SPTEntry bestSPTEntry, int traversalId) Methods inherited from class com.graphhopper.routing.AbstractRoutingAlgorithm
accept, calcPaths, checkAlreadyRun, createEmptyPath, isMaxVisitedNodesExceeded, isTimeoutExceeded, setMaxVisitedNodes, setTimeoutMillis, setupFinishTime, toString
-
Field Details
-
fromMap
-
fromHeap
-
currEdge
-
-
Constructor Details
-
Dijkstra
-
-
Method Details
-
initCollections
protected void initCollections(int size) -
calcPath
Description copied from interface:RoutingAlgorithm
Calculates the best path between the specified nodes.- Returns:
- the path. Call the method found() to make sure that the path is valid.
-
runAlgo
protected void runAlgo() -
finished
protected boolean finished() -
getVisitedNodes
public int getVisitedNodes()Description copied from interface:RoutingAlgorithm
Returns the visited nodes after searching. Useful for debugging. -
updateBestPath
-
getName
- Specified by:
getName
in interfaceRoutingAlgorithm
- Overrides:
getName
in classAbstractRoutingAlgorithm
- Returns:
- name of this algorithm
-