Skip to content

Commit

Permalink
Merge pull request zxcalc#254 from RazinShaikh/master
Browse files Browse the repository at this point in the history
return an empty generator when there are no edges between source and target
  • Loading branch information
jvdwetering authored Jul 15, 2024
2 parents 1e1a5b1 + e1f3d26 commit 9a451a3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyzx/graph/multigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9a451a3

Please sign in to comment.