Skip to content

Commit

Permalink
fix edge coloring bug in plot_coupling_map (#12369) (#12379)
Browse files Browse the repository at this point in the history
* fix edge coloring bug in plot circuit layout

* add release note

(cherry picked from commit 24f1436)

Co-authored-by: Kevin J. Sung <kevjsung@umich.edu>
  • Loading branch information
mergify[bot] and kevinsung committed May 10, 2024
1 parent 2c44a06 commit a938606
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
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.

0 comments on commit a938606

Please sign in to comment.