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 dag visualization with Var wires #12848

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

mtreinish
Copy link
Member

@mtreinish mtreinish commented Jul 29, 2024

Summary

This commit fixes the dag visualization for DAGs with classical variables. The Var type was not handled in the attribute callback functions for nodes and edges. This was causing the visualizer to fail if the dag contained these types. This fixes this by adding explicit handling for the Var types and using the name attribute of the Var object.

Details and comments

This commit fixes the dag visualization for DAGs with classical
variables. The Var type was not handled in the attribute callback
functions for nodes and edges. This was causing the visualizer to fail
if the dag contained these types. This fixes this by adding explict
handling for the Var types and using the name attribute of the Var
object.
@mtreinish mtreinish added Changelog: Bugfix Include in the "Fixed" section of the changelog mod: visualization qiskit.visualization labels Jul 29, 2024
@mtreinish mtreinish added this to the 1.1.2 milestone Jul 29, 2024
@mtreinish mtreinish requested review from nonhermitian and a team as code owners July 29, 2024 19:29
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

@mtreinish mtreinish added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Jul 29, 2024
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

This generally looks fine, thanks for the catch. Is there a simple regression test we can throw in for it? Also: bugfix release note.

@coveralls
Copy link

coveralls commented Jul 29, 2024

Pull Request Test Coverage Report for Build 10291911483

Details

  • 0 of 6 (0.0%) changed or added relevant lines in 1 file are covered.
  • 8 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.004%) to 89.755%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/visualization/dag_visualization.py 0 6 0.0%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 2 93.23%
crates/qasm2/src/parse.rs 6 97.61%
Totals Coverage Status
Change from base Build 10222290210: 0.004%
Covered Lines: 67353
Relevant Lines: 75041

💛 - Coveralls

@mtreinish
Copy link
Member Author

I'm skeptical of a test here, mostly because it's a visualization test and the only thing I can do besides asserting it doesn't fail is compare the output visualization. I'm not a big fan of image diff tests, and in this case will be very tricky for me to write because I have a newer version of graphviz installed locally and none of the existing graphviz based visualization tests pass locally.

@jakelishman
Copy link
Member

For visualisation, I'm basically fine just asserting that it doesn't fail for the reasons you give. It would be good to make sure that the path is at least run in the tests.

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

Thanks!

@jakelishman
Copy link
Member

@Mergifyio backport stable/1.1 stable/1.2

@jakelishman jakelishman added this pull request to the merge queue Aug 8, 2024
Copy link
Contributor

mergify bot commented Aug 8, 2024

backport stable/1.1 stable/1.2

✅ Backports have been created

Merged via the queue into Qiskit:main with commit adbe887 Aug 8, 2024
15 checks passed
mergify bot pushed a commit that referenced this pull request Aug 8, 2024
* Fix dag visualization with Var wires

This commit fixes the dag visualization for DAGs with classical
variables. The Var type was not handled in the attribute callback
functions for nodes and edges. This was causing the visualizer to fail
if the dag contained these types. This fixes this by adding explict
handling for the Var types and using the name attribute of the Var
object.

* Add release note and test

(cherry picked from commit adbe887)
mergify bot pushed a commit that referenced this pull request Aug 8, 2024
* Fix dag visualization with Var wires

This commit fixes the dag visualization for DAGs with classical
variables. The Var type was not handled in the attribute callback
functions for nodes and edges. This was causing the visualizer to fail
if the dag contained these types. This fixes this by adding explict
handling for the Var types and using the name attribute of the Var
object.

* Add release note and test

(cherry picked from commit adbe887)
github-merge-queue bot pushed a commit that referenced this pull request Aug 8, 2024
* Fix dag visualization with Var wires

This commit fixes the dag visualization for DAGs with classical
variables. The Var type was not handled in the attribute callback
functions for nodes and edges. This was causing the visualizer to fail
if the dag contained these types. This fixes this by adding explict
handling for the Var types and using the name attribute of the Var
object.

* Add release note and test

(cherry picked from commit adbe887)

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
github-merge-queue bot pushed a commit that referenced this pull request Aug 8, 2024
* Fix dag visualization with Var wires

This commit fixes the dag visualization for DAGs with classical
variables. The Var type was not handled in the attribute callback
functions for nodes and edges. This was causing the visualizer to fail
if the dag contained these types. This fixes this by adding explict
handling for the Var types and using the name attribute of the Var
object.

* Add release note and test

(cherry picked from commit adbe887)

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog mod: visualization qiskit.visualization stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants