Class BellmanFordRouting

  • All Implemented Interfaces:
    com.graphhopper.routing.RoutingAlgorithm

    public class BellmanFordRouting
    extends com.graphhopper.routing.AbstractRoutingAlgorithm
    Implementation of the Bellman-Ford algorithm which supports negative edge costs. This algorithm visits all edges of the network several times, thus it gets very slow on large networks. Be careful with this! :)
    • Field Summary

      • Fields inherited from class com.graphhopper.routing.AbstractRoutingAlgorithm

        edgeExplorer, graph, maxVisitedNodes, nodeAccess, timeoutMillis, traversalMode, weighting
    • Constructor Summary

      Constructors 
      Constructor Description
      BellmanFordRouting​(com.graphhopper.storage.Graph graph, com.graphhopper.routing.weighting.Weighting weighting, com.graphhopper.util.PMap hints)
      Creates a new BellmanFordRouting object based on the AbstractRoutingAlgorithm.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.graphhopper.routing.Path calcPath​(int from, int to)
      Calculates a path between two nodes dependent on the edge costs.
      int getVisitedNodes()  
      • Methods inherited from class com.graphhopper.routing.AbstractRoutingAlgorithm

        accept, calcPaths, checkAlreadyRun, createEmptyPath, getName, isMaxVisitedNodesExceeded, isTimeoutExceeded, setMaxVisitedNodes, setTimeoutMillis, setupFinishTime, toString
    • Constructor Detail

      • BellmanFordRouting

        public BellmanFordRouting​(com.graphhopper.storage.Graph graph,
                                  com.graphhopper.routing.weighting.Weighting weighting,
                                  com.graphhopper.util.PMap hints)
        Creates a new BellmanFordRouting object based on the AbstractRoutingAlgorithm.
        Parameters:
        graph - specifies the graph where this algorithm will run on.
        weighting - set the used weight calculation (e.g. fastest, shortest).
    • Method Detail

      • calcPath

        public com.graphhopper.routing.Path calcPath​(int from,
                                                     int to)
        Calculates a path between two nodes dependent on the edge costs.
        Parameters:
        from - The start node of the path.
        to - The end node of the path
        Returns:
        The ideal path.
      • getVisitedNodes

        public int getVisitedNodes()