public abstract class AbstractNode extends AbstractElement implements Node
This class provides a basic implementation of Node interface, to
minimize the effort required to implement this interface.
This class implements all the methods of
org.graphstream.graph.implementations and most of the
methods of org.graphstream.graph (there are "only" ten abstract
methods). In addition to these, subclasses must provide implementations for
addEdgeCallback(AbstractEdge) and
removeEdgeCallback(AbstractEdge) which are called by the parent
graph when an edge incident to this node is added to or removed from the
graph. This class has a low memory overhead (one reference as field).
AbstractElement.AttributeChangeEvent| Modifier and Type | Method and Description |
|---|---|
<T extends Node> |
getBreadthFirstIterator()
This implementation creates an instance of
org.graphstream.graph and returns it. |
<T extends Node> |
getBreadthFirstIterator(boolean directed)
This implementation creates an instance of
org.graphstream.graph and returns it. |
abstract int |
getDegree()
Total number of relations with other nodes or this node.
|
<T extends Node> |
getDepthFirstIterator()
This implementation creates an instance of
org.graphstream.graph and returns it. |
<T extends Node> |
getDepthFirstIterator(boolean directed)
This implementation creates an instance of
org.graphstream.graph and returns it. |
<T extends Edge> |
getEachEdge()
This implementation uses
getEdgeIterator() |
<T extends Edge> |
getEachEnteringEdge()
This implementation uses
getEnteringEdgeIterator() |
<T extends Edge> |
getEachLeavingEdge()
This implementation uses
getLeavingEdgeIterator() |
abstract <T extends Edge> |
getEdge(int i)
I-th edge.
|
<T extends Edge> |
getEdgeBetween(int index)
This implementation uses
getEdgeBetween(Node) |
abstract <T extends Edge> |
getEdgeBetween(Node node)
Retrieves an edge between this node and and another node if one exists.
|
<T extends Edge> |
getEdgeBetween(String id)
This implementation uses
getEdgeBetween(Node) |
<T extends Edge> |
getEdgeFrom(int index)
This implementation uses
getEdgeFrom(Node) |
abstract <T extends Edge> |
getEdgeFrom(Node node)
Retrieves an edge that leaves given node toward this node.
|
<T extends Edge> |
getEdgeFrom(String id)
This implementation uses
getEdgeFrom(Node) |
abstract <T extends Edge> |
getEdgeIterator()
Iterator on the set of connected edges.
|
<T extends Edge> |
getEdgeSet()
This implementation uses
getEdgeIterator() and
getDegree() |
<T extends Edge> |
getEdgeToward(int index)
This implementation uses
getEdgeToward(Node) |
abstract <T extends Edge> |
getEdgeToward(Node node)
Retrieves an edge that leaves this node toward another node.
|
<T extends Edge> |
getEdgeToward(String id)
This implementation uses
getEdgeToward(Node) |
abstract <T extends Edge> |
getEnteringEdge(int i)
I-th entering edge.
|
abstract <T extends Edge> |
getEnteringEdgeIterator()
Iterator only on leaving edges.
|
<T extends Edge> |
getEnteringEdgeSet()
This implementation uses
getEnteringEdgeIterator() and
#geIntDegree() |
Graph |
getGraph()
This implementation returns
graph. |
abstract int |
getInDegree()
Number of entering edges.
|
abstract <T extends Edge> |
getLeavingEdge(int i)
I-th leaving edge.
|
abstract <T extends Edge> |
getLeavingEdgeIterator()
Iterator only on entering edges.
|
<T extends Edge> |
getLeavingEdgeSet()
This implementation uses
#getLeavingIterator() and
#geOuttDegree() |
<T extends Node> |
getNeighborNodeIterator()
This implementation uses
getEdgeIterator() and stores the
visited nodes in a set. |
abstract int |
getOutDegree()
Number of leaving edges.
|
boolean |
hasEdgeBetween(int index)
|
boolean |
hasEdgeBetween(Node node)
|
boolean |
hasEdgeBetween(String id)
|
boolean |
hasEdgeFrom(int index)
|
boolean |
hasEdgeFrom(Node node)
|
boolean |
hasEdgeFrom(String id)
|
boolean |
hasEdgeToward(int index)
|
boolean |
hasEdgeToward(Node node)
|
boolean |
hasEdgeToward(String id)
|
boolean |
isEnteringEdge(Edge e)
Checks if an edge enters this node.
|
boolean |
isIncidentEdge(Edge e)
Checks if an edge is incident to this node.
|
boolean |
isLeavingEdge(Edge e)
Checks if an edge leaves this node.
|
Iterator<Edge> |
iterator()
This implementation uses
getEdgeIterator() |
addAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute, toStringequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttributepublic Graph getGraph()
graph.getGraph in interface NodeNode.getGraph()public abstract int getDegree()
Nodepublic abstract int getInDegree()
NodegetInDegree in interface Nodepublic abstract int getOutDegree()
NodegetOutDegree in interface Nodepublic boolean hasEdgeToward(Node node)
hasEdgeToward in interface Nodenode - The target node.Node.getEdgeToward(org.graphstream.graph.Node)public boolean hasEdgeToward(int index)
hasEdgeToward in interface Nodeindex - Index of the target node.Node.hasEdgeToward(int)public boolean hasEdgeToward(String id)
hasEdgeToward in interface Nodeid - Identifier of the target node.Node.hasEdgeToward(java.lang.String)public boolean hasEdgeFrom(Node node)
hasEdgeFrom in interface Nodenode - The source node.Node.hasEdgeFrom(org.graphstream.graph.Node)public boolean hasEdgeFrom(int index)
hasEdgeFrom in interface Nodeindex - Index of the source node.Node.hasEdgeFrom(int)public boolean hasEdgeFrom(String id)
hasEdgeFrom in interface Nodeid - Identifier of the source node.Node.hasEdgeFrom(java.lang.String)public boolean hasEdgeBetween(Node node)
hasEdgeBetween in interface Nodenode - Another node.Node.hasEdgeBetween(org.graphstream.graph.Node)public boolean hasEdgeBetween(int index)
hasEdgeBetween in interface Nodeindex - Index of another node.Node.hasEdgeBetween(int)public boolean hasEdgeBetween(String id)
hasEdgeBetween in interface Nodeid - Identifier of another node.Node.hasEdgeBetween(java.lang.String)public abstract <T extends Edge> T getEdgeToward(Node node)
NodeThis method selects only edges leaving this node an pointing at the parameter node (this also selects undirected edges).
This method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getEdgeToward(...);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getEdgeToward in interface Nodenode - The target node.public <T extends Edge> T getEdgeToward(int index)
getEdgeToward(Node)getEdgeToward in interface Nodeindex - Index of the target node.Node.getEdgeToward(int)public <T extends Edge> T getEdgeToward(String id)
getEdgeToward(Node)getEdgeToward in interface Nodeid - Identifier of the target node.Node.getEdgeToward(java.lang.String)public abstract <T extends Edge> T getEdgeFrom(Node node)
NodeThis method selects only edges leaving the other node an pointing at this node (this also selects undirected edges).
This method is implicitly generic and returns something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getEdgeFrom(...);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getEdgeFrom in interface Nodenode - The source node.public <T extends Edge> T getEdgeFrom(int index)
getEdgeFrom(Node)getEdgeFrom in interface Nodeindex - Index of the source node.Node.getEdgeFrom(int)public <T extends Edge> T getEdgeFrom(String id)
getEdgeFrom(Node)getEdgeFrom in interface Nodeid - Identifier of the source node.Node.getEdgeFrom(java.lang.String)public abstract <T extends Edge> T getEdgeBetween(Node node)
NodeThis method selects directed or undirected edges. If the edge is directed, its direction is not important and leaving or entering edges will be selected.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getEdgeBetween(...);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getEdgeBetween in interface Nodenode - The opposite node.public <T extends Edge> T getEdgeBetween(int index)
getEdgeBetween(Node)getEdgeBetween in interface Nodeindex - The index of the opposite node.Node.getEdgeBetween(int)public <T extends Edge> T getEdgeBetween(String id)
getEdgeBetween(Node)getEdgeBetween in interface Nodeid - Identifier of the opposite node.Node.getEdgeBetween(java.lang.String)public abstract <T extends Edge> Iterator<T> getEdgeIterator()
NodeThis iterator iterates on all edges leaving and entering (this includes any non-directed edge present, and a non-directed edge is only iterated once).
This method is implicitly generic and return an Iterator over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterator<ExtendedEdge> ite = node.getEdgeIterator();the method will return an Iterator<ExtendedEdge>. If no left part exists, method will just return an Iterator<Edge>.
getEdgeIterator in interface Nodepublic abstract <T extends Edge> Iterator<T> getEnteringEdgeIterator()
NodeThis iterator iterates only on directed edges going from this node to others (non-directed edges are included in the iteration).
This method is implicitly generic and return an Iterator over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterator<ExtendedEdge> ite = node.getEnteringEdgeIterator();the method will return an Iterator<ExtendedEdge>. If no left part exists, method will just return an Iterator<Edge>.
getEnteringEdgeIterator in interface Nodepublic abstract <T extends Edge> Iterator<T> getLeavingEdgeIterator()
NodeThis iterator iterates only on directed edges going from other nodes toward this node (non-directed edges are included in the iteration).
This method is implicitly generic and return an Iterator over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterator<ExtendedEdge> ite = node.getLeavingEdgeIterator();the method will return an Iterator<ExtendedEdge>. If no left part exists, method will just return an Iterator<Edge>.
getLeavingEdgeIterator in interface Nodepublic <T extends Edge> Iterable<T> getEachEdge()
getEdgeIterator()getEachEdge in interface NodeNode.getEachEdge()public <T extends Edge> Iterable<T> getEachEnteringEdge()
getEnteringEdgeIterator()getEachEnteringEdge in interface NodeNode.getEachEnteringEdge()public <T extends Edge> Iterable<T> getEachLeavingEdge()
getLeavingEdgeIterator()getEachLeavingEdge in interface NodeNode.getEachLeavingEdge()public <T extends Edge> Collection<T> getEdgeSet()
getEdgeIterator() and
getDegree()getEdgeSet in interface NodeNode.getEdgeSet()public <T extends Edge> Collection<T> getEnteringEdgeSet()
getEnteringEdgeIterator() and
#geIntDegree()getEnteringEdgeSet in interface NodeNode.getEnteringEdgeSet()public <T extends Edge> Collection<T> getLeavingEdgeSet()
#getLeavingIterator() and
#geOuttDegree()getLeavingEdgeSet in interface NodeNode.getLeavingEdgeSet()public Iterator<Edge> iterator()
getEdgeIterator()iterator in interface Iterable<Edge>Iterable.iterator()public abstract <T extends Edge> T getEdge(int i)
NodeHowever this method allows to iterate very quickly on all edges, or to choose a given edge with direct access.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getEdge(i);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
public abstract <T extends Edge> T getEnteringEdge(int i)
NodeHowever this method allows to iterate very quickly on all entering edges, or to choose a given entering edge with direct access.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getEnteringEdge(i);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getEnteringEdge in interface Nodei - Index of the edge.public abstract <T extends Edge> T getLeavingEdge(int i)
NodeHowever this method allows to iterate very quickly on all leaving edges, or to choose a given leaving edge with direct access.
This method is implicitly generic and return something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedEdge e = node.getLeavingEdge(i);the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
getLeavingEdge in interface Nodei - Index of the edge.public <T extends Node> Iterator<T> getNeighborNodeIterator()
getEdgeIterator() and stores the
visited nodes in a set. In this way it ensures that each neighbor will be
visited exactly once, even in multi-graph.getNeighborNodeIterator in interface NodeNode.getNeighborNodeIterator()public <T extends Node> Iterator<T> getBreadthFirstIterator()
org.graphstream.graph and returns it.getBreadthFirstIterator in interface NodeNode.getBreadthFirstIterator()public <T extends Node> Iterator<T> getBreadthFirstIterator(boolean directed)
org.graphstream.graph and returns it.getBreadthFirstIterator in interface Nodedirected - If false, the iterator will ignore edge orientation (the
default is "True").Node.getBreadthFirstIterator(boolean)public <T extends Node> Iterator<T> getDepthFirstIterator()
org.graphstream.graph and returns it.getDepthFirstIterator in interface NodeNode.getDepthFirstIterator()public <T extends Node> Iterator<T> getDepthFirstIterator(boolean directed)
org.graphstream.graph and returns it.getDepthFirstIterator in interface Nodedirected - If false, the iterator will ignore edge orientation (the
default is "True").Node.getDepthFirstIterator(boolean)public boolean isEnteringEdge(Edge e)
e - an edgetrue if e is entering edge for this node.public boolean isLeavingEdge(Edge e)
e - an edgetrue if e is leaving edge for this node.public boolean isIncidentEdge(Edge e)
e - an edgetrue if e is incident edge for this node.Copyright © 2015. All rights reserved.