Package org.graffiti.graph
Class AbstractNode
java.lang.Object
org.graffiti.attributes.AbstractAttributable
org.graffiti.graph.AbstractGraphElement
org.graffiti.graph.AbstractNode
- All Implemented Interfaces:
Comparable<GraphElement>
,Attributable
,GraphElement
,Node
- Direct Known Subclasses:
AdjListNode
public abstract class AbstractNode extends AbstractGraphElement implements Node
Abstract class
AbstractNode
common functionality for
Node
implementations.- Version:
- $Revision: 1.12 $
- See Also:
AdjListNode
-
Constructor Summary
Constructors Constructor Description AbstractNode(Graph graph)
Constructs a newAbstractNode
.AbstractNode(Graph graph, CollectionAttribute coll)
Constructs a newAbstractNode
. -
Method Summary
Modifier and Type Method Description Collection<Edge>
getAllInEdges()
Union ofgetDirectedInEdges()
andgetUndirectedEdges()
.Collection<Node>
getAllInNeighbors()
Union ofgetInNeighbors()
andgetUndirectedNeighbors()
.Collection<Edge>
getAllOutEdges()
Union ofgetDirectedOutEdges()
andgetUndirectedEdges()
.Collection<Node>
getAllOutNeighbors()
Union ofgetOutNeighbors()
andgetUndirectedNeighbors()
.Collection<Edge>
getDirectedInEdges()
Returns a collection containing the directed, ingoing edges of theNode
.Collection<Edge>
getDirectedOutEdges()
Returns a collection containing the directed outgoing edges of theNode
.Collection<Edge>
getEdges()
Returns a collection containing all the ingoing and outgoing directed and undirected edges of the currentNode
.int
getInDegree()
Returns the in-degree of the currentNode
.Set<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.Set<Node>
getNeighbors()
Returns a collection containing all the neighbor nodes of the currentNode
.Iterator<Node>
getNeighborsIterator()
Returns an interator over the neighbor nodes of the currentNode
.int
getOutDegree()
Returns the out-degree of the currentNode
.Set<Node>
getOutNeighbors()
Returns a collection containing all the neighbors of the currentNode
which are connected by an outgoingEdge
.Iterator<Node>
getOutNeighborsIterator()
Returns an iterator containing all the neighbors of the currentNode
which are connected by an outgoingEdge
.Collection<Edge>
getUndirectedEdges()
Returns a collection containing the undirected edges of theNode
.Collection<Node>
getUndirectedNeighbors()
Returns a collection containing all the neighbors which are connected to the currentNode
by an undirectedEdge
.Iterator<Node>
getUndirectedNeighborsIterator()
Methods inherited from class org.graffiti.graph.AbstractGraphElement
compareTo, getGraph, getID, getListenerManager, getViewID, setID, setViewID
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, 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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, getAttribute, getAttributes, getBoolean, getByte, getDouble, getFloat, getInteger, getListenerManager, getLong, getShort, getString, removeAttribute, setBoolean, setByte, setDouble, setFloat, setInteger, setLong, setShort, setString
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface org.graffiti.graph.GraphElement
getGraph, getID, getViewID, setID, setViewID
Methods inherited from interface org.graffiti.graph.Node
getDegree, getDirectedInEdgesIterator, getDirectedOutEdgesIterator, getEdgesIterator, getUndirectedEdgesIterator, setGraph
-
Constructor Details
-
AbstractNode
Constructs a newAbstractNode
. Sets the graph of the newAbstractNode
.- Parameters:
graph
- theGraph
the newAbstractNode
instance shall belong to.
-
AbstractNode
Constructs a newAbstractNode
. Sets the graph of the newAbstractNode
.- Parameters:
graph
- theGraph
the newAbstractNode
instance shall belong to.coll
- theCollectionAttribute
of the newly createdAbstractNode
instance.
-
-
Method Details
-
getAllInEdges
Description copied from interface:Node
Union ofgetDirectedInEdges()
andgetUndirectedEdges()
.- Specified by:
getAllInEdges
in interfaceNode
- Returns:
- Collection
- See Also:
Node.getAllInEdges()
-
getAllInNeighbors
Description copied from interface:Node
Union ofgetInNeighbors()
andgetUndirectedNeighbors()
.- Specified by:
getAllInNeighbors
in interfaceNode
- Returns:
- Collection
- See Also:
Node.getAllInNeighbors()
-
getAllOutEdges
Description copied from interface:Node
Union ofgetDirectedOutEdges()
andgetUndirectedEdges()
.- Specified by:
getAllOutEdges
in interfaceNode
- Returns:
- Collection
- See Also:
Node.getAllOutEdges()
-
getAllOutNeighbors
Description copied from interface:Node
Union ofgetOutNeighbors()
andgetUndirectedNeighbors()
.- Specified by:
getAllOutNeighbors
in interfaceNode
- Returns:
- Collection
- See Also:
Node.getAllOutNeighbors()
-
getDirectedInEdges
Returns a collection containing the directed, ingoing edges of theNode
.- Specified by:
getDirectedInEdges
in interfaceNode
- Returns:
- a collection containing the directed, ingoing edges of the
Node
.
-
getDirectedOutEdges
Returns a collection containing the directed outgoing edges of theNode
.- Specified by:
getDirectedOutEdges
in interfaceNode
- Returns:
- a collection containing the directed outgoing edges of the
Node
.
-
getEdges
Returns a collection containing all the ingoing and outgoing directed and undirected edges of the currentNode
. Ingoing and outgoing edges will not be separated and there will be no ordering on the collection. -
getInDegree
public int getInDegree()Returns the in-degree of the currentNode
. The in-degree is defined as the number of ingoing, directed edges plus the number of undirected edges.- Specified by:
getInDegree
in interfaceNode
- Returns:
- the in-degree of the current
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 bygetInDegree()
, due to the fact that multiple edges between the same two nodes are possible but the correspondingNode
is only inserted once.- Specified by:
getInNeighbors
in interfaceNode
- Returns:
- a collection containing the neighbor nodes belonging to incoming edges.
-
getInNeighborsIterator
Returns an iterator over the neighbor nodes belonging to incoming edges.- Specified by:
getInNeighborsIterator
in interfaceNode
- Returns:
- an iterator over the neighbor nodes belonging to incoming edges.
-
getUndirectedNeighborsIterator
- Specified by:
getUndirectedNeighborsIterator
in interfaceNode
-
getNeighbors
Returns a collection containing all the neighbor nodes of the currentNode
. A neighborNode
is either the source or the target of either an ingoing, outgoing or an undirectedEdge
of thisNode
.- Specified by:
getNeighbors
in interfaceNode
- Returns:
- a collection containing all the neighbor nodes of the current
Node
.
-
getNeighborsIterator
Returns an interator over the neighbor nodes of the currentNode
. A neighbor nodes is either the source or the target of either an ingoing or outgoing or undirectedEdge
.- Specified by:
getNeighborsIterator
in interfaceNode
- Returns:
- an iterator over the neighbor nodes of the current
Node
.
-
getOutDegree
public int getOutDegree()Returns the out-degree of the currentNode
. The out-degree is defined as the number of outgoing, directed edges plus the number of undirected edges.- Specified by:
getOutDegree
in interfaceNode
- Returns:
- the out-degree of the current
Node
.
-
getOutNeighbors
Returns a collection containing all the neighbors of the currentNode
which are connected by an outgoingEdge
. The number of Elements returned by this function might be less than the number returned bygetOutDegree()
, due to the fact that multiple edges between the same two nodes are possible but the correspondingNode
is only inserted once.- Specified by:
getOutNeighbors
in interfaceNode
- Returns:
- a collection containing all the neighbor nodes of the current
Node
connected by an outgoingEdge
.
-
getOutNeighborsIterator
Returns an iterator containing all the neighbors of the currentNode
which are connected by an outgoingEdge
.- Specified by:
getOutNeighborsIterator
in interfaceNode
- Returns:
- a Iterator containing all the neighbor nodes of the current
Node
connected by an outgoingEdge
.
-
getUndirectedEdges
Returns a collection containing the undirected edges of theNode
.- Specified by:
getUndirectedEdges
in interfaceNode
- Returns:
- a collection containing the undirected edges of the
Node
.
-
getUndirectedNeighbors
Returns a collection containing all the neighbors which are connected to the currentNode
by an undirectedEdge
.- Specified by:
getUndirectedNeighbors
in interfaceNode
- Returns:
- a collection containing all the neighbors which are connected to the
current
Node
by an undirectedEdge
.
-