CTL.Types
Class Graph

java.lang.Object
  extended by CTL.Types.Graph
All Implemented Interfaces:
Writable

public class Graph
extends java.lang.Object
implements Writable

Unoptimized trivial graph class; show case for CTL.Reference Bandwidth usage: 6n + 18m + 9 n: number of nodes; m: number of edges assumption: each node has at least one edge connected to it Sending data and matrix directly: n^2 + 2n + 12


Field Summary
private  boolean[][] adjM
           
private  int edges
           
private  Node[] nodes
           
 
Constructor Summary
Graph(int size)
           
 
Method Summary
 boolean addEdge(int i, int j)
           
 boolean addEdge2(int i, int j)
           
 boolean addNode(Node data)
           
 int cost(int i, int j)
           
 boolean equals(java.lang.Object moo)
           
 int findNode(Node data)
           
 boolean isEdge(int i, int j)
           
 Node node(int i)
           
 void read(SerialIn in)
           
private  void resize(int size)
           
 void setNode(int i, Node data)
           
 int size()
           
 java.lang.String toString()
           
 void write(SerialOut out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nodes

private Node[] nodes

adjM

private boolean[][] adjM

edges

private int edges
Constructor Detail

Graph

public Graph(int size)
Method Detail

size

public int size()

equals

public boolean equals(java.lang.Object moo)
Overrides:
equals in class java.lang.Object

resize

private void resize(int size)

addNode

public boolean addNode(Node data)

findNode

public int findNode(Node data)

isEdge

public boolean isEdge(int i,
                      int j)

cost

public int cost(int i,
                int j)

addEdge

public boolean addEdge(int i,
                       int j)

addEdge2

public boolean addEdge2(int i,
                        int j)

setNode

public void setNode(int i,
                    Node data)

node

public Node node(int i)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

write

public void write(SerialOut out)
           throws java.io.IOException,
                  java.lang.IllegalAccessException,
                  java.lang.reflect.InvocationTargetException,
                  CTLException
Specified by:
write in interface Writable
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
CTLException

read

public void read(SerialIn in)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException,
                 java.lang.InstantiationException,
                 java.lang.IllegalAccessException,
                 java.lang.reflect.InvocationTargetException
Specified by:
read in interface Writable
Throws:
java.io.IOException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException