gov.nist.antd.merlin.protocol.protectionlink
Class LinkGraph

java.lang.Object
  |
  +--gov.nist.antd.merlin.protocol.protectionlink.LinkGraph

public class LinkGraph
extends java.lang.Object

This class creates a graph from an object OpNet but it doesn't care about the data inside a link.

 This class was developed at the National Institute of Standards and
 Technology by employees of the Federal Government in the course of
 their official duties. Pursuant to title 17 Section 105 of the United
 States Code this software is not subject to copyright protection and
 is in the public domain.
 NIST assumes no responsibility whatsoever for its use by other parties,
 and makes no guarantees, expressed or implied, about its quality,
 reliability, or any other characteristic.
 
We would appreciate acknowledgement if the software is used.
NIST ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.

Author:
borchert
, rouil

Field Summary
static int INFINITY
          Value for an infinite cost
 java.util.Map vertexMap
          This hasmap maps Integer (Host Id) and Vertex
 
Constructor Summary
LinkGraph(Glass net)
          Default constructor Creates a graph of the given net
 
Method Summary
 void addEdge(ExtRouter source, ExtRouter dest, OpticalLink cost)
          Add a new edge to the graph.
 void buildPath(Vertex source, Vertex dest, java.util.Vector v)
          Recursive routine to build path to dest after running shortest path algorithm.
 void clearAll()
          Initializes the vertex output info prior to running any shortest path algorithm.
 Vertex getVertex(int id)
          Return a Vertex that match the given id
 java.util.Vector getVertices()
          Return the vertices of this graph
 void printPath(int id)
          Driver routine to handle unreachables and print total cost.
private  void printPath(Vertex dest)
          Recursive routine to print shortest path to dest after running shortest path algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFINITY

public static final int INFINITY
Value for an infinite cost

See Also:
Constant Field Values

vertexMap

public java.util.Map vertexMap
This hasmap maps Integer (Host Id) and Vertex

Constructor Detail

LinkGraph

public LinkGraph(Glass net)
Default constructor Creates a graph of the given net

Parameters:
net - The net we need a graph representation.
Method Detail

addEdge

public void addEdge(ExtRouter source,
                    ExtRouter dest,
                    OpticalLink cost)
Add a new edge to the graph.

Parameters:
source - The source of the edge
dest - The destination of the edge
cost - The link between the nodes.

printPath

public void printPath(int id)
Driver routine to handle unreachables and print total cost. It calls recursive routine to print shortest path to destNode after a shortest path algorithm has run.

Parameters:
id - The id of the destination

printPath

private void printPath(Vertex dest)
Recursive routine to print shortest path to dest after running shortest path algorithm. The path is known to exist.

Parameters:
dest - The destination vertex.

buildPath

public void buildPath(Vertex source,
                      Vertex dest,
                      java.util.Vector v)
Recursive routine to build path to dest after running shortest path algorithm. The path is known to exist.

Parameters:
source - The source vertex.
dest - The destination vertex
v - The vector where the path is stored.

getVertex

public Vertex getVertex(int id)
Return a Vertex that match the given id

Parameters:
id - The vertex id
Returns:
The vertex object

clearAll

public void clearAll()
Initializes the vertex output info prior to running any shortest path algorithm.


getVertices

public java.util.Vector getVertices()
Return the vertices of this graph

Returns:
The vector of the vertices of this graph