public class UnweightedShortestPath extends java.lang.Object implements ShortestPath, Distance
| Constructor and Description |
|---|
UnweightedShortestPath(Graph g)
Constructs and initializes algorithm
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Number |
getDistance(ArchetypeVertex source,
ArchetypeVertex target)
Returns the distance from the
source vertex
to the target vertex. |
java.util.Map |
getDistanceMap(ArchetypeVertex source)
Returns a
Map which maps each vertex
in the graph (including the source vertex)
to its distance (represented as a Number)
from source. |
java.util.Map |
getIncomingEdgeMap(Vertex source)
Returns a
LinkedHashMap which maps each vertex
in the graph (including the source vertex)
to the last edge on the shortest path from the
source vertex. |
int |
getShortestPath(Vertex source,
Vertex target)
Deprecated.
use getDistance
|
void |
reset()
Clears all stored distances for this instance.
|
void |
reset(Vertex v)
Clears all stored distances for the specified source vertex
source. |
public UnweightedShortestPath(Graph g)
g - the graphpublic java.lang.Number getDistance(ArchetypeVertex source, ArchetypeVertex target)
Distancesource vertex
to the target vertex. If target
is not reachable from source, returns null.getDistance in interface DistanceDistance.getDistance(edu.uci.ics.jung.graph.ArchetypeVertex, edu.uci.ics.jung.graph.ArchetypeVertex)public java.util.Map getDistanceMap(ArchetypeVertex source)
DistanceReturns a Map which maps each vertex
in the graph (including the source vertex)
to its distance (represented as a Number)
from source. If any vertex
is not reachable from source, no
distance is stored for that vertex.
getDistanceMap in interface DistanceDistance.getDistanceMap(edu.uci.ics.jung.graph.ArchetypeVertex)public java.util.Map getIncomingEdgeMap(Vertex source)
ShortestPathReturns a LinkedHashMap which maps each vertex
in the graph (including the source vertex)
to the last edge on the shortest path from the
source vertex.
getIncomingEdgeMap in interface ShortestPathShortestPath.getIncomingEdgeMap(edu.uci.ics.jung.graph.Vertex)public int getShortestPath(Vertex source, Vertex target)
source - the source nodetarget - the target nodepublic void reset()
reset(Vertex) may be appropriate instead.reset(Vertex)