1. Benoit Boissinot
  2. dag-discovery

Commits

Peter Arrenbrecht  committed 0fa6f4f

pass stops to headsof to speed up on intermediate unknown regions

  • Participants
  • Parent commits ad1da54
  • Branches default

Comments (0)

Files changed (2)

File src/dagutil.py

View file
  • Ignore whitespace
         '''return set of nodes from heads to stops (or root)'''
         return set(self.walk(heads, stops))
 
-    def headsof(self, nodes):
+    def headsof(self, nodes, stops=None):
         '''return subset of nodes where no node has a descendant in nodes'''
         hds = set(nodes)
         if not hds:
             if n in hds:
                 p = self.parents(n)
                 if p:
-                    hds.difference_update(self.nodeset(heads=p))
+                    hds.difference_update(self.nodeset(heads=p, stops=stops))
         assert hds
         return hds
 

File src/discovery_tonfa.py

View file
  • Ignore whitespace
 def clever_sample(dag, nodes, stop):
     if len(nodes) < 200:
         return set(nodes)
-    heads = dag.headsof(nodes)
+    heads = dag.headsof(nodes, stop)
     sample = set()
 
     dist = {}