Class ShortestPathTree
java.lang.Object
com.graphhopper.routing.AbstractRoutingAlgorithm
com.graphhopper.isochrone.algorithm.ShortestPathTree
- All Implemented Interfaces:
RoutingAlgorithm
Computes a shortest path tree by a given weighting. Terminates when all shortest paths up to
a given travel time, distance, or weight have been explored.
IMPLEMENTATION NOTE: util.PriorityQueue doesn't support efficient removes. We work around this by giving the labels a deleted flag, not remove()ing them, and popping deleted elements off both queues. Note to self/others: If you think this optimization is not needed, please test it with a scenario where updates actually occur a lot, such as using finite, non-zero u-turn costs.
- Author:
- Peter Karich, Michael Zilske
-
Nested Class Summary
-
Field Summary
Fields inherited from class com.graphhopper.routing.AbstractRoutingAlgorithm
edgeExplorer, graph, maxVisitedNodes, nodeAccess, timeoutMillis, traversalMode, weighting
-
Constructor Summary
ConstructorDescriptionShortestPathTree
(Graph g, Weighting weighting, boolean reverseFlow, TraversalMode traversalMode) -
Method Summary
Modifier and TypeMethodDescriptioncalcPath
(int from, int to) Calculates the best path between the specified nodes.protected boolean
finished()
getIsochroneEdges
(double z) getName()
int
Returns the visited nodes after searching.void
search
(int from, Consumer<ShortestPathTree.IsoLabel> consumer) void
setDistanceLimit
(double limit) Distance limit in metervoid
setTimeLimit
(double limit) Time limit in millisecondsvoid
setWeightLimit
(double limit) Methods inherited from class com.graphhopper.routing.AbstractRoutingAlgorithm
accept, calcPaths, checkAlreadyRun, createEmptyPath, isMaxVisitedNodesExceeded, isTimeoutExceeded, setMaxVisitedNodes, setTimeoutMillis, setupFinishTime, toString
-
Constructor Details
-
ShortestPathTree
public ShortestPathTree(Graph g, Weighting weighting, boolean reverseFlow, TraversalMode traversalMode)
-
-
Method Details
-
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.
-
setTimeLimit
public void setTimeLimit(double limit) Time limit in milliseconds -
setDistanceLimit
public void setDistanceLimit(double limit) Distance limit in meter -
setWeightLimit
public void setWeightLimit(double limit) -
search
-
getIsochroneEdges
-
getIsochroneEdges
-
finished
protected boolean finished() -
getName
- Specified by:
getName
in interfaceRoutingAlgorithm
- Overrides:
getName
in classAbstractRoutingAlgorithm
- Returns:
- name of this algorithm
-
getVisitedNodes
public int getVisitedNodes()Description copied from interface:RoutingAlgorithm
Returns the visited nodes after searching. Useful for debugging.
-