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 SPTEntry
protected SPTEntry
protected double
protected com.carrotsearch.hppc.IntObjectMap<SPTEntry>
protected com.carrotsearch.hppc.IntObjectMap<SPTEntry>
protected com.carrotsearch.hppc.IntObjectMap<SPTEntry>
protected SPTEntry
protected SPTEntry
protected boolean
protected boolean
protected int
protected int
protected int
protected long
protected int
protected int
protected final TraversalMode
protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
calcPath
(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 void
protected abstract SPTEntry
createStartEntry
(int node, double weight, boolean reverse) Creates the root shortest path tree entry for the forward or backward search.protected abstract Path
protected boolean
finished()
protected boolean
protected boolean
protected double
protected double
protected int
getIncomingEdge
(SPTEntry entry) protected abstract double
getInEdgeWeight
(SPTEntry entry) getName()
int
Returns the visited nodes after searching.protected void
initCollections
(int size) protected void
initFrom
(int from, double weight) protected void
initTo
(int to, double weight) protected boolean
protected boolean
protected void
postInit
(int from, int to) protected abstract void
protected abstract void
protected void
runAlgo()
void
setMaxVisitedNodes
(int numberOfNodes) Limit the search to numberOfNodes.void
setTimeoutMillis
(long timeoutMillis) Limit the search to the given time in millisecondsprotected void
setUpdateBestPath
(boolean b) protected void
protected boolean
protected void
updateBestPath
(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:RoutingAlgorithm
Calculates multiple possibilities for a path.- Specified by:
calcPaths
in interfaceRoutingAlgorithm
- See Also:
-
calcPath
Description copied from interface:RoutingAlgorithm
Calculates the best path between the specified nodes.- Specified by:
calcPath
in interfaceRoutingAlgorithm
- Returns:
- the path. Call the method found() to make sure that the path is valid.
-
calcPath
Description copied from interface:EdgeToEdgeRoutingAlgorithm
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.- Specified by:
calcPath
in interfaceEdgeToEdgeRoutingAlgorithm
fromOutEdge
- the edge id of the first edge of the path. usingEdgeIterator.ANY_EDGE
means not enforcing the first edge of the pathtoInEdge
- the edge id of the last edge of the path. usingEdgeIterator.ANY_EDGE
means 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:RoutingAlgorithm
Returns the visited nodes after searching. Useful for debugging.- Specified by:
getVisitedNodes
in interfaceRoutingAlgorithm
-
setMaxVisitedNodes
public void setMaxVisitedNodes(int numberOfNodes) Description copied from interface:RoutingAlgorithm
Limit the search to numberOfNodes. See #681- Specified by:
setMaxVisitedNodes
in interfaceRoutingAlgorithm
-
setTimeoutMillis
public void setTimeoutMillis(long timeoutMillis) Description copied from interface:RoutingAlgorithm
Limit the search to the given time in milliseconds- Specified by:
setTimeoutMillis
in interfaceRoutingAlgorithm
-
checkAlreadyRun
protected void checkAlreadyRun() -
setupFinishTime
protected void setupFinishTime() -
getName
- Specified by:
getName
in interfaceRoutingAlgorithm
- Returns:
- name of this algorithm
-
isMaxVisitedNodesExceeded
protected boolean isMaxVisitedNodesExceeded() -
isTimeoutExceeded
protected boolean isTimeoutExceeded()
-