Skip to content

Avoid overlapping MPP ancilla coordinates#238

Merged
masa10-f merged 3 commits into
masterfrom
agent/avoid-overlapping-mpp-ancillas
Jul 21, 2026
Merged

Avoid overlapping MPP ancilla coordinates#238
masa10-f merged 3 commits into
masterfrom
agent/avoid-overlapping-mpp-ancillas

Conversation

@masa10-f

Copy link
Copy Markdown
Collaborator

Summary

  • detect when an automatically inferred MPP ancilla centroid is already occupied
  • keep the inferred temporal coordinate and deterministically search nearby XY positions for sufficient clearance
  • preserve existing behavior for unoccupied centroids and explicitly supplied ancilla coordinates
  • document the placement rule and add regression coverage for blocked fallback positions

Root cause

MPP ancillas without explicit coordinates were always assigned the component-wise centroid of their connected data nodes. The builder did not check whether another graph node already occupied that coordinate, so nodes could render on top of one another.

Impact

Coordinate-aware MPP imports now remain visually distinguishable when a support centroid coincides with a data qubit or another previously positioned node. Graph construction and temporal placement semantics are unchanged.

Validation

  • python -m pytest -s -q — 797 passed, 1 skipped
  • ruff format --check graphqomb/qec/qeccode.py tests/test_qec.py
  • ruff check graphqomb/qec/qeccode.py tests/test_qec.py
  • mypy graphqomb/qec/qeccode.py tests/test_qec.py
  • pyright graphqomb/qec/qeccode.py tests/test_qec.py

@masa10-f
masa10-f marked this pull request as ready for review July 21, 2026 03:24
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.76923% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.38%. Comparing base (455df96) to head (ba6ad20).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #238      +/-   ##
==========================================
- Coverage   86.41%   86.38%   -0.04%     
==========================================
  Files          31       31              
  Lines        5086     5111      +25     
  Branches      903      908       +5     
==========================================
+ Hits         4395     4415      +20     
- Misses        488      491       +3     
- Partials      203      205       +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6df8025277

ℹ️ 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".

Comment thread graphqomb/qec/qeccode.py Outdated
Comment on lines +511 to +512
if not any(math.dist(coordinate, occupied) <= _COORDINATE_TOLERANCE for occupied in occupied_coordinates):
return coordinate

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Check occupancy in the XY plane

When an inferred MPP ancilla shares the displayed data-plane position with an existing node but differs in z, this full 3D math.dist check treats the centroid as unoccupied and returns it unchanged. For example, a Type-I single-qubit Y support infers an ancilla at (x, y, 0.5) between data nodes at (x, y, 0) and (x, y, 1); visualize() projects 3D coordinates to XY, so all three nodes still render on top of each other despite the new placement rule. The occupancy and clearance tests should compare XY distance while preserving the inferred z coordinate.

Useful? React with 👍 / 👎.

@masa10-f
masa10-f merged commit f18a5e6 into master Jul 21, 2026
24 checks passed
@masa10-f
masa10-f deleted the agent/avoid-overlapping-mpp-ancillas branch July 21, 2026 03:51
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.

1 participant