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 TypeMethodDescriptiondouble
distTo
(int v) Returns the shortest distance between a designated source vertex and vertexv
, or infinity.boolean
hasPathTo
(int v) Returnstrue
if there is a path between a designated source vertex and vertex *v
, andfalse
otherwise.pathTo
(int v) Returns a path between a designated source vertex and vertexv
, ornull
.
-
Method Details
-
hasPathTo
boolean hasPathTo(int v) Returnstrue
if there is a path between a designated source vertex and vertex *v
, andfalse
otherwise.- Parameters:
v
- the vertex.- Returns:
true
if there is a path between a designated source vertex and vertexv
, andfalse
otherwise.
-
pathTo
Returns a path between a designated source vertex and vertexv
, ornull
.- Parameters:
v
- the vertex.- Returns:
- a path between a designated source vertex and vertex
v
, ornull
.
-
distTo
double distTo(int v) Returns the shortest distance between a designated source vertex and vertexv
, or infinity.- Parameters:
v
- the vertex.- Returns:
- the shortest distance between a designated source vertex and vertex
v
, or infinity.
-