Class AbstractRoutingAlgorithm

java.lang.Object
com.graphhopper.routing.AbstractRoutingAlgorithm
All Implemented Interfaces:
RoutingAlgorithm
Direct Known Subclasses:
AStar, Dijkstra, DijkstraOneToMany, ShortestPathTree

public abstract class AbstractRoutingAlgorithm extends Object implements RoutingAlgorithm
Author:
Peter Karich
  • Field Details

    • graph

      protected final Graph graph
    • weighting

      protected final Weighting weighting
    • traversalMode

      protected final TraversalMode traversalMode
    • nodeAccess

      protected final NodeAccess nodeAccess
    • edgeExplorer

      protected final EdgeExplorer edgeExplorer
    • maxVisitedNodes

      protected int maxVisitedNodes
    • timeoutMillis

      protected long timeoutMillis
  • Constructor Details

    • AbstractRoutingAlgorithm

      public AbstractRoutingAlgorithm(Graph graph, Weighting weighting, TraversalMode traversalMode)
      Parameters:
      graph - specifies the graph where this algorithm will run on
      weighting - set the used weight calculation (e.g. fastest, shortest).
      traversalMode - how the graph is traversed e.g. if via nodes or edges.
  • Method Details

    • 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
    • accept

      protected boolean accept(EdgeIteratorState iter, int prevOrNextEdgeId)
    • checkAlreadyRun

      protected void checkAlreadyRun()
    • setupFinishTime

      protected void setupFinishTime()
    • 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:
    • createEmptyPath

      protected Path createEmptyPath()
    • getName

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

      public String toString()
      Overrides:
      toString in class Object
    • isMaxVisitedNodesExceeded

      protected boolean isMaxVisitedNodesExceeded()
    • isTimeoutExceeded

      protected boolean isTimeoutExceeded()