Skip to content

Commit

Permalink
greating a challenging backend to show the doc point (#12116) (#12141)
Browse files Browse the repository at this point in the history
(cherry picked from commit 59bdff9)

Co-authored-by: Luciano Bello <[email protected]>
  • Loading branch information
mergify[bot] and 1ucian0 authored Apr 4, 2024
1 parent 9da4656 commit 3ef47f2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions qiskit/transpiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@
at the output.
In order to highlight this, we run a GHZ circuit 100 times, using a "bad" (disconnected)
`initial_layout`:
``initial_layout`` in a heavy hex coupling map:
.. plot::
Expand All @@ -816,18 +816,22 @@
import matplotlib.pyplot as plt
from qiskit import QuantumCircuit, transpile
from qiskit.providers.fake_provider import GenericBackendV2
backend = GenericBackendV2(16)
from qiskit.transpiler import CouplingMap
coupling_map = CouplingMap.from_heavy_hex(3)
backend = GenericBackendV2(coupling_map.size(), coupling_map=coupling_map)
ghz = QuantumCircuit(15)
ghz.h(0)
ghz.cx(0, range(1, 15))
depths = []
for _ in range(100):
for i in range(100):
depths.append(
transpile(
ghz,
backend,
seed_transpiler=i,
layout_method='trivial' # Fixed layout mapped in circuit order
).depth()
)
Expand Down

0 comments on commit 3ef47f2

Please sign in to comment.