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 edge coloring bug in plot_coupling_map (backport #12369) #12379

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions qiskit/visualization/gate_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,9 @@ def plot_coupling_map(
graph = CouplingMap(coupling_map).graph

if not plot_directed:
line_color_map = dict(zip(graph.edge_list(), line_color))
graph = graph.to_undirected(multigraph=False)
line_color = [line_color_map[edge] for edge in graph.edge_list()]

for node in graph.node_indices():
graph[node] = node
Expand Down
5 changes: 5 additions & 0 deletions releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
Fixed a bug in :func:`plot_coupling_map` that caused the edges of the coupling map to be colored incorrectly.
See https://github.com/Qiskit/qiskit/pull/12369 for details.