Skip to content

Commit

Permalink
Merge pull request #265 from RazinShaikh/check_fuse_w_connected_fix
Browse files Browse the repository at this point in the history
check_fuse_w: check if the vertices are connected before asking for its edge type
  • Loading branch information
jvdwetering authored Aug 6, 2024
2 parents ffff4f8 + aefaf54 commit 3fcd05b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyzx/basicrules.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def check_fuse_w(g: BaseGraph[VT,ET], v1: VT, v2: VT) -> bool:
if vertex_is_w(g.type(v1)) and vertex_is_w(g.type(v2)):
v1_in, v1_out = get_w_io(g, v1)
v2_in, v2_out = get_w_io(g, v2)
if g.edge_type(g.edge(v1_in, v2_out)) == EdgeType.SIMPLE or \
g.edge_type(g.edge(v2_in, v1_out)) == EdgeType.SIMPLE:
if (g.connected(v1_in, v2_out) and g.edge_type(g.edge(v1_in, v2_out)) == EdgeType.SIMPLE) or \
(g.connected(v2_in, v1_out) and g.edge_type(g.edge(v2_in, v1_out)) == EdgeType.SIMPLE):
return True
return False

Expand Down

0 comments on commit 3fcd05b

Please sign in to comment.