public abstract class AbstractBidirAlgo extends Object implements BidirRoutingAlgorithm
Modifier and Type | Field and Description |
---|---|
protected SPTEntry |
bestBwdEntry |
protected SPTEntry |
bestFwdEntry |
protected double |
bestWeight |
protected com.carrotsearch.hppc.IntObjectMap<SPTEntry> |
bestWeightMapFrom |
protected com.carrotsearch.hppc.IntObjectMap<SPTEntry> |
bestWeightMapOther |
protected com.carrotsearch.hppc.IntObjectMap<SPTEntry> |
bestWeightMapTo |
protected SPTEntry |
currFrom |
protected SPTEntry |
currTo |
protected boolean |
finishedFrom |
protected boolean |
finishedTo |
protected int |
from |
protected int |
fromOutEdge |
protected int |
maxVisitedNodes |
protected NodeAccess |
nodeAccess |
protected int |
to |
protected int |
toInEdge |
protected TraversalMode |
traversalMode |
protected boolean |
updateBestPath |
Constructor and Description |
---|
AbstractBidirAlgo(TraversalMode traversalMode) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
bwdSearchCanBeStopped() |
Path |
calcPath(int from,
int to)
Calculates the best path between the specified nodes.
|
Path |
calcPath(int from,
int to,
int fromOutEdge,
int toInEdge)
like
RoutingAlgorithm.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. |
List<Path> |
calcPaths(int from,
int to)
Calculates multiple possibilities for a path.
|
protected void |
checkAlreadyRun() |
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 |
extractPath() |
protected boolean |
finished() |
protected boolean |
fromEntryCanBeSkipped() |
protected boolean |
fwdSearchCanBeStopped() |
protected double |
getCurrentFromWeight() |
protected double |
getCurrentToWeight() |
protected int |
getIncomingEdge(SPTEntry entry) |
protected abstract double |
getInEdgeWeight(SPTEntry entry) |
String |
getName() |
protected abstract int |
getOtherNode(int edge,
int node) |
int |
getVisitedNodes()
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 |
isMaxVisitedNodesExceeded() |
protected void |
postInit(int from,
int to) |
protected abstract void |
postInitFrom() |
protected abstract void |
postInitTo() |
protected void |
runAlgo() |
void |
setMaxVisitedNodes(int numberOfNodes)
Limit the search to numberOfNodes.
|
protected void |
setUpdateBestPath(boolean b) |
protected boolean |
toEntryCanBeSkipped() |
protected void |
updateBestPath(double edgeWeight,
SPTEntry entry,
int origEdgeId,
int traversalId,
boolean reverse) |
protected final TraversalMode traversalMode
protected int from
protected int to
protected int fromOutEdge
protected int toInEdge
protected com.carrotsearch.hppc.IntObjectMap<SPTEntry> bestWeightMapFrom
protected com.carrotsearch.hppc.IntObjectMap<SPTEntry> bestWeightMapTo
protected com.carrotsearch.hppc.IntObjectMap<SPTEntry> bestWeightMapOther
protected SPTEntry currFrom
protected SPTEntry currTo
protected SPTEntry bestFwdEntry
protected SPTEntry bestBwdEntry
protected double bestWeight
protected NodeAccess nodeAccess
protected int maxVisitedNodes
protected boolean updateBestPath
protected boolean finishedFrom
protected boolean finishedTo
public AbstractBidirAlgo(TraversalMode traversalMode)
protected void initCollections(int size)
protected abstract SPTEntry createStartEntry(int node, double weight, boolean reverse)
public Path calcPath(int from, int to)
RoutingAlgorithm
calcPath
in interface RoutingAlgorithm
public Path calcPath(int from, int to, int fromOutEdge, int toInEdge)
BidirRoutingAlgorithm
RoutingAlgorithm.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.calcPath
in interface BidirRoutingAlgorithm
fromOutEdge
- the edge id of the first edge of the path. using EdgeIterator.ANY_EDGE
means
not enforcing the first edge of the pathtoInEdge
- the edge id of the last edge of the path. using EdgeIterator.ANY_EDGE
means
not enforcing the last edge of the pathprotected void initFrom(int from, double weight)
protected void initTo(int to, double weight)
protected void postInit(int from, int to)
protected abstract void postInitFrom()
protected abstract void postInitTo()
protected void runAlgo()
protected boolean finished()
protected void updateBestPath(double edgeWeight, SPTEntry entry, int origEdgeId, int traversalId, boolean reverse)
protected abstract double getInEdgeWeight(SPTEntry entry)
protected abstract int getOtherNode(int edge, int node)
protected int getIncomingEdge(SPTEntry entry)
protected abstract Path extractPath()
protected boolean fromEntryCanBeSkipped()
protected boolean fwdSearchCanBeStopped()
protected boolean toEntryCanBeSkipped()
protected boolean bwdSearchCanBeStopped()
protected double getCurrentFromWeight()
protected double getCurrentToWeight()
protected void setUpdateBestPath(boolean b)
public int getVisitedNodes()
RoutingAlgorithm
getVisitedNodes
in interface RoutingAlgorithm
public void setMaxVisitedNodes(int numberOfNodes)
RoutingAlgorithm
setMaxVisitedNodes
in interface RoutingAlgorithm
protected void checkAlreadyRun()
public List<Path> calcPaths(int from, int to)
RoutingAlgorithm
calcPaths
in interface RoutingAlgorithm
RoutingAlgorithm.calcPath(int, int)
public String getName()
getName
in interface RoutingAlgorithm
protected boolean isMaxVisitedNodesExceeded()
Copyright © 2012–2020. All rights reserved.