utils.py
changeset 6854 ffc982faa264
parent 6684 b8bd0ecced2e
child 6931 0af44a38fe41
--- a/utils.py	Wed Jan 19 19:15:04 2011 +0100
+++ b/utils.py	Thu Jan 20 10:06:34 2011 +0100
@@ -112,7 +112,7 @@
 
 # use networkX instead ?
 # http://networkx.lanl.gov/reference/algorithms.traversal.html#module-networkx.algorithms.traversal.astar
-def transitive_closure_of(entity, relname, _seen=None):
+def transitive_closure_of(entity, rtype, _seen=None):
     """return transitive closure *for the subgraph starting from the given
     entity* (eg 'parent' entities are not included in the results)
     """
@@ -120,10 +120,10 @@
         _seen = set()
     _seen.add(entity.eid)
     yield entity
-    for child in getattr(entity, relname):
+    for child in getattr(entity, rtype):
         if child.eid in _seen:
             continue
-        for subchild in transitive_closure_of(child, relname, _seen):
+        for subchild in transitive_closure_of(child, rtype, _seen):
             yield subchild