Feature: Interactive Graph Visualization Tool #388#439
Feature: Interactive Graph Visualization Tool #388#439Kitsunp wants to merge 22 commits intoTeamGraphix:masterfrom
Conversation
… GUI and simulation capabilities.
…including simulation capabilities and example usage.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #439 +/- ##
==========================================
+ Coverage 88.09% 88.31% +0.22%
==========================================
Files 44 45 +1
Lines 6449 6770 +321
==========================================
+ Hits 5681 5979 +298
- Misses 768 791 +23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @Kitsunp , thank you for your work. Good first attempt! It wasn't stated explicitly in the issue, but we expect in general that contributions are as easy to maintain as possible. In this case, that means we expect that, as much as possible, code relevant to both the
A few other points of constructive criticism:
Since we need to approve the Github CI to run, I would recommend you run Feel free to ask clarifying questions, or have another go and @ me when you are ready for another review. |
|
Hi! I noticed an issue in the dependency workflow that is causing the CI to fail. I've run the tests locally with nox and they pass, so I believe there might be an error in the CI environment (specifically with the veriphix reverse dependency). However, I am already looking into the points you mentioned. I'm working on sharing more code between the visualization modules, improving the layout to reduce whitespace, and making the measurement results more distinct from the node labels. I will update the PR once I’ve addressed these improvements. Thanks for the feedback!" |
…sunp/graphix into feat/visualization-issue-388
Clarifying questions — PR #439Hi @emlynsg, thank you for the detailed feedback. I've addressed the layout, measurement display, and started breaking up 1. How far should the API of
|
|
Hi, thanks for the PR. It'll be easier to decide on your design questions by looking at specific code. So go ahead with 1. For 2, let's do b. For 3, it can leave in the interactive module for now. For 4, there's not any fallback procedure, but in general the flow should always be shown. |
…sunp/graphix into feat/visualization-issue-388
|
Hi @emlynsg, @matulni here's an update on what's changed based on your feedback. ChangesCode sharing between modules Extended
Layout & node overlap
Node sizing Node marker size and label font size are computed once at construction time from the actual figure/axes geometry: This is deterministic — no heuristics that break on window resize or different graph sizes. Configurable visual parameters All visual constants are now public keyword-only constructor parameters:
Visual style
Design questions1. Label drawing The only remaining duplicated logic is label drawing — the interactive visualizer draws labels locally because it appends dynamic content ( Two options:
2. Layer ordering in the interactive visualizer The interactive visualizer uses |
|
Hi @Kitsunp , just a few comments for you to consider and hopefully one of us will have time to review later today.
Feel free to put more questions here and we will get back to you when we are able. |
|
Hi @Kitsunp thanks for your continued hard work. Appreciate your responsiveness, since this coding is visual there is inherently more trial-and-error involved. The most important thing for us is that the interactive plot looks nearly identical to the static plotting already in Graphix. The only difference should be (1) slightly different highlighting/shading to indicate the extra information (measured/not yet measured, commands in pattern not yet run, etc.) (2) pattern, slider and legend (if shown), and (3) the size/spacing of the plot (if it needs more space to fit everything. To that end, our comments on your current implementation are:
|






Description
Implements an interactive visualization tool for MBQC patterns (Issue #388). This tool allows users to manually step through the command sequence, visualizing the evolving graph state, Pauli corrections, and measurement outcomes.
Key Changes
Core Implementation
graphix/visualization_interactive.py: AddedInteractiveGraphVisualizerwith:StatevectorBackendintegration for live measurement simulation.Refactoring
graphix/visualization.py: Extracted graph layout logic into a reusableget_layoutmethod perfect for sharing between static and interactive visualizers.Testing & Examples
tests/test_visualization_interactive.pywith comprehensive logic coverage (mockingmatplotlibfor CI compatibility).examples/interactive_viz_demo.py(simple) andexamples/interactive_viz_qaoa.py(complex).Verification
pytestpasses (including new tests).ruffandmypystrict type checking.Checklist
ruff).mypy).