Package flumotion :: Package common :: Module dag :: Class DAG
[show private | hide private]
[frames | no frames]

Class DAG


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.

Method Details

getChildren(self, object, types=None)

Return a list of objects that are direct children of this object.
Returns:
list of object

hasCycle(self)

Returns whether or not the graph has a cycle.

If it has, some operations on it will fail and raise CycleError.

isFloating(self, object)

Returns whether the object is floating: no parents and no children.

sort(self)

Return a topologically sorted list of objects.
Returns:
list of object

_sortPreferred(self, list=None)

Return a topologically sorted list of nodes, using list as a preferred order for the algorithm.
Returns:
list of Node

Generated by Epydoc 2.1 on Tue Dec 20 15:33:11 2005 http://epydoc.sf.net