diff --git a/pyzx/generate.py b/pyzx/generate.py index 54b917ff..349d4a4a 100644 --- a/pyzx/generate.py +++ b/pyzx/generate.py @@ -99,6 +99,7 @@ def spider( set_z_box_label(g, v_in, phase) v_out = v_in else: + assert isinstance(phase, (int, Fraction)) v_in = g.add_vertex(typ, (inputs-1)/2, 1, phase) v_out = v_in inp = [] diff --git a/pyzx/graph/base.py b/pyzx/graph/base.py index a37e4de5..cfd10a91 100644 --- a/pyzx/graph/base.py +++ b/pyzx/graph/base.py @@ -85,6 +85,7 @@ def __init__(self) -> None: self.phase_master: Optional['simplify.Simplifier'] = None self.phase_mult: Dict[int,Literal[1,-1]] = dict() self.max_phase_index: int = -1 + self._vdata: Dict[VT,Dict[str,Any]] = dict() # merge_vdata(v0,v1) is an optional, custom function for merging # vdata of v1 into v0 during spider fusion etc. diff --git a/pyzx/graph/diff.py b/pyzx/graph/diff.py index 9d253b34..511705ea 100644 --- a/pyzx/graph/diff.py +++ b/pyzx/graph/diff.py @@ -32,6 +32,7 @@ class GraphDiff(Generic[VT, ET]): changed_edge_types: Dict[ET, EdgeType.Type] changed_phases: Dict[VT, FractionLike] changed_pos: Dict[VT, Tuple[FloatInt,FloatInt]] + changed_vdata: Dict[VT, Any] def __init__(self, g1: BaseGraph[VT,ET], g2: BaseGraph[VT,ET]) -> None: self.calculate_diff(g1,g2)