org.graffiti.graph
Class AbstractNode

java.lang.Object
  extended by org.graffiti.attributes.AbstractAttributable
      extended by org.graffiti.graph.AbstractGraphElement
          extended by org.graffiti.graph.AbstractNode
All Implemented Interfaces:
Attributable, GraphElement, Node
Direct Known Subclasses:
AdjListNode, FastNode

public abstract class AbstractNode
extends AbstractGraphElement
implements Node

Abstract class AbstractNode common functionality for Node implementations.

Version:
$Revision: 5767 $
See Also:
AdjListNode

Field Summary
 
Fields inherited from class org.graffiti.graph.AbstractGraphElement
graph
 
Fields inherited from class org.graffiti.attributes.AbstractAttributable
attributes
 
Constructor Summary
AbstractNode(Graph graph)
          Constructs a new AbstractNode.
AbstractNode(Graph graph, CollectionAttribute coll)
          Constructs a new AbstractNode.
 
Method Summary
 Collection<Edge> getAllInEdges()
          Union of getDirectedInEdges() and getUndirectedEdges() .
 Collection<Node> getAllInNeighbors()
          Union of getInNeighbors() and getUndirectedNeighbors() .
 Collection<Edge> getAllOutEdges()
          Union of getDirectedOutEdges() and getUndirectedEdges() .
 Collection<Node> getAllOutNeighbors()
          Union of getOutNeighbors() and getUndirectedNeighbors().
 Collection<Edge> getDirectedInEdges()
          Returns a collection containing the directed, ingoing edges of the Node.
 Collection<Edge> getDirectedOutEdges()
          Returns a collection containing the directed outgoing edges of the Node.
 Collection<Edge> getEdges()
          Returns a collection containing all the ingoing and outgoing directed and undirected edges of the current Node.
 int getInDegree()
          Returns the in-degree of the current Node.
 Collection<Node> getInNeighbors()
          Returns a collection containing the neighbor nodes belonging to incoming edges.
 Iterator<Node> getInNeighborsIterator()
          Returns an iterator over the neighbor nodes belonging to incoming edges.
 Collection<Node> getNeighbors()
          Returns a collection containing all the neighbor nodes of the current Node.
 Iterator<Node> getNeighborsIterator()
          Returns an interator over the neighbor nodes of the current Node.
 int getOutDegree()
          Returns the out-degree of the current Node.
 Collection<Node> getOutNeighbors()
          Returns a collection conataining all the neighbors of the current Node which are connected by an outgoing Edge.
 Iterator<Node> getOutNeighborsIterator()
          Returns an iterator conataining all the neighbors of the current Node which are connected by an outgoing Edge.
 Collection<Edge> getUndirectedEdges()
          Returns a collection containing the undirected edges of the Node.
 Collection<Node> getUndirectedNeighbors()
          Returns a collection containing all the neighbors which are connected to the current Node by an undirected Edge.
 
Methods inherited from class org.graffiti.graph.AbstractGraphElement
getGraph, getListenerManager, remove, toString
 
Methods inherited from class org.graffiti.attributes.AbstractAttributable
addAttribute, addBoolean, addByte, addDouble, addFloat, addInteger, addLong, addShort, addString, changeBoolean, changeByte, changeDouble, changeFloat, changeInteger, changeLong, changeShort, changeString, containsAttribute, getAttribute, getAttributes, getBoolean, getByte, getDouble, getFloat, getInteger, getLong, getShort, getString, removeAttribute, setBoolean, setByte, setDouble, setFloat, setInteger, setLong, setShort, setString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.graffiti.graph.Node
getDirectedInEdgesIterator, getDirectedOutEdgesIterator, getEdgesIterator, getUndirectedEdgesIterator
 
Methods inherited from interface org.graffiti.graph.GraphElement
getGraph, remove
 
Methods inherited from interface org.graffiti.attributes.Attributable
addAttribute, addBoolean, addByte, addDouble, addFloat, addInteger, addLong, addShort, addString, changeBoolean, changeByte, changeDouble, changeFloat, changeInteger, changeLong, changeShort, changeString, containsAttribute, getAttribute, getAttributes, getBoolean, getByte, getDouble, getFloat, getInteger, getListenerManager, getLong, getShort, getString, removeAttribute, setBoolean, setByte, setDouble, setFloat, setInteger, setLong, setShort, setString
 

Constructor Detail

AbstractNode

public AbstractNode(Graph graph)
Constructs a new AbstractNode. Sets the graph of the new AbstractNode.

Parameters:
graph - the Graph the new AbstractNode instance shall belong to.

AbstractNode

public AbstractNode(Graph graph,
                    CollectionAttribute coll)
Constructs a new AbstractNode. Sets the graph of the new AbstractNode.

Parameters:
graph - the Graph the new AbstractNode instance shall belong to.
coll - the CollectionAttribute of the newly created AbstractNode instance.
Method Detail

getAllInEdges

public Collection<Edge> getAllInEdges()
Description copied from interface: Node
Union of getDirectedInEdges() and getUndirectedEdges() .

