Repository navigation
Conversation
Split horizontal wires in Cirq SVG circuit diagrams around vertical connectors that cross without interacting, leaving a transparent 3.0 px clearance on each side of the 1.5 px vertical stroke (7.5 px opening). - Add CROSSING_GAP, HORIZONTAL_LINE_STROKE_WIDTH, and VERTICAL_LINE_STROKE_WIDTH constants plus _line, _split_segment, and _crossing_columns helpers in cirq/contrib/svg/svg.py. - Add optional crossing_gap parameter to tdd_to_svg (validating finite non-negative values; 0 preserves legacy output byte-for-byte). - Keep all interacting junctions (controls, gate boxes, swap crosses, empty wire symbols, T-junctions, and moment-group brackets) unbroken. - Add unit and SVG geometry tests in cirq/contrib/svg/svg_test.py.
# Conflicts: # cirq-core/cirq/contrib/svg/svg.py
Increase CROSSING_GAP by 1 px per side (3.0 -> 4.0 px, raising total opening around 1.5 px vertical strokes from 7.5 to 9.5 px) and adjust the tight-layout merge/keep boundary test in svg_test.py accordingly.
Contributor
Author
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8562 +/- ##
========================================
Coverage 99.58% 99.58%
========================================
Files 1139 1139
Lines 105740 106049 +309
========================================
+ Hits 105303 105614 +311
+ Misses 437 435 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mhucka
marked this pull request as ready for review
December 1, 2026 04:09
mhucka
requested review from
arettig,
dstrain115 and
fdmalone
and removed request for
fdmalone
December 1, 2026 04:09
# Conflicts: # cirq-core/cirq/contrib/svg/svg.py # cirq-core/cirq/contrib/svg/svg_test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


In order to make it more clear when vertical and horizontal line crossings do not represent interaction, this PR modifies the drawing algorithm to put a thin space between the lines. The space is added to the qubit lines, to make vertical lines appear to cross over the qubit lines. Here's a crude rendition of the change in ASCII: whereas crossings looked like
───┼───before, they now look more like───|───.