Skip to content

Commit 559b41d

Browse files
authored
Merge pull request #336 from lara-madison/issue/334
Fix #334: color_change_diagram fixed
2 parents 810ca2b + ec389f7 commit 559b41d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pyzx/basicrules.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,10 @@ def color_change_diagram(g: BaseGraph[VT,ET]):
6161
for e in g.incident_edges(v):
6262
g.set_edge_type(e, toggle_edge(g.edge_type(e)))
6363
elif check_color_change(g, v):
64-
color_change(g, v)
64+
g.set_type(v, toggle_vertex(g.type(v)))
6565

6666
def check_color_change(g: BaseGraph[VT,ET], v: VT) -> bool:
67-
if not (g.type(v) == VertexType.Z or g.type(v) == VertexType.X):
68-
return False
69-
else:
70-
return True
67+
return (g.type(v) == VertexType.Z or g.type(v) == VertexType.X)
7168

7269
def color_change(g: BaseGraph[VT,ET], v: VT) -> bool:
7370
if not (g.type(v) == VertexType.Z or g.type(v) == VertexType.X):

0 commit comments

Comments
 (0)