|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.uci.ics.jung.algorithms.shortestpath.UnweightedShortestPath
public class UnweightedShortestPath
Computes the shortest path distances for graphs whose edges are not weighted (using BFS).
| Constructor Summary | |
|---|---|
UnweightedShortestPath(Graph g)
Constructs and initializes algorithm |
|
| Method Summary | |
|---|---|
Number |
getDistance(ArchetypeVertex source,
ArchetypeVertex target)
Returns the distance from the source vertex
to the target vertex. |
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. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UnweightedShortestPath(Graph g)
g - the graph| Method Detail |
|---|
public 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 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 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 node
public void reset()
reset(Vertex) may be appropriate instead.
reset(Vertex)public void reset(Vertex v)
source. Should be called whenever the stored distances
from this vertex are invalidated by changes to the graph.
reset()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||