V - vertex typepublic class Dijkstra<V> extends Object implements ShortestPath<V>
| Constructor and Description |
|---|
Dijkstra(DiGraph<V,? extends WeightedArc<V>> g,
V source) |
| Modifier and Type | Method and Description |
|---|---|
double |
distance(V v)
Gets the shortest distance from the source to a vertex.
|
WeightedArc<V> |
lastEdge(V v)
Gets the last edge of a vertex on its shortest distance from the source.
|
public Dijkstra(DiGraph<V,? extends WeightedArc<V>> g, V source)
public double distance(V v)
ShortestPathdistance in interface ShortestPath<V>v - a vertexpublic WeightedArc<V> lastEdge(V v)
ShortestPathlastEdge in interface ShortestPath<V>v - a vertex that is different from the sourcenull if v is inaccessible from the sourceCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.