I represent a Direct Acyclic Graph.
You can add objects to me as Nodes and then express dependency by
adding edges.
| Method Summary |
| |
__init__(self)
|
| |
addEdge(self,
parent,
child)
|
| |
addNode(self,
object,
type)
|
| |
getAncestors(self,
object)
|
| list of object
|
getChildren(self,
object,
types)
Return a list of objects that are direct children of this object. |
| |
getOffspring(self,
object,
*types)
|
| |
getParents(self,
object,
types)
|
| |
hasCycle(self)
Returns whether or not the graph has a cycle. |
| |
hasObject(self,
object)
|
| |
isFloating(self,
object)
Returns whether the object is floating: no parents and no
children. |
| |
removeEdge(self,
parent,
child)
|
| |
removeNode(self,
object)
|
| list of object
|
sort(self)
Return a topologically sorted list of objects. |
| |
_assertExists(self,
object)
|
| |
_dfs(self,
node)
|
list of Node
|
_sortPreferred(self,
list)
Return a topologically sorted list of nodes, using list as a preferred
order for the algorithm. |