Skip to content

Conversation

@masa10-f
Copy link
Collaborator

@masa10-f masa10-f commented Jan 1, 2026

Summary

  • Add ability to store 2D/3D coordinates for nodes in GraphState
  • Emit QUBIT_COORDS instructions in stim compiler output
  • Add option to use graph coordinates in visualizer

Changes

GraphState (graphqomb/graphstate.py)

  • Add coordinates abstract property to BaseGraphState
  • Add __coordinates attribute, coordinates property, and set_coordinate method to GraphState
  • Add coordinate parameter to add_physical_node
  • Remove coordinate when node is removed in remove_physical_node
  • Add coordinates parameter to from_graph
  • Copy coordinates in from_base_graph_state
  • Merge coordinates in compose

Command (graphqomb/command.py)

  • Add coordinate field to N command

Pattern (graphqomb/pattern.py)

  • Add input_coordinates field and coordinates property to Pattern

Qompiler (graphqomb/qompiler.py)

  • Inherit coordinates from GraphState to N commands and Pattern in _qompile

Stim Compiler (graphqomb/stim_compiler.py)

  • Add _emit_qubit_coords helper function
  • Output coordinates in _initialize_nodes and _prepare_node
  • Add emit_qubit_coords option to stim_compile (default True)

Visualizer (graphqomb/visualizer.py)

  • Add _get_node_positions function
  • Add use_graph_coordinates option to visualize

Test plan

  • Add GraphState coordinate tests
    • set_coordinate/coordinates functionality
    • Coordinate specification in add_physical_node
    • Coordinate inheritance in from_graph
    • Coordinate copy in from_base_graph_state
    • Coordinate removal when node is deleted
  • Add stim_compile coordinate tests
    • QUBIT_COORDS instruction output (2D/3D)
    • emit_qubit_coords=False case
    • Pattern.coordinates property
  • All tests pass
  • ruff check passes
  • mypy passes

🤖 Generated with Claude Code

This adds the ability to store 2D/3D coordinates for nodes in GraphState
and emit QUBIT_COORDS instructions in stim compiler output.

Changes:
- Add coordinates property and set_coordinate method to GraphState
- Add coordinate parameter to add_physical_node and from_graph
- Add coordinate field to N command
- Add input_coordinates field and coordinates property to Pattern
- Inherit coordinates from GraphState to Pattern via qompiler
- Emit QUBIT_COORDS instructions in stim_compile (with emit_qubit_coords option)
- Add use_graph_coordinates option to visualizer
- Add comprehensive tests for coordinate functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jan 1, 2026

Codecov Report

❌ Patch coverage is 95.65217% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.35%. Comparing base (20b0ad4) to head (4b79df7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #148      +/-   ##
==========================================
+ Coverage   76.71%   83.35%   +6.64%     
==========================================
  Files          21       21              
  Lines        2276     2337      +61     
  Branches      401      421      +20     
==========================================
+ Hits         1746     1948     +202     
+ Misses        455      294     -161     
- Partials       75       95      +20     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Apply ruff format to fix formatting issues
- Add test_compose_copies_coordinates to verify compose function
  copies coordinates from both graphs
- Add tests/test_visualizer.py with coordinate tests for:
  - Graph coordinates usage
  - Partial coordinates handling
  - 3D to 2D projection
  - Empty coordinates fallback

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@masa10-f
Copy link
Collaborator Author

masa10-f commented Jan 1, 2026

@codex review

@masa10-f masa10-f self-assigned this Jan 1, 2026
@masa10-f masa10-f added the enhancement New feature or request label Jan 1, 2026
@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Delightful!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

masa10-f and others added 5 commits January 4, 2026 14:10
- Support 1D coordinates in visualizer (y defaults to 0.0)
- Add docstring note about 3D visualization being planned
- Add test for set_coordinate with invalid node
- Add tests for N command string representation
- Add test for 1D coordinates in visualizer

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add coordinate parameter to BaseGraphState.add_physical_node
- Rename _get_node_positions to _determine_node_positions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@masa10-f
Copy link
Collaborator Author

@codex review

@masa10-f masa10-f requested a review from d1ssk January 10, 2026 10:09
@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

2 participants