public class UnweightedShortestPath<V,E> extends java.lang.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 |
---|---|
java.lang.Number |
getDistance(V source,
V target)
Returns the distance from the
source vertex
to the target vertex. |
java.util.Map<V,java.lang.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 . |
java.util.Map<V,E> |
getIncomingEdgeMap(V source)
Returns a
Map which maps each vertex
in the graph (including the source vertex)
to the last edge on the shortest path from the
source vertex. |
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 java.lang.Number getDistance(V source, V target)
Distance
source
vertex
to the target
vertex. If target
is not reachable from source
, returns null.getDistance
in interface Distance<V>
public java.util.Map<V,java.lang.Number> getDistanceMap(V source)
Distance
Returns 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 Distance<V>
public java.util.Map<V,E> getIncomingEdgeMap(V source)
ShortestPath
Returns a Map
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 ShortestPath<V,E>
public void reset()
reset(V)
may be appropriate instead.reset(Object)
Copyright © 2021, 2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence