public class UnweightedShortestPath<V,E> extends Object implements ShortestPath<V,E>, Distance<V>
| Constructor and Description |
|---|
UnweightedShortestPath(Hypergraph<V,E> g)
Constructs and initializes algorithm
|
| Modifier and Type | Method and Description |
|---|---|
Number |
getDistance(V source,
V target)
Returns the distance from the
source vertex to the
target vertex. |
Map<V,Number> |
getDistanceMap(V 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<V,E> |
getIncomingEdgeMap(V source)
Returns a map from vertices to the last edge on the shortest path to that vertex
starting from
source. |
void |
reset()
Clears all stored distances for this instance.
|
void |
reset(V v)
Clears all stored distances for the specified source vertex
source. |
public UnweightedShortestPath(Hypergraph<V,E> g)
g - the graphpublic Number getDistance(V source, V target)
Distancesource vertex to the
target vertex. If target is not reachable from
source, returns null.getDistance in interface Distance<V>source - the vertex from which distance is to be measuredtarget - the vertex to which distance is to be measuredsource to targetDistance.getDistance(Object, Object)public Map<V,Number> getDistanceMap(V source)
DistanceMap 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 Distance<V>source - the vertex from which distances are to be measuredMap of the distances from source to other vertices in the graphDistance.getDistanceMap(Object)public Map<V,E> getIncomingEdgeMap(V source)
ShortestPathsource.getIncomingEdgeMap in interface ShortestPath<V,E>source - the starting point for the shortest pathssourceShortestPath.getIncomingEdgeMap(Object)public void reset()
reset(V) may be appropriate instead.reset(Object)Copyright © 2016. All rights reserved.