static class Graphs.SynchronizedNode extends Graphs.SynchronizedElement<Node> implements Node
Modifier and Type | Field and Description |
---|---|
private ReentrantLock |
elementLock |
private Graphs.SynchronizedGraph |
sg |
wrappedElement
Constructor and Description |
---|
SynchronizedNode(Graphs.SynchronizedGraph sg,
Node n) |
Modifier and Type | Method and Description |
---|---|
Iterator<Node> |
getBreadthFirstIterator()
Iterator for breadth first exploration of the graph, starting at this
node.
|
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.
|
Iterator<Node> |
getDepthFirstIterator()
Iterator for depth first exploration of the graph, starting at this node.
|
Iterator<Node> |
getDepthFirstIterator(boolean directed)
Iterator for depth first exploration of the graph, starting at this node.
|
Iterable<Edge> |
getEachEdge()
Set of all entering and leaving edges.
|
Iterable<Edge> |
getEachEnteringEdge()
Set of all entering edges.
|
Iterable<Edge> |
getEachLeavingEdge()
Set of all leaving edges.
|
<T extends Edge> |
getEdge(int i)
I-th edge.
|
<T extends Edge> |
getEdgeBetween(int index)
Retrieves an edge between this node and the node with index i if one
exists.
|
<T extends Edge> |
getEdgeBetween(Node n)
Retrieves an edge between this node and and another node if one exists.
|
<T extends Edge> |
getEdgeBetween(String id)
Retrieve an edge between this node and the node 'id', if it exits.
|
<T extends Edge> |
getEdgeFrom(int index)
Retrieves an edge that leaves node with given index toward this node.
|
<T extends Edge> |
getEdgeFrom(Node n)
Retrieves an edge that leaves given node toward this node.
|
<T extends Edge> |
getEdgeFrom(String id)
Retrieve an edge that leaves node 'id' toward this node.
|
Iterator<Edge> |
getEdgeIterator()
Iterator on the set of connected edges.
|
Collection<Edge> |
getEdgeSet()
Set of all entering and leaving edges.
|
<T extends Edge> |
getEdgeToward(int index)
Retrieves an edge that leaves this node toward the node with given index.
|
<T extends Edge> |
getEdgeToward(Node n)
Retrieves an edge that leaves this node toward another node.
|
<T extends Edge> |
getEdgeToward(String id)
Retrieve an edge that leaves this node toward 'id'.
|
<T extends Edge> |
getEnteringEdge(int i)
I-th entering edge.
|
Iterator<Edge> |
getEnteringEdgeIterator()
Iterator only on leaving edges.
|
Collection<Edge> |
getEnteringEdgeSet()
Set of all entering edges.
|
Graph |
getGraph()
Parent graph.
|
int |
getInDegree()
Number of entering edges.
|
<T extends Edge> |
getLeavingEdge(int i)
I-th leaving edge.
|
Iterator<Edge> |
getLeavingEdgeIterator()
Iterator only on entering edges.
|
Collection<Edge> |
getLeavingEdgeSet()
Set of all leaving edges.
|
Iterator<Node> |
getNeighborNodeIterator()
Iterator on the set of neighbor nodes connected to this node via one or
more edges.
|
int |
getOutDegree()
Number of leaving edges.
|
boolean |
hasEdgeBetween(int index)
True if an edge exists between this node and a node with given index.
|
boolean |
hasEdgeBetween(Node node)
True if an edge exists between this node and another node.
|
boolean |
hasEdgeBetween(String id)
True if an edge exists between this node and node 'id'.
|
boolean |
hasEdgeFrom(int index)
True if an edge enters this node from a node with given index.
|
boolean |
hasEdgeFrom(Node node)
True if an edge enters this node from a given node.
|
boolean |
hasEdgeFrom(String id)
True if an edge enters this node from node 'id'.
|
boolean |
hasEdgeToward(int index)
True if an edge leaves this node toward a node with given index.
|
boolean |
hasEdgeToward(Node node)
True if an edge leaves this node toward a given node.
|
boolean |
hasEdgeToward(String id)
True if an edge leaves this node toward node 'id'.
|
Iterator<Edge> |
iterator() |
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
clone, equals, finalize, 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
forEach, spliterator
private final Graphs.SynchronizedGraph sg
private final ReentrantLock elementLock
SynchronizedNode(Graphs.SynchronizedGraph sg, Node n)
public Iterator<Node> getBreadthFirstIterator()
Node
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>.
getBreadthFirstIterator
in interface Node
public Iterator<Node> getBreadthFirstIterator(boolean directed)
Node
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>.
getBreadthFirstIterator
in interface Node
directed
- If false, the iterator will ignore edge orientation (the
default is "True").public int getDegree()
Node
public Iterator<Node> getDepthFirstIterator()
Node
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>.
getDepthFirstIterator
in interface Node
public Iterator<Node> getDepthFirstIterator(boolean directed)
Node
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>.
getDepthFirstIterator
in interface Node
directed
- If false, the iterator will ignore edge orientation (the
default is "True").public Iterable<Edge> getEachEdge()
Node
This method is implicitly generic and return an Iterable over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterable<ExtendedEdge> ite = node.getEdgeSet();the method will return an Iterable<ExtendedEdge>. If no left part exists, method will just return an Iterable<Edge>.
getEachEdge
in interface Node
public Iterable<Edge> getEachEnteringEdge()
Node
This method is implicitly generic and return an Iterable over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterable<ExtendedEdge> ite = node.getEnteringEdgeSet();the method will return an Iterable<ExtendedEdge>. If no left part exists, method will just return an Iterable<Edge>.
getEachEnteringEdge
in interface Node
public Iterable<Edge> getEachLeavingEdge()
Node
This method is implicitly generic and return an Iterable over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterable<ExtendedEdge> ite = node.getLeavingEdgeSet();the method will return an Iterable<ExtendedEdge>. If no left part exists, method will just return an Iterable<Edge>.
getEachLeavingEdge
in interface Node
public <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 <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 <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 Edge> T getEdgeBetween(String id)
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
id
- Identifier of the opposite node.public <T extends Edge> T getEdgeBetween(Node n)
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
n
- The opposite node.public <T extends Edge> T getEdgeBetween(int index)
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
index
- The index of the opposite node.public <T extends Edge> T getEdgeFrom(String id)
Node
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.
getEdgeFrom
in interface Node
id
- Identifier of the source node.public <T extends Edge> T getEdgeFrom(Node n)
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
n
- The source node.public <T extends Edge> T getEdgeFrom(int index)
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
index
- Index of the source node.public Iterator<Edge> 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 Collection<Edge> getEdgeSet()
Node
This method is implicitly generic and return an Iterable over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterable<ExtendedEdge> ite = node.getEdgeSet();the method will return an Iterable<ExtendedEdge>. If no left part exists, method will just return an Iterable<Edge>.
getEdgeSet
in interface Node
public <T extends Edge> T getEdgeToward(String id)
Node
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.
getEdgeToward
in interface Node
id
- Identifier of the target node.public <T extends Edge> T getEdgeToward(Node n)
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
n
- The target node.public <T extends Edge> T getEdgeToward(int index)
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
index
- Index of the target node.public Iterator<Edge> 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 Collection<Edge> getEnteringEdgeSet()
Node
This method is implicitly generic and return an Iterable over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterable<ExtendedEdge> ite = node.getEnteringEdgeSet();the method will return an Iterable<ExtendedEdge>. If no left part exists, method will just return an Iterable<Edge>.
getEnteringEdgeSet
in interface Node
public Graph getGraph()
Node
public int getInDegree()
Node
getInDegree
in interface Node
public Iterator<Edge> 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 Collection<Edge> getLeavingEdgeSet()
Node
This method is implicitly generic and return an Iterable over something which extends Edge. The return type is the one of the left part of the assignment. For example, in the following call :
Iterable<ExtendedEdge> ite = node.getLeavingEdgeSet();the method will return an Iterable<ExtendedEdge>. If no left part exists, method will just return an Iterable<Edge>.
getLeavingEdgeSet
in interface Node
public Iterator<Node> getNeighborNodeIterator()
Node
getNeighborNodeIterator
in interface Node
public int getOutDegree()
Node
getOutDegree
in interface Node
public boolean hasEdgeBetween(String id)
Node
hasEdgeBetween
in interface Node
id
- Identifier of another node.public boolean hasEdgeBetween(Node node)
Node
hasEdgeBetween
in interface Node
node
- Another node.public boolean hasEdgeBetween(int index)
Node
hasEdgeBetween
in interface Node
index
- Index of another node.public boolean hasEdgeFrom(String id)
Node
hasEdgeFrom
in interface Node
id
- Identifier of the source node.public boolean hasEdgeFrom(Node node)
Node
hasEdgeFrom
in interface Node
node
- The source node.public boolean hasEdgeFrom(int index)
Node
hasEdgeFrom
in interface Node
index
- Index of the source node.public boolean hasEdgeToward(String id)
Node
hasEdgeToward
in interface Node
id
- Identifier of the target node.public boolean hasEdgeToward(Node node)
Node
hasEdgeToward
in interface Node
node
- The target node.public boolean hasEdgeToward(int index)
Node
hasEdgeToward
in interface Node
index
- Index of the target node.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses