Interface ShortestPathSingleSource.Result<V,​E>

    • Method Detail

      • distance

        double distance​(V target)
        Get the distance to a target vertex.
        Parameters:
        target - a target vertex in the graph
        Returns:
        the sum of the shortest path edges from the source to the target, or Double.POSITIVE_INFINITY if no such path found.
        Throws:
        IllegalStateException - if and negative cycle was found and foundNegativeCycle() return true.
      • getPath

        Path<V,​E> getPath​(V target)
        Get shortest path to a target vertex.
        Parameters:
        target - a target vertex in the graph
        Returns:
        the shortest path from the source to the target or null if no such path found.
        Throws:
        IllegalStateException - if a negative cycle was found and foundNegativeCycle() return true.
      • foundNegativeCycle

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

        If a negative cycle was found, the 'shortest paths' are not well defined, as a path can loop in the cycle and achieve arbitrary small 'length'.

        Returns:
        true if a negative cycle found, else false.
      • getNegativeCycle

        Path<V,​E> getNegativeCycle()
        Get the negative cycle that was found.
        Returns:
        the negative cycle that was found.
        Throws:
        IllegalStateException - if no negative cycle was found and foundNegativeCycle() return false.