T
- type of the node's lablepublic class DigraphNode<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Collection<DigraphNode<T>> |
children
nodes with edges from/to this node
|
private Digraph<T> |
graph
the graph this node is part of
|
private java.util.Collection<DigraphNode<T>> |
parents
nodes with edges from/to this node
|
private boolean |
uniq
graph can contain several nodes with the same label if uniq == false
|
private T |
value
the node's label
|
Constructor and Description |
---|
DigraphNode(Digraph<T> graph,
T value,
boolean unique) |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(DigraphNode<T> to)
adds an edge from this node to another node
|
boolean |
equals(java.lang.Object obj) |
java.util.Collection<DigraphNode<T>> |
getChildren()
a child is a node n, that has an edge leading from this node to n
|
DigraphNode<T> |
getParent()
a parent is a node n, that has an edge leading from n to this node
|
java.util.Collection<DigraphNode<T>> |
getParents()
a parent is a node n, that has an edge leading from n to this node
|
T |
getValue() |
int |
hashCode() |
int |
inDegree() |
boolean |
isLeaf()
leafs have an outdegree of 0
|
boolean |
isRoot()
roots have an indegree of 0
|
int |
outDegree() |
java.lang.String |
toString() |
private T value
private java.util.Collection<DigraphNode<T>> parents
private java.util.Collection<DigraphNode<T>> children
private boolean uniq
public int inDegree()
public int outDegree()
public T getValue()
public java.util.Collection<DigraphNode<T>> getParents()
public DigraphNode<T> getParent()
public java.util.Collection<DigraphNode<T>> getChildren()
public void addEdge(DigraphNode<T> to)
to
- the node the adge points topublic boolean isRoot()
public boolean isLeaf()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object