Class DijkstraShortestPath<V>

    • Constructor Detail

      • DijkstraShortestPath

        public DijkstraShortestPath​(Graph<V> graph)
        Instantiates a new Dijkstra shortest path.
        Parameters:
        graph - the graph to calculate paths over
      • DijkstraShortestPath

        public DijkstraShortestPath​(Graph<V> graph,
                                    boolean treatUndirected)
        Instantiates a new Dijkstra shortest path.
        Parameters:
        graph - the graph to calculate paths over
        treatUndirected - True treat the graph as undirected (even if it is directed).
    • Method Detail

      • search

        public List<Edge<V>> search​(V startingPoint,
                                    V endingPoint)
        Description copied from interface: GraphSearch
        Searches for a path from the given starting point to the given ending point
        Specified by:
        search in interface GraphSearch<V>
        Parameters:
        startingPoint - the starting point
        endingPoint - the ending point
        Returns:
        the path as a list of edges (empty list if no path exists)
      • distance

        public double distance​(V source,
                               V target)
        Description copied from interface: ShortestPath
        The distance between the two vertices.
        Specified by:
        distance in interface ShortestPath<V>
        Parameters:
        source - the starting (source) vertex
        target - the target vertex
        Returns:
        the distance from source to target (Positive Infinity if no path exists).
      • path

        public List<Edge<V>> path​(V source,
                                  V target)
        Description copied from interface: ShortestPath
        The shortest path (list of edges) from the source to target vertex.
        Specified by:
        path in interface ShortestPath<V>
        Parameters:
        source - the starting (source) vertex
        target - the target vertex
        Returns:
        List of edges from source to target representing the shortest path.
      • reset

        public void reset()
        Resets cached data