|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.inria.opengve.bridge.algorithms.common.shortestPath.FloydWarshall<V,E,G>
public abstract class FloydWarshall<V,E extends Link<V>,G extends Graph<V,E>>
This class is the implementation of the Floyd-Warshall algorithms. After
construction some initialization are need before computation.
Map used to load edges distance :
setDistanceMap(Map)
setDistanceName(String)
setDistanceContext(Object)
AbstractScalar corresponding to
infinity : setInfiniteDistance(AbstractScalar)
After initialisation call computeShortestPath() for shortests paths
computation.
You can get result with two methods :
getShortestPath(Object, Object)
getDistance(Object, Object)
| Constructor Summary | |
|---|---|
FloydWarshall(G graph)
Algorithm constructor. |
|
| Method Summary | |
|---|---|
boolean |
computeShortestPath()
Compute shortest path for any cuple of vertices and say if cycle of negative distance was found. |
protected abstract Path<V,E> |
createPath()
Create a new empty path of the same type(directed or undirected) than the graph on which is applied this algorithms. |
AbstractScalar |
getDistance(V source,
V destination)
Give the distance of shortest path beetween two vertices. |
Path<V,E> |
getShortestPath(V source,
V destination)
Give a shortest path between two vertices. |
void |
setDistanceContext(java.lang.Object distanceContext)
Set context used to load distance of edges. |
void |
setDistanceMap(Map distance)
Set the map used to load distance of edges. |
void |
setDistanceName(java.lang.String distanceName)
Set the name used to load distance of edges in the map. |
void |
setInfiniteDistance(AbstractScalar infiniteDistance)
Set the value used as infinite distance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FloydWarshall(G graph)
graph - The graph on which we want compute shortest path for any cuple of
vertices.| Method Detail |
|---|
protected abstract Path<V,E> createPath()
public boolean computeShortestPath()
false if the graph doesn't contains cycles of
negative distance and true otherwise.
public AbstractScalar getDistance(V source,
V destination)
source - The source.destination - The destination.
public Path<V,E> getShortestPath(V source,
V destination)
source - The source.destination - The destination.
null if no path
exist between v1 and v2.public void setDistanceMap(Map distance)
distance - The map used to load distance of edges.public void setDistanceContext(java.lang.Object distanceContext)
distanceContext - The context used to load distance of edges in the map.public void setDistanceName(java.lang.String distanceName)
distanceName - The new name used to load distance of edges in the map.public void setInfiniteDistance(AbstractScalar infiniteDistance)
infiniteDistance - The new infinite distance.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||