Package dsa

Interface Paths

All Known Implementing Classes:
BFSDiPaths, BFSPaths, DFSDiPaths, DFSPaths, Dijkstra

public interface Paths
This interface specifies the API for computing single-source paths in a graph.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    distTo(int v)
    Returns the shortest distance between a designated source vertex and vertex v, or infinity.
    boolean
    hasPathTo(int v)
    Returns true if there is a path between a designated source vertex and vertex * v, and false otherwise.
    pathTo(int v)
    Returns a path between a designated source vertex and vertex v, or null.
  • Method Details

    • hasPathTo

      boolean hasPathTo(int v)
      Returns true if there is a path between a designated source vertex and vertex * v, and false otherwise.
      Parameters:
      v - the vertex.
      Returns:
      true if there is a path between a designated source vertex and vertex v, and false otherwise.
    • pathTo

      Iterable<Integer> pathTo(int v)
      Returns a path between a designated source vertex and vertex v, or null.
      Parameters:
      v - the vertex.
      Returns:
      a path between a designated source vertex and vertex v, or null.
    • distTo

      double distTo(int v)
      Returns the shortest distance between a designated source vertex and vertex v, or infinity.
      Parameters:
      v - the vertex.
      Returns:
      the shortest distance between a designated source vertex and vertex v, or infinity.