Skip to content

Commit

Permalink
Update node ordering of child graph when making a copy (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmckinsey1 authored Mar 9, 2024
1 parent a7e0eb4 commit ad0341d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions hatchet/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def copy(self, old_to_new=None):
new.children.append(old_to_new[old_child])

graph = Graph([old_to_new[r] for r in self.roots])
graph.node_ordering = self.node_ordering
graph.enumerate_traverse()

return graph
Expand Down
5 changes: 4 additions & 1 deletion hatchet/tests/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def test_copy():
diamond_subdag = Node.from_lists(("a", ("b", d), ("c", d)))
g = Graph.from_lists(("e", "f", diamond_subdag), ("g", diamond_subdag, "h"))

assert g.copy() == g
gc = g.copy()

assert gc == g
assert gc.node_ordering == g.node_ordering


def test_union_dag():
Expand Down

0 comments on commit ad0341d

Please sign in to comment.