V
- the vertex type.E
- the edge type.public class ShortestPath<V extends Vertex,E extends Edge<V>> extends Object
IllegalArgumentException
will be thrown.Modifier and Type | Class and Description |
---|---|
private class |
ShortestPath.EdgeWeightTransformer
Transformer class to transform the edge of a graph to a double (it's weight).
|
Modifier and Type | Field and Description |
---|---|
private edu.uci.ics.jung.graph.AbstractTypedGraph<V,E> |
jungGraph |
private org.apache.commons.collections15.Transformer<E,Number> |
weightTransformer |
Constructor and Description |
---|
ShortestPath(Graph<V,E> graph)
Create a ShortestPath instance.
|
Modifier and Type | Method and Description |
---|---|
double |
calculateDistance(V source,
V target)
Returns the length of a shortest path from the source to the target vertex, or null if the target is not
reachable from the source.
|
List<E> |
getEdgesInPath(V source,
V target)
Returns a List of the edges on the shortest path from source to target, in order of their occurrence on this
path.
|
private edu.uci.ics.jung.graph.AbstractTypedGraph<V extends Vertex,E extends Edge<V>> jungGraph
public final double calculateDistance(V source, V target)
IllegalArgumentException
.source
- the sourcetarget
- the targetpublic final List<E> getEdgesInPath(V source, V target)
source
- the vertex from which distances are measuredtarget
- the number of vertics for which to measure distancesCopyright © 2015 University of Glasgow. All rights reserved.