Skip to content

Commit

Permalink
Merge pull request #253 from RazinShaikh/get-w-partner-fix
Browse files Browse the repository at this point in the history
fix get_w_partner util function for multigraph
  • Loading branch information
jvdwetering authored Jul 10, 2024
2 parents 716c3e9 + 6126178 commit 1e1a5b1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyzx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ def vertex_is_w(ty: VertexType) -> bool:

def get_w_partner(g, v):
assert vertex_is_w(g.type(v))
for u in g.neighbors(v):
if g.edge_type((u, v)) == EdgeType.W_IO:
for edge in g.incident_edges(v):
if g.edge_type(edge) == EdgeType.W_IO:
u = edge[0] if edge[1] == v else edge[1]
assert vertex_is_w(g.type(u))
return u
assert False
Expand Down

0 comments on commit 1e1a5b1

Please sign in to comment.