public class ShortestPathFirst<N,E>
extends java.lang.Object
Constructor and Description |
---|
ShortestPathFirst(Graph<N,E> g) |
Modifier and Type | Method and Description |
---|---|
N |
nexthop(N to)
Return the next-hop node for the shortest path from the root node to
the given node.
|
java.util.List<Edge<N,E>> |
path(N to)
Return the path from the root node to the 'to' node, as a List
of Edges, in the current SPF tree.
|
N |
root() |
void |
run(N root)
Construct the SPF tree rooted at the given node, to be used for
subsequent shortest-path query call.
|
public void run(N root)
root
- Root node for the Shortest-Path First tree.public java.util.List<Edge<N,E>> path(N to)
to
- The node to query a path forpublic N nexthop(N to)
to
- Destination node to query path forpublic N root()