Skip to content

Commit

Permalink
return an empty generator when there are no edges between source and …
Browse files Browse the repository at this point in the history
…target
  • Loading branch information
RazinShaikh committed Jul 10, 2024
1 parent 1e1a5b1 commit 2d82f17
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyzx/graph/multigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ 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
yield
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)
Expand Down

0 comments on commit 2d82f17

Please sign in to comment.