diff --git a/pyzx/graph/multigraph.py b/pyzx/graph/multigraph.py index fc7f3861..932ad93f 100644 --- a/pyzx/graph/multigraph.py +++ b/pyzx/graph/multigraph.py @@ -277,6 +277,8 @@ def edges(self, s=None, t=None): for _ in range(e.w_io): yield (v0, v1, EdgeType.W_IO) elif t != None: s, t = (s, t) if s < t else (t, s) + if t not in self.graph[s]: + return e = self.graph[s][t] for _ in range(e.s): yield (s, t, EdgeType.SIMPLE) for _ in range(e.h): yield (s, t, EdgeType.HADAMARD)