didn't you have to use `copy.deepcopy(graph)` to avoid failures?