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, toString
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
public Graph getGraph()
graph
.getGraph
in interface Node
Node.getGraph()
public abstract int getDegree()
Node
public abstract int getInDegree()
Node
getInDegree
in interface Node
public abstract int getOutDegree()
Node
getOutDegree
in interface Node
public boolean hasEdgeToward(Node node)
hasEdgeToward
in interface Node
node
- The target node.Node.getEdgeToward(org.graphstream.graph.Node)
public boolean hasEdgeToward(int index)
hasEdgeToward
in interface Node
index
- Index of the target node.Node.hasEdgeToward(int)
public boolean hasEdgeToward(String id)
hasEdgeToward
in interface Node
id
- Identifier of the target node.Node.hasEdgeToward(java.lang.String)
public boolean hasEdgeFrom(Node node)
hasEdgeFrom
in interface Node
node
- The source node.Node.hasEdgeFrom(org.graphstream.graph.Node)
public boolean hasEdgeFrom(int index)
hasEdgeFrom
in interface Node
index
- Index of the source node.Node.hasEdgeFrom(int)
public boolean hasEdgeFrom(String id)
hasEdgeFrom
in interface Node
id
- Identifier of the source node.Node.hasEdgeFrom(java.lang.String)
public boolean hasEdgeBetween(Node node)
hasEdgeBetween
in interface Node
node
- Another node.Node.hasEdgeBetween(org.graphstream.graph.Node)
public boolean hasEdgeBetween(int index)
hasEdgeBetween
in interface Node
index
- Index of another node.Node.hasEdgeBetween(int)
public boolean hasEdgeBetween(String id)
hasEdgeBetween
in interface Node
id
- Identifier of another node.Node.hasEdgeBetween(java.lang.String)
public abstract <T extends Edge> T getEdgeToward(Node node)
Node
This 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 Node
node
- The target node.public <T extends Edge> T getEdgeToward(int index)
getEdgeToward(Node)
getEdgeToward
in interface Node
index
- Index of the target node.Node.getEdgeToward(int)
public <T extends Edge> T getEdgeToward(String id)
getEdgeToward(Node)
getEdgeToward
in interface Node
id
- Identifier of the target node.Node.getEdgeToward(java.lang.String)
public abstract <T extends Edge> T getEdgeFrom(Node node)
Node
This 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 Node
node
- The source node.public <T extends Edge> T getEdgeFrom(int index)
getEdgeFrom(Node)
getEdgeFrom
in interface Node
index
- Index of the source node.Node.getEdgeFrom(int)
public <T extends Edge> T getEdgeFrom(String id)
getEdgeFrom(Node)
getEdgeFrom
in interface Node
id
- Identifier of the source node.Node.getEdgeFrom(java.lang.String)
public abstract <T extends Edge> T getEdgeBetween(Node node)
Node
This 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 Node
node
- The opposite node.public <T extends Edge> T getEdgeBetween(int index)
getEdgeBetween(Node)
getEdgeBetween
in interface Node
index
- The index of the opposite node.Node.getEdgeBetween(int)
public <T extends Edge> T getEdgeBetween(String id)
getEdgeBetween(Node)
getEdgeBetween
in interface Node
id
- Identifier of the opposite node.Node.getEdgeBetween(java.lang.String)
public abstract <T extends Edge> Iterator<T> getEdgeIterator()
Node
This 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 Node
public abstract <T extends Edge> Iterator<T> getEnteringEdgeIterator()
Node
This 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 Node
public abstract <T extends Edge> Iterator<T> getLeavingEdgeIterator()
Node
This 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 Node
public <T extends Edge> Iterable<T> getEachEdge()
getEdgeIterator()
getEachEdge
in interface Node
Node.getEachEdge()
public <T extends Edge> Iterable<T> getEachEnteringEdge()
getEnteringEdgeIterator()
getEachEnteringEdge
in interface Node
Node.getEachEnteringEdge()
public <T extends Edge> Iterable<T> getEachLeavingEdge()
getLeavingEdgeIterator()
getEachLeavingEdge
in interface Node
Node.getEachLeavingEdge()
public <T extends Edge> Collection<T> getEdgeSet()
getEdgeIterator()
and
getDegree()
getEdgeSet
in interface Node
Node.getEdgeSet()
public <T extends Edge> Collection<T> getEnteringEdgeSet()
getEnteringEdgeIterator()
and
#geIntDegree()
getEnteringEdgeSet
in interface Node
Node.getEnteringEdgeSet()
public <T extends Edge> Collection<T> getLeavingEdgeSet()
#getLeavingIterator()
and
#geOuttDegree()
getLeavingEdgeSet
in interface Node
Node.getLeavingEdgeSet()
public Iterator<Edge> iterator()
getEdgeIterator()
iterator
in interface Iterable<Edge>
Iterable.iterator()
public abstract <T extends Edge> T getEdge(int i)
Node
However 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)
Node
However 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 Node
i
- Index of the edge.public abstract <T extends Edge> T getLeavingEdge(int i)
Node
However 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 Node
i
- 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 Node
Node.getNeighborNodeIterator()
public <T extends Node> Iterator<T> getBreadthFirstIterator()
org.graphstream.graph
and returns it.getBreadthFirstIterator
in interface Node
Node.getBreadthFirstIterator()
public <T extends Node> Iterator<T> getBreadthFirstIterator(boolean directed)
org.graphstream.graph
and returns it.getBreadthFirstIterator
in interface Node
directed
- 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 Node
Node.getDepthFirstIterator()
public <T extends Node> Iterator<T> getDepthFirstIterator(boolean directed)
org.graphstream.graph
and returns it.getDepthFirstIterator
in interface Node
directed
- 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.