Interface ShortestPathAllPairs.Result<V,​E>

    • Method Detail

      • distance

        double distance​(V source,
                        V target)
        Get the distance of the shortest path between two vertices.
        Parameters:
        source - the source vertex
        target - the target vertex
        Returns:
        the sum of weights of edges in the shortest path from the source to target, or Double.POSITIVE_INFINITY if no such path exists
        Throws:
        IllegalArgumentException - if a negative cycle found. See foundNegativeCycle()
      • getPath

        Path<V,​E> getPath​(V source,
                                V target)
        Get the shortest path between vertices.
        Parameters:
        source - the source vertex
        target - the target vertex
        Returns:
        the shortest path from the source to target, or null if no such path exists
        Throws:
        IllegalArgumentException - if a negative cycle found. See foundNegativeCycle()
      • foundNegativeCycle

        boolean foundNegativeCycle()
        Check whether a negative cycle was found.

        If a negative cycle was found, there is no unique shortest paths, as the paths weight could be arbitrary small by going through the cycle multiple times.

        Returns:
        true if a negative cycle was found