de.rwth.graph
Class Graph.Node

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

public class Graph.Node
extends java.lang.Object

Represents nodes in this graph.


Inner Class Summary
 class Graph.Node.Edge
          Represents edges starting or ending in this node.
 
Field Summary
protected  java.lang.String attributes
          Additional dotty attributes used by the toString method.
protected  java.util.LinkedList inEdges
          Contains all edges ending in this node.
protected  java.lang.Object label
          The label of this node.
protected  int number
          The unique number of this node in the graph.
protected  java.util.LinkedList outEdges
          Contains all nodes to which an edge starting in this node goes.
 
Constructor Summary
Graph.Node()
          Creates a new node without label or additional attributes in the graph.
Graph.Node(java.lang.Object label)
          Creates a new node with label but without additional attributes in the graph.
Graph.Node(java.lang.Object label, java.lang.String attributes)
          Creates a new node with label and attributes in the graph.
 
Method Summary
 void bendInEdges(Graph.Node node)
          Bends all incoming edges of this node to node.
 void bendOutEdges(Graph.Node node)
          Bends all outgoing edges of this node to node.
 java.lang.String getAttributes()
          Gets the attributes of this node.
 Graph getGraph()
          Gets the containing graph.
 Graph.Node.Edge[] getInArray()
          Returns an array of all incoming edges of this node.
 int getInDegree()
          Gets the number of edges with this node as target.
 java.util.Iterator getInEdges()
          Gets all incoming edges of this node.
 java.lang.Object getLabel()
          Gets the label of this node.
 Graph.Node.Edge[] getOutArray()
          Returns an array of all outgoing edges of this node.
 int getOutDegree()
          Gets the number of edges with this node as source.
 java.util.Iterator getOutEdges()
          Gets all outgoing edges of this node.
 void merge(Graph.Node node)
          Merges this Node with the given node, i.e.
 void remove()
          Removes this node from the graph.
 void setAttributes(java.lang.String attributes)
          Sets the attributes of this node.
 void setLabel(java.lang.Object label)
          Sets the label of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outEdges

protected java.util.LinkedList outEdges
Contains all nodes to which an edge starting in this node goes. All Elements are of type Edge.

inEdges

protected java.util.LinkedList inEdges
Contains all edges ending in this node. All Elements are of type Edge.

number

protected int number
The unique number of this node in the graph.

label

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

attributes

protected java.lang.String attributes
Additional dotty attributes used by the toString method.
Constructor Detail

Graph.Node

public Graph.Node()
Creates a new node without label or additional attributes in the graph.

Graph.Node

public Graph.Node(java.lang.Object label)
Creates a new node with label but without additional attributes in the graph.
Parameters:
label - The label of the node.

Graph.Node

public Graph.Node(java.lang.Object label,
                  java.lang.String attributes)
Creates a new node with label and attributes in the graph.
Parameters:
label - The label of the node.
attributes - The attributes of the node
Method Detail

getGraph

public Graph getGraph()
Gets the containing graph.
Returns:
The graph.

setLabel

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

getLabel

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

setAttributes

public void setAttributes(java.lang.String attributes)
Sets the attributes of this node.
Parameters:
attributes - a String value

getAttributes

public java.lang.String getAttributes()
Gets the attributes of this node.
Returns:
The String which are the attributes.

getInDegree

public int getInDegree()
Gets the number of edges with this node as target.
Returns:
The number of edges.

getOutDegree

public int getOutDegree()
Gets the number of edges with this node as source.
Returns:
The number of edges.

getInEdges

public java.util.Iterator getInEdges()
Gets all incoming edges of this node.
Returns:
An Iterator consisting of incoming Edges.

getOutEdges

public java.util.Iterator getOutEdges()
Gets all outgoing edges of this node.
Returns:
An Iterator consisting of outgoing Edges.

getInArray

public Graph.Node.Edge[] getInArray()
Returns an array of all incoming edges of this node.
Returns:
an array of all incoming edges.

getOutArray

public Graph.Node.Edge[] getOutArray()
Returns an array of all outgoing edges of this node.
Returns:
an array of all outgoing edges.

bendInEdges

public void bendInEdges(Graph.Node node)
Bends all incoming edges of this node to node.
Throws:
java.lang.IllegalArgumentException - if node is not a node in the same graph.

bendOutEdges

public void bendOutEdges(Graph.Node node)
Bends all outgoing edges of this node to node.
Throws:
java.lang.IllegalArgumentException - if node is not a node in the same graph.

remove

public void remove()
Removes this node from the graph.

merge

public void merge(Graph.Node node)
Merges this Node with the given node, i.e. all edges of node are bended to this node and node is removed.
Parameters:
node - a node.
Throws:
java.lang.IllegalArgumentException - if node is not a node in the same graph.