public class KShortestPaths<V,E>
extends java.lang.Object
Constructor and Description |
---|
KShortestPaths(Graph<V,E> graph,
V startVertex,
int k)
Creates an object to compute ranking shortest paths between the start
vertex and others vertices.
|
KShortestPaths(Graph<V,E> graph,
V startVertex,
int nPaths,
int nMaxHops)
Creates an object to calculate ranking shortest paths between the start
vertex and others vertices.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<GraphPath<V,E>> |
getPaths(V endVertex)
Returns the k shortest simple paths in increasing order of weight.
|
public KShortestPaths(Graph<V,E> graph, V startVertex, int k)
graph
- startVertex
- k
- number of paths to be computed.public KShortestPaths(Graph<V,E> graph, V startVertex, int nPaths, int nMaxHops)
graph
- graph on which shortest paths are searched.startVertex
- start vertex of the calculated paths.nPaths
- number of ranking paths between the start vertex and an end
vertex.nMaxHops
- maximum number of edges of the calculated paths.java.lang.NullPointerException
- if the specified graph or startVertex is
null
.java.lang.IllegalArgumentException
- if nPaths is negative or 0.java.lang.IllegalArgumentException
- if nMaxHops is negative or 0.public java.util.List<GraphPath<V,E>> getPaths(V endVertex)
endVertex
- target vertex of the calculated paths.null
if no path exists between the
start vertex and the end vertex.