Package com.graphhopper.routing
Class AbstractBidirAlgo
java.lang.Object
com.graphhopper.routing.AbstractBidirAlgo
- All Implemented Interfaces:
EdgeToEdgeRoutingAlgorithm,RoutingAlgorithm
- Direct Known Subclasses:
AbstractBidirCHAlgo,AbstractNonCHBidirAlgo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SPTEntryprotected SPTEntryprotected doubleprotected com.carrotsearch.hppc.IntObjectMap<SPTEntry>protected com.carrotsearch.hppc.IntObjectMap<SPTEntry>protected com.carrotsearch.hppc.IntObjectMap<SPTEntry>protected SPTEntryprotected SPTEntryprotected booleanprotected booleanprotected intprotected intprotected intprotected longprotected intprotected intprotected final TraversalModeprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancalcPath(int from, int to) Calculates the best path between the specified nodes.calcPath(int from, int to, int fromOutEdge, int toInEdge) likeRoutingAlgorithm.calcPath(int, int), but this method also allows to strictly restrict the edge the path will begin with and the edge it will end with.calcPaths(int from, int to) Calculates multiple possibilities for a path.protected voidprotected abstract SPTEntrycreateStartEntry(int node, double weight, boolean reverse) Creates the root shortest path tree entry for the forward or backward search.protected abstract Pathprotected booleanfinished()protected booleanprotected booleanprotected doubleprotected doubleprotected intgetIncomingEdge(SPTEntry entry) protected abstract doublegetInEdgeWeight(SPTEntry entry) getName()intReturns the visited nodes after searching.protected voidinitCollections(int size) protected voidinitFrom(int from, double weight) protected voidinitTo(int to, double weight) protected booleanprotected booleanprotected voidpostInit(int from, int to) protected abstract voidprotected abstract voidprotected voidrunAlgo()voidsetMaxVisitedNodes(int numberOfNodes) Limit the search to numberOfNodes.voidsetTimeoutMillis(long timeoutMillis) Limit the search to the given time in millisecondsprotected voidsetUpdateBestPath(boolean b) protected voidprotected booleanprotected voidupdateBestPath(double edgeWeight, SPTEntry entry, int origEdgeIdForCH, int traversalId, boolean reverse)
-
Field Details
-
traversalMode
-
from
protected int from -
to
protected int to -
fromOutEdge
protected int fromOutEdge -
toInEdge
protected int toInEdge -
bestWeightMapFrom
-
bestWeightMapTo
-
bestWeightMapOther
-
currFrom
-
currTo
-
bestFwdEntry
-
bestBwdEntry
-
bestWeight
protected double bestWeight -
maxVisitedNodes
protected int maxVisitedNodes -
timeoutMillis
protected long timeoutMillis -
updateBestPath
protected boolean updateBestPath -
finishedFrom
protected boolean finishedFrom -
finishedTo
protected boolean finishedTo
-
-
Constructor Details
-
AbstractBidirAlgo
-
-
Method Details
-
initCollections
protected void initCollections(int size) -
createStartEntry
Creates the root shortest path tree entry for the forward or backward search. -
calcPaths
Description copied from interface:RoutingAlgorithmCalculates multiple possibilities for a path.- Specified by:
calcPathsin interfaceRoutingAlgorithm- See Also:
-
calcPath
Description copied from interface:RoutingAlgorithmCalculates the best path between the specified nodes.- Specified by:
calcPathin interfaceRoutingAlgorithm- Returns:
- the path. Call the method found() to make sure that the path is valid.
-
calcPath
Description copied from interface:EdgeToEdgeRoutingAlgorithmlikeRoutingAlgorithm.calcPath(int, int), but this method also allows to strictly restrict the edge the path will begin with and the edge it will end with.- Specified by:
calcPathin interfaceEdgeToEdgeRoutingAlgorithmfromOutEdge- the edge id of the first edge of the path. usingEdgeIterator.ANY_EDGEmeans not enforcing the first edge of the pathtoInEdge- the edge id of the last edge of the path. usingEdgeIterator.ANY_EDGEmeans not enforcing the last edge of the path
-
initFrom
protected void initFrom(int from, double weight) -
initTo
protected void initTo(int to, double weight) -
postInit
protected void postInit(int from, int to) -
postInitFrom
protected abstract void postInitFrom() -
postInitTo
protected abstract void postInitTo() -
runAlgo
protected void runAlgo() -
finished
protected boolean finished() -
updateBestPath
protected void updateBestPath(double edgeWeight, SPTEntry entry, int origEdgeIdForCH, int traversalId, boolean reverse) -
getInEdgeWeight
-
getIncomingEdge
-
extractPath
-
fromEntryCanBeSkipped
protected boolean fromEntryCanBeSkipped() -
fwdSearchCanBeStopped
protected boolean fwdSearchCanBeStopped() -
toEntryCanBeSkipped
protected boolean toEntryCanBeSkipped() -
bwdSearchCanBeStopped
protected boolean bwdSearchCanBeStopped() -
getCurrentFromWeight
protected double getCurrentFromWeight() -
getCurrentToWeight
protected double getCurrentToWeight() -
setUpdateBestPath
protected void setUpdateBestPath(boolean b) -
getVisitedNodes
public int getVisitedNodes()Description copied from interface:RoutingAlgorithmReturns the visited nodes after searching. Useful for debugging.- Specified by:
getVisitedNodesin interfaceRoutingAlgorithm
-
setMaxVisitedNodes
public void setMaxVisitedNodes(int numberOfNodes) Description copied from interface:RoutingAlgorithmLimit the search to numberOfNodes. See #681- Specified by:
setMaxVisitedNodesin interfaceRoutingAlgorithm
-
setTimeoutMillis
public void setTimeoutMillis(long timeoutMillis) Description copied from interface:RoutingAlgorithmLimit the search to the given time in milliseconds- Specified by:
setTimeoutMillisin interfaceRoutingAlgorithm
-
checkAlreadyRun
protected void checkAlreadyRun() -
setupFinishTime
protected void setupFinishTime() -
getName
- Specified by:
getNamein interfaceRoutingAlgorithm- Returns:
- name of this algorithm
-
isMaxVisitedNodesExceeded
protected boolean isMaxVisitedNodesExceeded() -
isTimeoutExceeded
protected boolean isTimeoutExceeded()
-