de.aitools.iv.graphdrawing.datastructures.graph
Class Vertex

java.lang.Object
  extended by de.aitools.iv.graphdrawing.datastructures.NodeReference
      extended by de.aitools.iv.graphdrawing.datastructures.graph.Vertex
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class Vertex
extends NodeReference
implements java.io.Externalizable

A realy fast implementation of a vertex.
Each Vertex has in- and outgoing edges, a label, an id, a type and an attachment.

Author:
bigben@upb.de, Frank Benteler
See Also:
Serialized Form

Field Summary
 int count
           
 int id
           
 int type
           
 boolean visited
           
 double weight
           
 
Fields inherited from class de.aitools.iv.graphdrawing.datastructures.NodeReference
myNode
 
Constructor Summary
Vertex()
           
Vertex(java.lang.String label, int id)
          creates a new Vertex with the given label and id.
Vertex(java.lang.String label, int id, int type)
          creates a new Vertex with the given label, id and type.
 
Method Summary
 java.util.Iterator adjacentVertexIterator()
           
 Vertex copy()
          creates a vertex with the same label, id, type and position as the current vertex.
All edges, the attachment and the xmlSource are NOT copied to the new created vertex.
 java.lang.Object getAttachment()
          gets the attachment for this vertex
 int getCount()
           
 int getId()
           
 java.lang.String getLabel()
           
 double getSumOfOutgoingEdgeWeights()
           
 int getType()
           
 double getWeight()
           
 java.lang.Object getXMLSource()
          gets the xml source of this vertex, if available (can be null).
 java.util.Iterator incidentEdgeIterator()
           
 java.util.Iterator incomingEdgeIterator()
           
 int indeg()
           
 int outdeg()
           
 java.util.Iterator outgoingEdgeIterator()
           
 void readExternal(java.io.ObjectInput in)
           
 void setAttachment(java.lang.Object obj)
          sets the attachment for this vertex
 void setCount(int count)
           
 void setId(int id)
          sets the identification number
 void setLabel(java.lang.String label)
          Sets the label of this vertex
 void setType(int typeId)
          Sets the type of this vertex.
 void setWeight(double weight)
           
 void setXMLSource(java.lang.Object value)
          sets the xml source of this vertex to value
 java.lang.String toString()
          only for debugging purposes
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class de.aitools.iv.graphdrawing.datastructures.NodeReference
getNode, setNode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

visited

public boolean visited

id

public int id

type

public int type

weight

public double weight

count

public int count
Constructor Detail

Vertex

public Vertex()

Vertex

public Vertex(java.lang.String label,
              int id)
creates a new Vertex with the given label and id. The type is set to '-1'.

Parameters:
label - - the label of the vertex.
id - - the id of the vertex.

Vertex

public Vertex(java.lang.String label,
              int id,
              int type)
creates a new Vertex with the given label, id and type.

Parameters:
label - - the label of the vertex.
id - - the id of the vertex.
type - - the type of the vertex.
Method Detail

getCount

public int getCount()
Returns:
Returns the count.

setCount

public void setCount(int count)
Parameters:
count - The count to set.

getWeight

public double getWeight()
Returns:
Returns the weight.

setWeight

public void setWeight(double weight)
Parameters:
weight - The weight to set.

copy

public Vertex copy()
creates a vertex with the same label, id, type and position as the current vertex.
All edges, the attachment and the xmlSource are NOT copied to the new created vertex.

Returns:
a copy of the current vertex.

getLabel

public java.lang.String getLabel()
Returns:
String that labels the Vertex

setLabel

public void setLabel(java.lang.String label)
Sets the label of this vertex


getId

public int getId()
Returns:
the identification number

setId

public void setId(int id)
sets the identification number


getType

public int getType()
Returns:
the type of this vertex.

setType

public void setType(int typeId)
Sets the type of this vertex.


getAttachment

public java.lang.Object getAttachment()
gets the attachment for this vertex

Returns:
- the Object that was attached to this vertex. Can be null.

setAttachment

public void setAttachment(java.lang.Object obj)
sets the attachment for this vertex

Parameters:
obj - - the Object to be attached. Can be null.

getXMLSource

public java.lang.Object getXMLSource()
gets the xml source of this vertex, if available (can be null).

Returns:
the Object that was the source of this vertex

setXMLSource

public void setXMLSource(java.lang.Object value)
sets the xml source of this vertex to value

Parameters:
value - - the Object to be stored.

indeg

public int indeg()

outdeg

public int outdeg()

getSumOfOutgoingEdgeWeights

public double getSumOfOutgoingEdgeWeights()

incidentEdgeIterator

public java.util.Iterator incidentEdgeIterator()

outgoingEdgeIterator

public java.util.Iterator outgoingEdgeIterator()

incomingEdgeIterator

public java.util.Iterator incomingEdgeIterator()

adjacentVertexIterator

public java.util.Iterator adjacentVertexIterator()

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

toString

public java.lang.String toString()
only for debugging purposes

Overrides:
toString in class java.lang.Object