Interface Distance<V>
- All Known Implementing Classes:
DijkstraDistance,DijkstraShortestPath,UnweightedShortestPath
public interface Distance<V>
An interface for classes which calculate the distance between
one vertex and another.
- Author:
- Joshua O'Madadhain
-
Method Summary
Modifier and TypeMethodDescriptiongetDistance(V source, V target) Returns the distance from thesourcevertex to thetargetvertex.getDistanceMap(V source) Returns aMapwhich maps each vertex in the graph (including thesourcevertex) to its distance (represented as a Number) fromsource.
-
Method Details
-
getDistance
Returns the distance from thesourcevertex to thetargetvertex. Iftargetis not reachable fromsource, returns null.- Parameters:
source- the vertex from which distance is to be measuredtarget- the vertex to which distance is to be measured- Returns:
- the distance from
sourcetotarget
-
getDistanceMap
Returns aMapwhich maps each vertex in the graph (including thesourcevertex) to its distance (represented as a Number) fromsource. If any vertex is not reachable fromsource, no distance is stored for that vertex.- Parameters:
source- the vertex from which distances are to be measured- Returns:
- a
Mapof the distances fromsourceto other vertices in the graph
-