public class DirectedGraphNode<K,V> extends AbstractGraphNode<K,V> implements Comparable<DirectedGraphNode<K,V>>
Modifier and Type | Field and Description |
---|---|
protected Set<K> |
children |
protected Set<K> |
parents |
protected int |
topoSortOrder |
item, key, visited
Constructor and Description |
---|
DirectedGraphNode(K key,
V value,
DirectedGraph<K,V> graph) |
Modifier and Type | Method and Description |
---|---|
void |
addChild(K newChildKey) |
void |
addParent(K newParentKey) |
DirectedGraphNode<K,V> |
clone()
Makes a copy of this node.
|
int |
compareTo(DirectedGraphNode<K,V> o)
Uses the topological sort order.
|
Set<DirectedGraphNode<K,V>> |
getAllChildNodes()
Get all the children of this node, recursively.
|
Set<DirectedGraphNode<K,V>> |
getAllParentNodes()
Get all the parents of this node, recursively.
|
int |
getChildCount() |
DirectedGraph<K,V> |
getChildGraph()
Get the subgraph starting from this node, including this node.
|
Set<K> |
getChildKeys() |
Set<DirectedGraphNode<K,V>> |
getChildNodes()
Get the immediate children of this node.
|
DirectedGraph<K,V> |
getGraph() |
Set<K> |
getParentKeys() |
Set<DirectedGraphNode<K,V>> |
getParentNodes()
Get the immediate parents of this node.
|
int |
getTopoSortOrder() |
boolean |
hasChild(Object j)
Check to see if this node has a particular immediate child.
|
boolean |
hasParent(Object j)
Check to see if this node has a particular immediate parent.
|
int |
inDegree() |
boolean |
isLeaf() |
int |
numParents() |
int |
outDegree() |
void |
prune()
Remove connections that are to nodes not contained in this graph
|
void |
setGraph(DirectedGraph<K,V> graph) |
void |
setTopoSortOrder(int i) |
String |
toString() |
public DirectedGraphNode(K key, V value, DirectedGraph<K,V> graph)
key
- Objectvalue
- Objectgraph
- Graphpublic void addChild(K newChildKey)
newChildKey
- Objectpublic void addParent(K newParentKey)
newParentKey
- Objectpublic DirectedGraphNode<K,V> clone()
public int compareTo(DirectedGraphNode<K,V> o)
compareTo
in interface Comparable<DirectedGraphNode<K,V>>
o
- Objectpublic Set<DirectedGraphNode<K,V>> getAllChildNodes()
public Set<DirectedGraphNode<K,V>> getAllParentNodes()
public int getChildCount()
public DirectedGraph<K,V> getChildGraph()
public Set<DirectedGraphNode<K,V>> getChildNodes()
public DirectedGraph<K,V> getGraph()
public Set<DirectedGraphNode<K,V>> getParentNodes()
public int getTopoSortOrder()
public boolean hasChild(Object j)
j
- Objectpublic boolean hasParent(Object j)
j
- Objectpublic int inDegree()
public boolean isLeaf()
public int numParents()
public int outDegree()
public void prune()
public void setGraph(DirectedGraph<K,V> graph)
public void setTopoSortOrder(int i)
i
- intpublic String toString()
toString
in class AbstractGraphNode<K,V>
Copyright © 2003–2023 UBC Michael Smith Laboratories. All rights reserved.