public class DigraphNode
extends java.lang.Object
Constructor and Description |
---|
DigraphNode()
Initializes a new DigraphNode with a default estimated
number of in-edges and of out-edges per node.
|
DigraphNode(int edgesPerNode)
Initializes a new DigraphNode with an estimated number of
in-edges and of out-edges per node.
|
Modifier and Type | Method and Description |
---|---|
DigraphEdge |
addInEdge(DigraphEdge aDigraphEdge)
Adds given DigraphEdge to the list of inEdges, after
checking that the DigraphEdge is connected TO the receiver.
|
DigraphEdge |
addOutEdge(DigraphEdge aDigraphEdge)
Adds given DigraphEdge to the list of outEdges, after
checking that the DigraphEdge is connected FROM the receiver.
|
java.util.ArrayList<DigraphNode> |
ancestors()
Returns an ArrayList of all DigraphNodes from which the receiver
can be reached by traversal of one or more edges out.
|
java.util.HashSet<DigraphNode> |
ancestors(java.util.HashSet<DigraphNode> aSet)
Adds to the HashSet aSet all DigraphNodes that are NOT already
in aSet but from which the receiver is reachable by traversal of
one or more edges out.
|
java.util.ArrayList<DigraphNode> |
connectedNodes()
Returns an ArrayList of all DigraphNodes from which the receiver
can be reached by traversal of one or more edges out without regard
to direction.
|
java.util.HashSet<DigraphNode> |
connectedNodes(java.util.HashSet<DigraphNode> aSet)
Adds to the HashSet aSet all DigraphNodes that are NOT already
in aSet but from which the receiver is reachable by traversal of
one or more edges without regard to edge direction.
|
java.util.ArrayList<DigraphNode> |
descendants()
Returns an ArrayList of all DigraphNodes that are reachable
from the receiver by traversal of one or more edges out.
|
java.util.HashSet<DigraphNode> |
descendants(java.util.HashSet<DigraphNode> aSet)
Adds to the HashSet aSet all DigraphNodes that are NOT already
in aSet but are reachable from the receiver by traversal of
one or more edges out.
|
java.util.ArrayList<DigraphEdge> |
getInEdges()
Returns an ArrayList of the DigraphEdges that enter the DigraphNode.
|
java.util.ArrayList<DigraphEdge> |
getOutEdges()
Returns an ArrayList of the DigraphEdges that leave the DigraphNode.
|
int |
inDegree()
Returns the number of DigraphEdges that enter the DigraphNode.
|
java.util.ArrayList<DigraphNode> |
neighboursIn()
Returns an ArrayList of the DigraphNodes at the beginnings of
all incoming edges.
|
java.util.ArrayList<DigraphNode> |
neighboursOut()
Returns an ArrayList of the DigraphNodes at the ends of all
outgoing edges.
|
int |
outDegree()
Returns the number of DigraphEdges that leave the DigraphNode.
|
DigraphEdge |
removeInEdge(DigraphEdge aDigraphEdge)
Removes given DigraphEdge from the list of inEdges, after
checking that the DigraphEdge is connected TO the receiver.
|
DigraphEdge |
removeOutEdge(DigraphEdge aDigraphEdge)
Removes given DigraphEdge from the list of outEdges, after
checking that the DigraphEdge is connected FROM the receiver.
|
public DigraphNode()
public DigraphNode(int edgesPerNode)
public DigraphEdge addInEdge(DigraphEdge aDigraphEdge)
aDigraphEdge
- the DigraphEdge to be added to the node.public DigraphEdge addOutEdge(DigraphEdge aDigraphEdge)
aDigraphEdge
- the DigraphEdge to be added to the node.public java.util.ArrayList<DigraphNode> ancestors()
public java.util.HashSet<DigraphNode> ancestors(java.util.HashSet<DigraphNode> aSet)
aSet
- a HashSet of DigraphNodes.public java.util.ArrayList<DigraphNode> connectedNodes()
public java.util.HashSet<DigraphNode> connectedNodes(java.util.HashSet<DigraphNode> aSet)
aSet
- a HashSet of DigraphNodes.public java.util.ArrayList<DigraphNode> descendants()
public java.util.HashSet<DigraphNode> descendants(java.util.HashSet<DigraphNode> aSet)
aSet
- a HashSet of DigraphNodes.public java.util.ArrayList<DigraphEdge> getInEdges()
public java.util.ArrayList<DigraphEdge> getOutEdges()
public int inDegree()
public java.util.ArrayList<DigraphNode> neighboursIn()
public java.util.ArrayList<DigraphNode> neighboursOut()
public int outDegree()
public DigraphEdge removeInEdge(DigraphEdge aDigraphEdge)
aDigraphEdge
- the DigraphEdge to be removed from the node.public DigraphEdge removeOutEdge(DigraphEdge aDigraphEdge)
aDigraphEdge
- the DigraphEdge to be removed from the node.