From 9dacf64cb2bf4077fe0622e5c6888d2b0d5e974f Mon Sep 17 00:00:00 2001 From: Razin Shaikh Date: Fri, 12 Jul 2024 18:28:37 +0100 Subject: [PATCH] fixing bialgebra scalar --- pyzx/editor_actions.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pyzx/editor_actions.py b/pyzx/editor_actions.py index 38c280fe..00ed13ff 100644 --- a/pyzx/editor_actions.py +++ b/pyzx/editor_actions.py @@ -291,12 +291,11 @@ def bialgebra(g: BaseGraph[VT,ET], etab[upair(n1,n2)] = [0, 0] etab[upair(n1,n2)][0] += 1 - if g.type(v2) == VertexType.Z: - t = VertexType.X + if g.type(v1) == VertexType.H_BOX or g.type(v2) == VertexType.H_BOX: # x-h bialgebra + x_vertex = v1 if g.type(v2) == VertexType.H_BOX else v2 + g.scalar.add_power(g.vertex_degree(x_vertex)-2) + else: # z-x bialgebra g.scalar.add_power((g.vertex_degree(v1)-2)*(g.vertex_degree(v2)-2)) - else: #g.type(w) == VertexType.H_BOX - t = VertexType.Z - g.scalar.add_power(g.vertex_degree(v1)-2) return (etab, rem_verts, [], False)