|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgrapht.alg.BellmanFordShortestPath<V,E>
public class BellmanFordShortestPath<V,E>
Bellman-Ford algorithm: weights could be negative, paths could be constrained by a maximum number of edges.
Field Summary | |
---|---|
protected Graph<V,E> |
graph
Graph on which shortest paths are searched. |
protected V |
startVertex
Start vertex. |
Constructor Summary | |
---|---|
BellmanFordShortestPath(Graph<V,E> graph,
V startVertex)
Creates an object to calculate shortest paths between the start vertex and others vertices using the Bellman-Ford algorithm. |
|
BellmanFordShortestPath(Graph<V,E> graph,
V startVertex,
int nMaxHops)
Creates an object to calculate shortest paths between the start vertex and others vertices using the Bellman-Ford algorithm. |
|
BellmanFordShortestPath(Graph<V,E> graph,
V startVertex,
int nMaxHops,
double epsilon)
Creates an object to calculate shortest paths between the start vertex and others vertices using the Bellman-Ford algorithm. |
Method Summary | ||
---|---|---|
static
|
findPathBetween(Graph<V,E> graph,
V startVertex,
V endVertex)
Convenience method to find the shortest path via a single static method call. |
|
double |
getCost(V endVertex)
|
|
java.util.List<E> |
getPathEdgeList(V endVertex)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Graph<V,E> graph
protected V startVertex
Constructor Detail |
---|
public BellmanFordShortestPath(Graph<V,E> graph, V startVertex)
graph
- startVertex
- public BellmanFordShortestPath(Graph<V,E> graph, V startVertex, int nMaxHops)
graph
- startVertex
- nMaxHops
- maximum number of edges of the calculated paths.public BellmanFordShortestPath(Graph<V,E> graph, V startVertex, int nMaxHops, double epsilon)
graph
- startVertex
- nMaxHops
- maximum number of edges of the calculated paths.epsilon
- tolerance factor.Method Detail |
---|
public double getCost(V endVertex)
endVertex
- end vertex.
public java.util.List<E> getPathEdgeList(V endVertex)
endVertex
- end vertex.
Edge
, or null if no path exists between the
start vertex and the end vertex.public static <V,E> java.util.List<E> findPathBetween(Graph<V,E> graph, V startVertex, V endVertex)
graph
- the graph to be searchedstartVertex
- the vertex at which the path should startendVertex
- the vertex at which the path should end
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |