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

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
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 82.07792% with 69 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.70%. Comparing base (4c26208) to head (69ffb37).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
+ Coverage   76.00%   78.70%   +2.70%     
==========================================
  Files          21       23       +2     
  Lines        2209     2555     +346     
  Branches      378      452      +74     
==========================================
+ Hits         1679     2011     +332     
+ Misses        456      455       -1     
- Partials       74       89      +15     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nabe98 nabe98 marked this pull request as ready for review November 27, 2025 18:32
@nabe98 nabe98 requested a review from masa10-f November 27, 2025 18:33
@masa10-f
Copy link
Collaborator

masa10-f commented Dec 2, 2025

@nabe98 I'll review your PR this weekend. Before that, please move local_cliffords stuff into ZXGraphState since only ZX Calculus uses that attribute, and we want GraphState to be a simple structure.

@nabe98
Copy link
Collaborator Author

nabe98 commented Dec 3, 2025

I’ll have it revised by Friday night. Thank you in advance.

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