Class DijkstraOneToMany

java.lang.Object
com.graphhopper.routing.AbstractRoutingAlgorithm
com.graphhopper.routing.DijkstraOneToMany
All Implemented Interfaces:
RoutingAlgorithm

public class DijkstraOneToMany extends AbstractRoutingAlgorithm
A simple dijkstra tuned to perform multiple one to many queries with the same source and different target nodes more efficiently than Dijkstra. Old data structures are cached between requests and potentially reused and the shortest path tree is stored in (large as the graph) arrays instead of hash maps.

Author:
Peter Karich
  • Field Details

    • weights

      protected double[] weights
  • Constructor Details

  • Method Details

    • calcPath

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

      public DijkstraOneToMany clear()
      Call clear if you have a different start node and need to clear the cache.
    • getWeight

      public double getWeight(int endNode)
    • findEndNode

      public int findEndNode(int from, int to)
    • setWeightLimit

      public void setWeightLimit(double weightLimit)
    • isWeightLimitExceeded

      protected boolean isWeightLimitExceeded()
    • close

      public void close()
    • getVisitedNodes

      public int getVisitedNodes()
      Description copied from interface: RoutingAlgorithm
      Returns the visited nodes after searching. Useful for debugging.
    • getName

      public String getName()
      Specified by:
      getName in interface RoutingAlgorithm
      Overrides:
      getName in class AbstractRoutingAlgorithm
      Returns:
      name of this algorithm
    • getMemoryUsageAsString

      public String getMemoryUsageAsString()
      List currently used memory in MB (approximately)