V - the graph vertex typeE - the graph edge typepublic class BhandariKDisjointShortestPaths<V,E> extends Object implements KShortestPathAlgorithm<V,E>
The algorithm is running $k$ sequential Bellman-Ford iterations to find the shortest path at each step. Hence, yielding a complexity of $k$*O(Bellman-Ford).
| Constructor and Description |
|---|
BhandariKDisjointShortestPaths(Graph<V,E> graph)
Creates an object to calculate $k$ disjoint shortest paths between the start vertex and
others vertices.
|
| Modifier and Type | Method and Description |
|---|---|
List<GraphPath<V,E>> |
getPaths(V startVertex,
V endVertex,
int k)
Returns the $k$ shortest simple paths in increasing order of weight.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPathspublic BhandariKDisjointShortestPaths(Graph<V,E> graph)
graph - graph on which shortest paths are searched.IllegalArgumentException - if nPaths is negative or 0.IllegalArgumentException - if the graph is null.IllegalArgumentException - if the graph is undirected.public List<GraphPath<V,E>> getPaths(V startVertex, V endVertex, int k)
getPaths in interface KShortestPathAlgorithm<V,E>startVertex - source vertex of the calculated paths.endVertex - target vertex of the calculated paths.k - the number of shortest paths to returnIllegalArgumentException - if the graph does not contain the startVertex or the
endVertexIllegalArgumentException - if the startVertex and the endVertex are the same verticesIllegalArgumentException - if the startVertex or the endVertex is nullCopyright © 2018. All rights reserved.