public interface Node extends Element, java.lang.Iterable<Edge>
Implementing classes should indicate the complexity of their implementation for each method.
Modifier and Type | Method and Description |
---|---|
java.util.stream.Stream<Edge> |
edges()
Stream over all entering and leaving edges.
|
default java.util.stream.Stream<Edge> |
enteringEdges()
Stream over all entering edges.
|
java.util.Iterator<Node> |
getBreadthFirstIterator()
Iterator for breadth first exploration of the graph, starting at this node.
|
java.util.Iterator<Node> |
getBreadthFirstIterator(boolean directed)
Iterator for breadth first exploration of the graph, starting at this node.
|
int |
getDegree()
Total number of relations with other nodes or this node.
|
java.util.Iterator<Node> |
getDepthFirstIterator()
Iterator for depth first exploration of the graph, starting at this node.
|
java.util.Iterator<Node> |
getDepthFirstIterator(boolean directed)
Iterator for depth first exploration of the graph, starting at this node.
|
Edge |
getEdge(int i)
I-th edge.
|
Edge |
getEdgeBetween(int index)
Retrieves an edge between this node and the node with index i if one exists.
|
Edge |
getEdgeBetween(Node node)
Retrieves an edge between this node and and another node if one exists.
|
Edge |
getEdgeBetween(java.lang.String id)
Retrieve an edge between this node and the node 'id', if it exits.
|
Edge |
getEdgeFrom(int index)
Retrieves an edge that leaves node with given index toward this node.
|
Edge |
getEdgeFrom(Node node)
Retrieves an edge that leaves given node toward this node.
|
Edge |
getEdgeFrom(java.lang.String id)
Retrieve an edge that leaves node 'id' toward this node.
|
Edge |
getEdgeToward(int index)
Retrieves an edge that leaves this node toward the node with given index.
|
Edge |
getEdgeToward(Node node)
Retrieves an edge that leaves this node toward another node.
|
Edge |
getEdgeToward(java.lang.String id)
Retrieve an edge that leaves this node toward 'id'.
|
Edge |
getEnteringEdge(int i)
I-th entering edge.
|
Graph |
getGraph()
Parent graph.
|
int |
getInDegree()
Number of entering edges.
|
Edge |
getLeavingEdge(int i)
I-th leaving edge.
|
int |
getOutDegree()
Number of leaving edges.
|
default boolean |
hasEdgeBetween(int index)
True if an edge exists between this node and a node with given index.
|
default boolean |
hasEdgeBetween(Node node)
True if an edge exists between this node and another node.
|
default boolean |
hasEdgeBetween(java.lang.String id)
True if an edge exists between this node and node 'id'.
|
default boolean |
hasEdgeFrom(int index)
True if an edge enters this node from a node with given index.
|
default boolean |
hasEdgeFrom(Node node)
True if an edge enters this node from a given node.
|
default boolean |
hasEdgeFrom(java.lang.String id)
True if an edge enters this node from node 'id'.
|
default boolean |
hasEdgeToward(int index)
True if an edge leaves this node toward a node with given index.
|
default boolean |
hasEdgeToward(Node node)
True if an edge leaves this node toward a given node.
|
default boolean |
hasEdgeToward(java.lang.String id)
True if an edge leaves this node toward node 'id'.
|
default java.util.Iterator<Edge> |
iterator() |
default java.util.stream.Stream<Edge> |
leavingEdges()
Stream over all leaving edges.
|
default java.util.stream.Stream<Node> |
neighborNodes()
Stream over neighbor nodes connected to this node via one or more edges.
|
java.lang.String |
toString()
Override the Object.toString() method.
|
attributeKeys, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, getLabel, getMap, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasLabel, hasMap, hasNumber, hasVector, removeAttribute, setAttribute, setAttributes
Graph getGraph()
int getDegree()
int getOutDegree()
int getInDegree()
Edge getEdgeToward(java.lang.String id)
This method selects only edges leaving this node an pointing at node 'id' (this also selects undirected edges).
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.getEdgeToward("...");the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
id
- Identifier of the target node.Edge getEdgeFrom(java.lang.String id)
This method selects only edges leaving node 'id' an pointing at this node (this also selects undirected edges).
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.getEdgeFrom("...");the method will return an ExtendedEdge. If no left part exists, method will just return an Edge.
id
- Identifier of the source node.Edge getEdgeBetween(java.lang.String id)
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.
id
- Identifier of the opposite node.default java.util.stream.Stream<Node> neighborNodes()
Edge getEdge(int i)
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.
i
- Index of the edge.java.lang.IndexOutOfBoundsException
- if i
is negative or greater than or equal to the
degreeEdge getEnteringEdge(int i)
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.
i
- Index of the edge.java.lang.IndexOutOfBoundsException
- if i
is negative or greater than or equal to the
in-degreeEdge getLeavingEdge(int i)
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.
i
- Index of the edge.IndexOutOfBoundException
- if i
is negative or greater than or equal to the
out-degreejava.util.Iterator<Node> getBreadthFirstIterator()
If the graph is not connected, only a part of it will be explored. By default, this iterator will respect edge orientation.
This method is implicitly generic and return an Iterator over something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
Iterator<ExtendedNode> ite = node.getBreadthFirstIterator();the method will return an Iterator<ExtendedNode>. If no left part exists, method will just return an Iterator<Node>.
java.util.Iterator<Node> getBreadthFirstIterator(boolean directed)
If the graph is not connected, only a part of it will be explored.
This method is implicitly generic and return an Iterator over something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
Iterator<ExtendedNode> ite = node.getBreadthFirstIterator(true);the method will return an Iterator<ExtendedNode>. If no left part exists, method will just return an Iterator<Node>.
directed
- If false, the iterator will ignore edge orientation (the default
is "True").java.util.Iterator<Node> getDepthFirstIterator()
If the graph is not connected, only a part of it will be explored. By default, this iterator will respect edge orientation.
This method is implicitly generic and return an Iterator over something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
Iterator<ExtendedNode> ite = node.getDepthFirstIterator();the method will return an Iterator<ExtendedNode>. If no left part exists, method will just return an Iterator<Node>.
java.util.Iterator<Node> getDepthFirstIterator(boolean directed)
If the graph is not connected, only a part of it will be explored.
This method is implicitly generic and return an Iterator over something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
Iterator<ExtendedNode> ite = node.getDepthFirstIterator(true);the method will return an Iterator<ExtendedNode>. If no left part exists, method will just return an Iterator<Node>.
directed
- If false, the iterator will ignore edge orientation (the default
is "True").java.util.stream.Stream<Edge> edges()
default java.util.stream.Stream<Edge> leavingEdges()
default java.util.stream.Stream<Edge> enteringEdges()
default java.util.Iterator<Edge> iterator()
iterator
in interface java.lang.Iterable<Edge>
java.lang.String toString()
toString
in class java.lang.Object
default boolean hasEdgeToward(java.lang.String id)
id
- Identifier of the target node.default boolean hasEdgeToward(Node node)
node
- The target node.default boolean hasEdgeToward(int index) throws java.lang.IndexOutOfBoundsException
index
- Index of the target node.java.lang.IndexOutOfBoundsException
- if the index is negative or greater than getNodeCount() - 1
.default boolean hasEdgeFrom(java.lang.String id)
id
- Identifier of the source node.default boolean hasEdgeFrom(Node node)
node
- The source node.default boolean hasEdgeFrom(int index) throws java.lang.IndexOutOfBoundsException
index
- Index of the source node.java.lang.IndexOutOfBoundsException
- if the index is negative or greater than getNodeCount() - 1
.default boolean hasEdgeBetween(java.lang.String id)
id
- Identifier of another node.default boolean hasEdgeBetween(Node node)
node
- Another node.default boolean hasEdgeBetween(int index) throws java.lang.IndexOutOfBoundsException
index
- Index of another node.java.lang.IndexOutOfBoundsException
- if the index is negative or greater than getNodeCount() - 1
.Edge getEdgeToward(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.
node
- The target node.Edge getEdgeToward(int index) throws java.lang.IndexOutOfBoundsException
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.
index
- Index of the target node.java.lang.IndexOutOfBoundsException
- if the index is negative or greater than getNodeCount() - 1
.Edge getEdgeFrom(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.
node
- The source node.Edge getEdgeFrom(int index) throws java.lang.IndexOutOfBoundsException
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.
index
- Index of the source node.java.lang.IndexOutOfBoundsException
- if the index is negative or greater than getNodeCount() - 1
.Edge getEdgeBetween(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.
node
- The opposite node.Edge getEdgeBetween(int index) throws java.lang.IndexOutOfBoundsException
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.
index
- The index of the opposite node.java.lang.IndexOutOfBoundsException
- if the index is negative or greater than getNodeCount() - 1
.