de.rwth.graph
Class Graph

java.lang.Object
  |
  +--de.rwth.graph.Graph
Direct Known Subclasses:
RootedGraph

public class Graph
extends java.lang.Object

Class for graph data structures consisting of nodes connected with edges. Nodes and edges can be labelled with arbitrary Objects.

This is just a class for data structures! There is no integrated creation, editing, or visualization of graphs.

However, graphs can be visualized by using an external program: dotty.

Version:
$Id: Graph.java,v 1.3 2002/09/17 06:53:53 mohnen Exp $
Author:
Markus Mohnen, Mario Joußen <joussen@i2.informatik.rwth-aachen.de>

Inner Class Summary
 class Graph.Node
          Represents nodes in this graph.
 class Graph.NodeDyer
          Represents a colouring of this graph's nodes.
 
Field Summary
protected  int curNumber
          The number of the last node allocated in this graph.
protected  java.lang.Object label
          The label of this graph.
protected  java.util.LinkedList nodes
          Contains all nodes of this graph.
protected  int sizeEdges
           
 
Constructor Summary
Graph()
          Creates an empty graph without label.
Graph(java.lang.Object label)
          Creates an empty graph with label.
 
Method Summary
 java.lang.Object getLabel()
          Gets the label of this graph.
 java.util.Iterator getNodes()
          Gets all nodes in this graph.
static void main(java.lang.String[] args)
          Mini test environment.
 void setLabel(java.lang.Object label)
          Sets the label of this graph.
 int sizeEdges()
          Gets the number of edges in this graph.
 int sizeNodes()
          Gets the number of nodes in this graph.
 java.lang.String toString()
          Creates a string representation of this graph.
 java.lang.String toString(java.lang.String shape)
          Creates a string representation of this graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nodes

protected java.util.LinkedList nodes
Contains all nodes of this graph. All Elements are of type Node.

label

protected java.lang.Object label
The label of this graph.

curNumber

protected int curNumber
The number of the last node allocated in this graph.

sizeEdges

protected int sizeEdges
Constructor Detail

Graph

public Graph()
Creates an empty graph without label.

Graph

public Graph(java.lang.Object label)
Creates an empty graph with label.
Method Detail

sizeNodes

public int sizeNodes()
Gets the number of nodes in this graph.
Returns:
Number of nodes.

sizeEdges

public int sizeEdges()
Gets the number of edges in this graph.
Returns:
Number of edges.

getNodes

public java.util.Iterator getNodes()
Gets all nodes in this graph.
Returns:
An Iterator with all nodes of this graph;

setLabel

public void setLabel(java.lang.Object label)
Sets the label of this graph.

getLabel

public java.lang.Object getLabel()
Gets the label of this graph.
Returns:
The Object which is the label of this graph.

toString

public java.lang.String toString(java.lang.String shape)
Creates a string representation of this graph. It is suited for layouting the graph using dotty.
Parameters:
shape - A String for the shape of this nodes
Returns:
dotty compatible String representation

toString

public java.lang.String toString()
Creates a string representation of this graph. It is suited for layouting the graph using dotty. The shape of the nodes is box.
Overrides:
toString in class java.lang.Object
Returns:
dotty compatible String representation

main

public static void main(java.lang.String[] args)
Mini test environment.
Parameters:
args - a value of type String[]