public class BellmanFordShortestPath<V,E> extends Object
| Modifier and Type | Field and Description | 
|---|---|
protected Graph<V,E> | 
graph
Graph on which shortest paths are searched. 
 | 
protected V | 
startVertex
Start vertex. 
 | 
| Constructor and Description | 
|---|
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. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static <V,E> List<E> | 
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)  | 
List<E> | 
getPathEdgeList(V endVertex)  | 
protected V startVertex
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.public double getCost(V endVertex)
endVertex - end vertex.public 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> 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 endCopyright © 2016. All rights reserved.