Interface SSSPResult<N,​E>

  • Type Parameters:
    N - node class
    E - edge class
    All Known Implementing Classes:
    DijkstraSSSP

    public interface SSSPResult<N,​E>
    Result interface for the single-source shortest path (SSSP) problem.
    • Method Detail

      • getInitialNode

        N getInitialNode()
        Retrieves the node the source was started from.
        Returns:
        the source node
      • getShortestPathDistance

        float getShortestPathDistance​(N target)
        Retrieves the length of the shortest path from the initial node to the given one.
        Parameters:
        target - the target node
        Returns:
        the length of the shortest path from the initial node to the given target node, or Graphs.INVALID_DISTANCE if there exists no such path.
      • getShortestPath

        @Nullable List<E> getShortestPath​(N target)
        Retrieves the shortest path from the initial node to the given one (as a sequence of edges), or null if there exists no such path.

        Note that implementations might construct these paths on-the-fly.

        Parameters:
        target - the target node
        Returns:
        the path from the initial node to the given target node, or null if there exists no such path.
      • getShortestPathEdge

        @Nullable E getShortestPathEdge​(N target)
        Retrieves the incoming edge via which the given node is reached on the shortest path. If the node is not reachable, or it is the initial node, null is returned.
        Parameters:
        target - the target node
        Returns:
        the reaching edge on the shortest path, or null.