Skip to content

Doubled diagram visualization#86

Merged
rafaelha merged 7 commits intomainfrom
rafaelha/doubled_diagram_visualization
Apr 1, 2026
Merged

Doubled diagram visualization#86
rafaelha merged 7 commits intomainfrom
rafaelha/doubled_diagram_visualization

Conversation

@rafaelha
Copy link
Copy Markdown
Collaborator

@rafaelha rafaelha commented Apr 1, 2026

Closes #60

This PR purely changes visualization, but not the underlying pyzx backend. For actual ZX simplification and stabilizer rank decomposition, a doubled diagram is always constructed manually, e.g., by explicitly adding to vertices with conjugate phase per quantum spider.

Uses doubled diagram notations, so that the method Circuit.diagram("pyzx") actually returns correct ZX diagrams

image

The notation is defined as follows:

image

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2086 2021 97% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/tsim/circuit.py 97% 🟢
src/tsim/core/instructions.py 98% 🟢
src/tsim/core/parse.py 93% 🟢
TOTAL 96% 🟢

updated for commit: 4395fd9 by action🐍

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-04-01 14:16 UTC

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the PyZX diagram rendering path to support “doubled diagram” notation (bold vertices/edges) so Circuit.diagram("pyzx") produces semantically correct ZX-style visualizations for circuits with classical post-processing (detectors/observables).

Changes:

  • Add an optional track_classical_wires mode to the stim→ZX parsing pipeline and thread it into the "pyzx" diagram path.
  • Introduce “bold” edge/vertex type enums and use them for many graph-construction edges/vertices when classical-wire tracking is enabled.
  • Switch pyzx-param resolution to a Git branch that (presumably) implements doubled-diagram rendering support.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
uv.lock Switches pyzx-param from a PyPI release to a Git-sourced dependency (branch/commit) to pick up doubled-diagram support.
pyproject.toml Adds a uv source override for pyzx-param to pull from a Git branch.
src/tsim/core/parse.py Adds track_classical_wires parameter and passes it into GraphRepresentation.
src/tsim/core/instructions.py Adds bold enums and routes various edge/vertex constructions through b.edge_type / b.vertex_type when tracking classical wires.
src/tsim/circuit.py Enables classical-wire tracking for diagram(type="pyzx") and adds boundary outputs for det/obs nodes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rafaelha rafaelha merged commit 4ebe3e1 into main Apr 1, 2026
10 checks passed
@rafaelha rafaelha deleted the rafaelha/doubled_diagram_visualization branch April 1, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better pyzx visualization

2 participants