Specified by:
getAllInEdges in interface Node
Returns:
Collection
See Also:
Node.getAllInEdges()

getAllInNeighbors

public Collection<Node> getAllInNeighbors()
Description copied from interface: Node
Union of getInNeighbors() and getUndirectedNeighbors() .

Specified by:
getAllInNeighbors in interface Node
Returns:
Collection
See Also:
Node.getAllInNeighbors()

getAllOutEdges

public Collection<Edge> getAllOutEdges()
Description copied from interface: Node
Union of getDirectedOutEdges() and getUndirectedEdges() .

Specified by:
getAllOutEdges in interface Node
Returns:
Collection
See Also:
Node.getAllOutEdges()

getAllOutNeighbors

public Collection<Node> getAllOutNeighbors()
Description copied from interface: Node
Union of getOutNeighbors() and getUndirectedNeighbors().

Specified by:
getAllOutNeighbors in interface Node
Returns:
Collection
See Also:
Node.getAllOutNeighbors()

getDirectedInEdges

public Collection<Edge> getDirectedInEdges()
Returns a collection containing the directed, ingoing edges of the Node.

Specified by:
getDirectedInEdges in interface Node
Returns:
a collection containing the directed, ingoing edges of the Node.

getDirectedOutEdges

public Collection<Edge> getDirectedOutEdges()
Returns a collection containing the directed outgoing edges of the Node.

Specified by:
getDirectedOutEdges in interface Node
Returns:
a collection containing the directed outgoing edges of the Node.

getEdges

public Collection<Edge> getEdges()
Returns a collection containing all the ingoing and outgoing directed and undirected edges of the current Node. Ingoing and outgoing edges will not be separated and there will be no ordering on the collection.

Specified by:
getEdges in interface Node
Returns:
a collection containing all ingoing and outgoing directed and undirected edges of the current Node.

getInDegree

public int getInDegree()
Returns the in-degree of the current Node. The in-degree is defined as the number of ingoing, directed edges plus the number of undirected edges.

Specified by:
getInDegree in interface Node
Returns:
the in-degree of the current Node.

getInNeighbors

public Collection<Node> getInNeighbors()
Returns a collection containing the neighbor nodes belonging to incoming edges. The number of Elements returned by this function might be less than the number returned by getInDegree(), due to the fact that multiple edges between the same two nodes are possible but the corresponding Node is only inserted once.

Specified by:
getInNeighbors in interface Node
Returns:
a collection containing the neighbor nodes belonging to incoming edges.

getInNeighborsIterator

public Iterator<Node> getInNeighborsIterator()
Returns an iterator over the neighbor nodes belonging to incoming edges.

Specified by:
getInNeighborsIterator in interface Node
Returns:
an iterator over the neighbor nodes belonging to incoming edges.

getNeighbors

public Collection<Node> getNeighbors()
Returns a collection containing all the neighbor nodes of the current Node. A neighbor Node is either the source or the target of either an ingoing, outgoing or an undirected Edge of this Node.

Specified by:
getNeighbors in interface Node
Returns:
a collection containing all the neighbor nodes of the current Node.

getNeighborsIterator

public Iterator<Node> getNeighborsIterator()
Returns an interator over the neighbor nodes of the current Node. A neighbor nodes is either the source or the target of either an ingoing or outgoing or undirected Edge.

Specified by:
getNeighborsIterator in interface Node
Returns:
an iterator over the neighbor nodes of the current Node.

getOutDegree

public int getOutDegree()
Returns the out-degree of the current Node. The out-degree is defined as the number of outgoing, directed edges plus the number of undirected edges.

Specified by:
getOutDegree in interface Node
Returns:
the out-degree of the current Node.

getOutNeighbors

public Collection<Node> getOutNeighbors()
Returns a collection conataining all the neighbors of the current Node which are connected by an outgoing Edge. The number of Elements returned by this function might be less than the number returned by getOutDegree(), due to the fact that multiple edges between the same two nodes are possible but the corresponding Node is only inserted once.

Specified by:
getOutNeighbors in interface Node
Returns:
a collection containing all the neighbor nodes of the current Node connected by an outgoing Edge.

getOutNeighborsIterator

public Iterator<Node> getOutNeighborsIterator()
Returns an iterator conataining all the neighbors of the current Node which are connected by an outgoing Edge.

Specified by:
getOutNeighborsIterator in interface Node
Returns:
a Iterator containing all the neighbor nodes of the current Node connected by an outgoing Edge.

getUndirectedEdges

public Collection<Edge> getUndirectedEdges()
Returns a collection containing the undirected edges of the Node.

Specified by:
getUndirectedEdges in interface Node
Returns:
a collection containing the undirected edges of the Node.

getUndirectedNeighbors

public Collection<Node> getUndirectedNeighbors()
Returns a collection containing all the neighbors which are connected to the current Node by an undirected Edge.

Specified by:
getUndirectedNeighbors in interface Node
Returns:
a collection containing all the neighbors which are connected to the current Node by an undirected Edge.


Generated at 2012-05-30 11:00:36 PM CEST