Class ShortestPathTree

java.lang.Object
com.graphhopper.routing.AbstractRoutingAlgorithm
com.graphhopper.isochrone.algorithm.ShortestPathTree
All Implemented Interfaces:
RoutingAlgorithm

public class ShortestPathTree extends AbstractRoutingAlgorithm
Computes a shortest path tree by a given weighting. Terminates when all shortest paths up to a given travel time, distance, or weight have been explored.

IMPLEMENTATION NOTE: util.PriorityQueue doesn't support efficient removes. We work around this by giving the labels a deleted flag, not remove()ing them, and popping deleted elements off both queues. Note to self/others: If you think this optimization is not needed, please test it with a scenario where updates actually occur a lot, such as using finite, non-zero u-turn costs.

Author:
Peter Karich, Michael Zilske
  • 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.
    • setTimeLimit

      public void setTimeLimit(double limit)
      Time limit in milliseconds
    • setDistanceLimit

      public void setDistanceLimit(double limit)
      Distance limit in meter
    • setWeightLimit

      public void setWeightLimit(double limit)
    • search

      public void search(int from, Consumer<ShortestPathTree.IsoLabel> consumer)
    • getIsochroneEdges

      public Collection<ShortestPathTree.IsoLabel> getIsochroneEdges()
    • getIsochroneEdges

      public ArrayList<ShortestPathTree.IsoLabel> getIsochroneEdges(double z)
    • finished

      protected boolean finished()
    • getName

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

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