From a93860654d68511e6b0711ea238bd102cfdb2104 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 11:27:54 +0000 Subject: [PATCH] fix edge coloring bug in plot_coupling_map (#12369) (#12379) * fix edge coloring bug in plot circuit layout * add release note (cherry picked from commit 24f1436fdb5d4061fde3a6fab6dd5139556f7e10) Co-authored-by: Kevin J. Sung --- qiskit/visualization/gate_map.py | 2 ++ releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml diff --git a/qiskit/visualization/gate_map.py b/qiskit/visualization/gate_map.py index c7cc0727a6c4..b950c84c902a 100644 --- a/qiskit/visualization/gate_map.py +++ b/qiskit/visualization/gate_map.py @@ -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 diff --git a/releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml b/releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml new file mode 100644 index 000000000000..72f2c95962a5 --- /dev/null +++ b/releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml @@ -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.