Skip to content

Conversation

@nabe98
Copy link
Collaborator

@nabe98 nabe98 commented Oct 5, 2025

Before submitting, please check the following:

  • Make sure you have tests for the new code and that test passes (run pytest)
  • If applicable, add a line to the [unreleased] part of CHANGELOG.md, following keep-a-changelog.
  • Format added code by ruff
  • Type checking by mypy and pyright
  • Make sure the checks (github actions) pass.
  • Check that the docs compile without errors (run make html in ./docs/ - you may need to install dependency for sphinx docs, see docs/requirements.txt.)

Then, please fill in below:

Context (if applicable):

  • Add ZX-calculus backend ZXGraphState used for MBQC pattern simplification
  • Refs
    • Quantum 5, 421 (2021).
    • EPTCS 384, pp. 203-219 (2023).

Description of the change:

  • Implement ZXGraphState operations for local complement, pivot, Clifford removal, phase-gadget conversion, YZ-node merges, and a full_reduce pipeline, with helpers like _clifford_rules, _update_connections, and complete_graph_edges.
  • Added to_zx_graphstate to convert a canonical GraphState instance into the ZXGraphState instance while preserving inputs, outputs, and measurement data
  • Ship an executable example (examples/zxgraph_simplification.py) that demonstrates simplifying a random circuit’s ZX-diagram and visualizes the states before/after full_reduce
    • We used swiflow package to find the gflow. Wrapper function is implemented as gflow_wrapper.

Related issue:
close #102

@nabe98 nabe98 self-assigned this Oct 5, 2025
@nabe98 nabe98 added the enhancement New feature or request label Oct 5, 2025
@masa10-f
Copy link
Collaborator

masa10-f commented Oct 6, 2025

@nabe98
Reminder: Please verify the functionality with a numerical test, comparing the simulated result with the circuit.

@nabe98 nabe98 marked this pull request as draft October 17, 2025 14:04
return graph, flow


def random_circ(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding the include_phase_gadget parameter here.

@nabe98 nabe98 requested a review from masa10-f December 12, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ZXGraphState class

3 participants