From 7eac585c43fd80b8b5fbb6592d8e95cc7cf2248b Mon Sep 17 00:00:00 2001 From: Razin Shaikh Date: Fri, 5 Jul 2024 17:32:21 +0100 Subject: [PATCH] fixing remove id matcher in rules.py --- pyzx/rules.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyzx/rules.py b/pyzx/rules.py index 708a6248..09e2e0a7 100644 --- a/pyzx/rules.py +++ b/pyzx/rules.py @@ -791,9 +791,12 @@ def match_ids_parallel( v = candidates.pop() if phases[v] != 0 or not vertex_is_zx(types[v]) or g.is_ground(v) or g.vertex_degree(v) != 2: continue + if len(g.incident_edges(v)) != 2: continue neigh = g.neighbors(v) - if len(neigh) != 2: continue - v0, v1 = neigh + if len(neigh) == 2: + v0, v1 = neigh + else: + v0, v1 = list(neigh)[0], list(neigh)[0] if (g.is_ground(v0) and types[v1] == VertexType.BOUNDARY or g.is_ground(v1) and types[v0] == VertexType.BOUNDARY): # Do not put ground spiders on the boundary