Interface ShortestPathAllPairs.IResult

    • Method Detail

      • distance

        double distance​(int source,
                        int 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:
        NoSuchVertexException - if source or target are not vertices in the graph
        IllegalArgumentException - if the shortest paths were computed on pairs of vertices from a subset of the vertices of the graph (rather than all pairs), and source or target are not in the subset
      • distance

        @Deprecated
        default double distance​(Integer source,
                                Integer target)
        Deprecated.
        Please use distance(int, int) instead to avoid un/boxing.
        Get the distance of the shortest path between two vertices.
        Specified by:
        distance in interface ShortestPathAllPairs.Result<Integer,​Integer>
        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
      • getPath

        IPath getPath​(int source,
                      int 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:
        NoSuchVertexException - if source or target are not vertices in the graph
        IllegalArgumentException - if the shortest paths were computed on pairs of vertices from a subset of the vertices of the graph (rather than all pairs), and source or target are not in the subset
      • isReachable

        boolean isReachable​(int source,
                            int target)
        Check if a target vertex is reachable from a source vertex.

        A vertex is reachable from itself.

        Parameters:
        source - the source vertex
        target - the target vertex
        Returns:
        true if there is a path from the source to the target, false otherwise
        Throws:
        NoSuchVertexException - if source or target are not vertices in the graph
      • isReachable

        @Deprecated
        default boolean isReachable​(Integer source,
                                    Integer target)
        Deprecated.
        Please use isReachable(int, int) instead to avoid un/boxing.
        Check if a target vertex is reachable from a source vertex.

        A vertex is reachable from itself.

        Specified by:
        isReachable in interface ShortestPathAllPairs.Result<Integer,​Integer>
        Parameters:
        source - the source vertex
        target - the target vertex
        Returns:
        true if there is a path from the source to the target, false otherwise
      • reachableVerticesFrom

        IntSet reachableVerticesFrom​(int source)
        Get the set of vertices that are reachable from a source vertex.

        A vertex is reachable from itself.

        If the result was obtained from a calculation on a subset of the vertices of the graph, this method may throw an exception, return only the vertices in the subset, or return all vertices reachable.

        Parameters:
        source - the source vertex
        Returns:
        the set of vertices that are reachable from the source vertex
        Throws:
        NoSuchVertexException - if source is not a vertex in the graph
      • reachableVerticesFrom

        @Deprecated
        default IntSet reachableVerticesFrom​(Integer source)
        Deprecated.
        Please use reachableVerticesFrom(int) instead to avoid un/boxing.
        Get the set of vertices that are reachable from a source vertex.

        A vertex is reachable from itself.

        If the result was obtained from a calculation on a subset of the vertices of the graph, this method may throw an exception, return only the vertices in the subset, or return all vertices reachable.

        Specified by:
        reachableVerticesFrom in interface ShortestPathAllPairs.Result<Integer,​Integer>
        Parameters:
        source - the source vertex
        Returns:
        the set of vertices that are reachable from the source vertex
      • reachableVerticesTo

        IntSet reachableVerticesTo​(int target)
        Get the set of vertices that can reach a target vertex.

        A vertex can reach itself.

        If the result was obtained from a calculation on a subset of the vertices of the graph, this method may throw an exception, return only the vertices in the subset, or return all vertices reachable.

        Parameters:
        target - the target vertex
        Returns:
        the set of vertices that can reach the target vertex
        Throws:
        NoSuchVertexException - if target is not a vertex in the graph
      • reachableVerticesTo

        @Deprecated
        default IntSet reachableVerticesTo​(Integer target)
        Deprecated.
        Please use reachableVerticesTo(int) instead to avoid un/boxing.
        Get the set of vertices that can reach a target vertex.

        A vertex can reach itself.

        If the result was obtained from a calculation on a subset of the vertices of the graph, this method may throw an exception, return only the vertices in the subset, or return all vertices reachable.

        Specified by:
        reachableVerticesTo in interface ShortestPathAllPairs.Result<Integer,​Integer>
        Parameters:
        target - the target vertex
        Returns:
        the set of vertices that can reach the target vertex