SSF.OS.OSPF
Class Dijkstra

java.lang.Object
  |
  +--SSF.OS.OSPF.Dijkstra

public class Dijkstra
extends java.lang.Object

Dijkstra's shortest path algorithm. Most of the algorithm is taken from Introduction to Algorithms by Cormen, Leiserson and Rivest.


Constructor Summary
Dijkstra(java.util.Hashtable G, java.lang.String s)
          Constructs a new instance of a Dijkstra's algorithm execution given a graph (where vertices are routers and edges are links) and a source vertex.
 
Method Summary
 boolean computed()
          Returns true if all information initiated and shortest paths calculated.
 boolean findAllShortestPaths()
          Returns the true if all the shortest paths can be found.
 int getDistance(java.lang.String nhipref)
          Returns the distance from the source to the given vertex.
 java.lang.String nextHop(java.lang.String src, java.lang.String dest)
          Returns the NHI prefix of the next hop given a destination NHI prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dijkstra

public Dijkstra(java.util.Hashtable G,
                java.lang.String s)
Constructs a new instance of a Dijkstra's algorithm execution given a graph (where vertices are routers and edges are links) and a source vertex.

Method Detail

findAllShortestPaths

public boolean findAllShortestPaths()
Returns the true if all the shortest paths can be found. Returns false otherwise. Refer to RFC2328:16.1.


getDistance

public int getDistance(java.lang.String nhipref)
Returns the distance from the source to the given vertex.

Parameters:
nhipref - The NHI prefix address of the router (vertex) to find the distance to.

nextHop

public java.lang.String nextHop(java.lang.String src,
                                java.lang.String dest)
Returns the NHI prefix of the next hop given a destination NHI prefix.

Parameters:
src - The NHI prefix address of the router to find the next hop from.
dest - The NHI prefix address of the router toward which the next hop is to be determined.

computed

public boolean computed()
Returns true if all information initiated and shortest paths calculated.