Class NodeBasedWitnessPathSearcher

java.lang.Object
com.graphhopper.routing.ch.NodeBasedWitnessPathSearcher

public class NodeBasedWitnessPathSearcher extends Object
Used to perform witness searches during node-based CH preparation. Witness searches at node B determine if there is a path between two neighbor nodes A and C when we exclude B and check if this path is shorter than or equal to A-B-C.
  • Constructor Details

    • NodeBasedWitnessPathSearcher

      public NodeBasedWitnessPathSearcher(CHPreparationGraph graph)
  • Method Details

    • init

      public void init(int startNode, int ignoreNode)
      Sets up a search for given start node and an ignored node. The shortest path tree will be re-used for different target nodes until this method is called again.
    • findUpperBound

      public double findUpperBound(int targetNode, double acceptedWeight, int maxSettledNodes)
      Runs or continues a Dijkstra search starting at the startNode and ignoring the ignoreNode given in init(). If the shortest path is found we return its weight. However, this method also returns early if any path was found for which the weight is below or equal to the given acceptedWeight, or the given maximum number of settled nodes is exceeded. In these cases the returned weight can be larger than the actual weight of the shortest path. In any case we get an upper bound for the real shortest path weight.
      Parameters:
      targetNode - the target of the search. if this node is settled we return the weight of the shortest path
      acceptedWeight - once we find a path with weight smaller than or equal to this we return the weight. the returned weight might be larger than the weight of the real shortest path. if there is no path with weight smaller than or equal to this we stop the search and return the best path we found.
      maxSettledNodes - once the number of settled nodes exceeds this number we return the currently found best weight path. in this case we might not have found a path at all.
      Returns:
      the weight of the found path or Double.POSITIVE_INFINITY if no path was found
    • getSettledNodes

      public int getSettledNodes()
    • getMemoryUsageAsString

      public String getMemoryUsageAsString()
      Returns:
      currently used memory in MB (approximately)