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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double
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 vertexv
, andfalse
otherwise.Iterable<Integer>
pathTo(int v)
Returns a path between a designated source vertex and vertexv
, ornull
.
-
-
-
Method Detail
-
hasPathTo
boolean hasPathTo(int v)
Returnstrue
if there is a path between a designated source vertex and vertexv
, andfalse
otherwise.- Parameters:
v
- the vertex.- Returns:
true
if there is a path between a designated source vertex and vertexv
, andfalse
otherwise.
-
pathTo
Iterable<Integer> pathTo(int v)
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.
-
-