Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where edge colors are randomly shuffled in mpl_draw #1312

Merged
merged 3 commits into from
Nov 16, 2024

Conversation

IvanIsCoding
Copy link
Collaborator

Closes #1308. A bit embarrasing but we let that slip through in #1204.

The solution is a bit hacky but reusing Python dictionaries was the easiest way to get a set-like object that preservers iteration order.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11771360914

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 95.835%

Totals Coverage Status
Change from base Build 11709175986: 0.01%
Covered Lines: 18018
Relevant Lines: 18801

💛 - Coveralls

@mtreinish mtreinish added the stable-backport-potential This PR or issue is potentially worth backporting for inclusion in a stable branch label Nov 15, 2024
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

It's a little weird as a pattern, but this makes sense to have set like mechanics while retaining insertion order. This LGTM, before merging though was there a test we wanted to add for this to catch a potential future regression?

@IvanIsCoding
Copy link
Collaborator Author

I was checking https://github.com/Qiskit/rustworkx/blob/main/tests/visualization/test_mpl.py. Currently we have no tests asserting any attributes about the images. We just assert they can be saved.

I will create another issue to add Matplotlib that actually catch regressions

@IvanIsCoding IvanIsCoding added this pull request to the merge queue Nov 16, 2024
Merged via the queue into Qiskit:main with commit 44d9fb0 Nov 16, 2024
26 checks passed
@IvanIsCoding IvanIsCoding deleted the fix-edge-colors branch November 16, 2024 03:34
mergify bot pushed a commit that referenced this pull request Nov 16, 2024
* Try to make edge_pos iteration deterministic

* Fix minor bug

* Add release note

(cherry picked from commit 44d9fb0)

# Conflicts:
#	rustworkx/visualization/matplotlib.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stable-backport-potential This PR or issue is potentially worth backporting for inclusion in a stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rx.visualization.mpl_draw() does not apply an edge_color list to the correct edges
3 participants