Skip to content

Commit

Permalink
bug fix augment_collapsed_model
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrupe committed Sep 25, 2024
1 parent c9d96e2 commit 680ce83
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/y0/hierarchical.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,6 @@ def direct_unit_descendents(HCM: pgv.AGraph, subunit_node: pgv.Node) -> set[pgv.
descendents = set()
for nd in next_descendents:
descendents.update(HCM.successors(nd))
# try:
# descendents.add(*HCM.successors(nd))
# except TypeError:
# pass
# descendents = list(descendents)
return duds


Expand Down Expand Up @@ -245,14 +240,14 @@ def augment_collapsed_model(
if not mechanism <= collapsed.nodes():
raise ValueError("The input mechanism must be contained in the collapsed model.")
aug = augmentation_variable
augmented.add_node(aug)
augmented.add_node(aug)
for var in mechanism:
augmented.add_directed_edge(var, aug)
for var in set(augmented.nodes()) - {aug}:
parents = set(augmented.directed.predecessors(var))
if mechanism <= parents:
augmented.add_directed_edge(aug, var)
for parent in parents:
for parent in mechanism:
augmented.directed.remove_edge(parent, var)
return augmented

Expand Down

0 comments on commit 680ce83

Please sign in to comment.