CTL.Types
Class Graph
java.lang.Object
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
Constructor Summary |
Graph(int size)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
nodes
private Node[] nodes
adjM
private boolean[][] adjM
edges
private int edges
Graph
public Graph(int size)
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