Class AbstractBidirAlgo

java.lang.Object
com.graphhopper.routing.AbstractBidirAlgo
All Implemented Interfaces:
EdgeToEdgeRoutingAlgorithm, RoutingAlgorithm
Direct Known Subclasses:
AbstractBidirCHAlgo, AbstractNonCHBidirAlgo

public abstract class AbstractBidirAlgo extends Object implements EdgeToEdgeRoutingAlgorithm
  • Field Details

    • traversalMode

      protected final TraversalMode traversalMode
    • from

      protected int from
    • to

      protected int to
    • fromOutEdge

      protected int fromOutEdge
    • toInEdge

      protected int toInEdge
    • bestWeightMapFrom

      protected com.carrotsearch.hppc.IntObjectMap<SPTEntry> bestWeightMapFrom
    • bestWeightMapTo

      protected com.carrotsearch.hppc.IntObjectMap<SPTEntry> bestWeightMapTo
    • bestWeightMapOther

      protected com.carrotsearch.hppc.IntObjectMap<SPTEntry> bestWeightMapOther
    • currFrom

      protected SPTEntry currFrom
    • currTo

      protected SPTEntry currTo
    • bestFwdEntry

      protected SPTEntry bestFwdEntry
    • bestBwdEntry

      protected SPTEntry 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

      public AbstractBidirAlgo(TraversalMode traversalMode)
  • Method Details

    • initCollections

      protected void initCollections(int size)
    • createStartEntry

      protected abstract SPTEntry createStartEntry(int node, double weight, boolean reverse)
      Creates the root shortest path tree entry for the forward or backward search.
    • calcPaths

      public List<Path> calcPaths(int from, int to)
      Description copied from interface: RoutingAlgorithm
      Calculates multiple possibilities for a path.
      Specified by:
      calcPaths in interface RoutingAlgorithm
      See Also:
    • calcPath

      public Path calcPath(int from, int to)
      Description copied from interface: RoutingAlgorithm
      Calculates the best path between the specified nodes.
      Specified by:
      calcPath in interface RoutingAlgorithm
      Returns:
      the path. Call the method found() to make sure that the path is valid.
    • calcPath

      public Path calcPath(int from, int to, int fromOutEdge, int toInEdge)
      Description copied from interface: EdgeToEdgeRoutingAlgorithm
      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.
      Specified by:
      calcPath in interface EdgeToEdgeRoutingAlgorithm
      fromOutEdge - the edge id of the first edge of the path. using EdgeIterator.ANY_EDGE means not enforcing the first edge of the path
      toInEdge - the edge id of the last edge of the path. using EdgeIterator.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

      protected abstract double getInEdgeWeight(SPTEntry entry)
    • getIncomingEdge

      protected int getIncomingEdge(SPTEntry entry)
    • extractPath

      protected abstract Path 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 interface RoutingAlgorithm
    • setMaxVisitedNodes

      public void setMaxVisitedNodes(int numberOfNodes)
      Description copied from interface: RoutingAlgorithm
      Limit the search to numberOfNodes. See #681
      Specified by:
      setMaxVisitedNodes in interface RoutingAlgorithm
    • setTimeoutMillis

      public void setTimeoutMillis(long timeoutMillis)
      Description copied from interface: RoutingAlgorithm
      Limit the search to the given time in milliseconds
      Specified by:
      setTimeoutMillis in interface RoutingAlgorithm
    • checkAlreadyRun

      protected void checkAlreadyRun()
    • setupFinishTime

      protected void setupFinishTime()
    • getName

      public String getName()
      Specified by:
      getName in interface RoutingAlgorithm
      Returns:
      name of this algorithm
    • isMaxVisitedNodesExceeded

      protected boolean isMaxVisitedNodesExceeded()
    • isTimeoutExceeded

      protected boolean isTimeoutExceeded()