Search for a command to run...
PyZX 0.10.0 - 2026-03-12 The big change in this version is that the structure of the rewrite rules has been completely refactored. This shouldn't change anything for most users that just want to use the built-in simplification routines, but it might change how you use single rule calls. In particular, the simplification routines in simplify, like spider_simp are now no longer functions, but instances of the Rewrite class. This exposes a way to match, rewrite and automatically simplify with this rewrite rule. If you call it like a function as before, then it will have the same behaviour as the original simplification routine based on that rewrite rule. Other changes include much better support for rewriting diagrams that involve symbolic (Clifford) phases; parsing qasm circuits that include measurements (and loading them in symbolic phases); representing CSS codes and Pauli webs; and many bug fixes that improve the reliability of Multigraph, transforming graphs to json and calculating the tensor of diagrams. Added Improved support for circuits and qasm files involving ancilla preparations and measurements. In particular, a measurement outcome can now be represented by a symbolic variable. This includes support for openQASM reset and measure operations. Implemented by @dlyongemallo and @Zhaoyilunnn. Better support for doing rewrites involving symbolic phases. In particular, symbolic Clifford phases can now be used in graph-theoretic rewrites like local complementation and pivoting. Implemented by @RazinShaikh. Can now calculate all Pauliwebs in arbitrary Clifford diagrams (see demos/PauliWebs on Clifford circuits with measurements.ipynb). Implemented by @maximilianruesch. New css.py file with some utilities for working with CSS codes. In particular, generate_css_encoder_graph which generates a normal form diagram from a set of stabilizer generators. Implemented by @tinghui2012. Some big improvements to documentation. Functionality regarding routing, using symbolic variables and using a genetic coding heuristic for rewriting are now properly documented. In addition you can check out the rules.ipynb notebook in the docs for a full overview of all the rewrites in PyZX. New auto_layout option in zx.draw for graphs that don't have their own position information set. Implemented by @akissinger. New graphical Fourier transform function to go between phase gadgets and H-boxes in fourier.py. Implemented by @akissinger. Functions for Graph.load and Graph.save to load and directly from files (by @dlyongemallo). Several new H-box rewrite rules (by @dlyongemallo). Support for fault-equivalent rewrites (by @lunarr-eclipse and @boldar99) Changed Refactor of the structure of all the rewrites. Rewrites are now built out of a matcher and applier function grouped together in an Rewrite instance. The rewrites are all in the submodule rewrite_rules, with their Rewrite instances still part of simplify.py and hsimplify.py. The user-facing API is left intact as much as possible, so this should not affect users who have only used the top-level rewrite functions like full_reduce. Implemented by @lara-madison. full_reduce now also calls copy_simp and supplementarity_simp so that it indeed does all the rewrites that would simplify a graph. It now throws an exception when the diagram contains an H-box so to not get unexpected behaviour. Implemented by @lara-madison. TikZ export for graphs with symbolic phases now prepends a metadata comment carrying variable type information so to_tikz/tikz_to_graph round-trips preserve symbolic variables. This is an intentional breaking change for older PyZX versions, which will fail fast when opening such files. Fixed Many fixes to using and rewriting Multigraphs (by @RazinShaikh, @boldar99 and @lara-madison). Fixed several bugs in the jsonparser for transforming graphs into json and back (by @dlyongemallo). Fixed several bugs in calculating the tensor of a diagram in several edge-cases, in particular for scalar diagrams. Removed Some rewrite rules had slightly different implementations in rules.py, basicrules.py and editor_actions.py. These have now been merged and streamlined into their respective subfiles in the rewrite_rules submodule.