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
Nested Classes -
Field Summary
Fields inherited from class com.graphhopper.routing.AbstractRoutingAlgorithm
edgeExplorer, graph, maxVisitedNodes, nodeAccess, timeoutMillis, traversalMode, weighting -
Constructor Summary
ConstructorsConstructorDescriptionShortestPathTree(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 booleanfinished()getIsochroneEdges(double z) getName()intReturns the visited nodes after searching.voidsearch(int from, Consumer<ShortestPathTree.IsoLabel> consumer) voidsetDistanceLimit(double limit) Distance limit in metervoidsetTimeLimit(double limit) Time limit in millisecondsvoidsetWeightLimit(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:RoutingAlgorithmCalculates 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:
getNamein interfaceRoutingAlgorithm- Overrides:
getNamein classAbstractRoutingAlgorithm- Returns:
- name of this algorithm
-
getVisitedNodes
public int getVisitedNodes()Description copied from interface:RoutingAlgorithmReturns the visited nodes after searching. Useful for debugging.
-