from qiskit import QuantumCircuit,IBMQ,execute, transpile,Aer
from qiskit.visualization import plot_circuit_layout

qc=QuantumCircuit(1)
qc.h(0)
qc.draw(output="mpl")

transpile_circuit=transpile(qc)
transpile_circuit.draw(output="mpl")

provider=IBMQ.load_account() 
#Get the backend
backend=provider.get_backend('ibmq_bogota')

transpile_circuit=transpile(qc,backend)
transpile_circuit.draw(output="mpl")

backend.configuration().basis_gates

plot_circuit_layout(transpile_circuit, backend)

qc=QuantumCircuit(3)
qc.h(0)
qc.x(1)
qc.cx(0,2)
qc.draw(output="mpl")

qc.depth()

transpile_circuit=transpile(qc,backend)
transpile_circuit.draw(output="mpl")

transpile_circuit.depth()

plot_circuit_layout(transpile_circuit, backend)

transpile_circuit_0=transpile(qc,backend,optimization_level=0)
transpile_circuit_0.draw(output="mpl")

plot_circuit_layout(transpile_circuit_0, backend)

transpile_circuit_0.depth()

transpile_circuit_1=transpile(qc,backend,optimization_level=1)
transpile_circuit_1.draw(output="mpl")

plot_circuit_layout(transpile_circuit_1, backend)

transpile_circuit_1.depth()

transpile_circuit_2=transpile(qc,backend,optimization_level=2)
transpile_circuit_2.draw(output="mpl")

plot_circuit_layout(transpile_circuit_2, backend)

transpile_circuit_2.depth()

transpile_circuit_3=transpile(qc,backend,optimization_level=3)
transpile_circuit_3.draw(output="mpl")

plot_circuit_layout(transpile_circuit_3, backend)

transpile_circuit_3.depth()

from qiskit.tools.jupyter import *
backend

transpile_circuit_new=transpile(qc,backend,optimization_level=3,initial_layout=[2,3,4])
transpile_circuit_new.draw(output="mpl")

plot_circuit_layout(transpile_circuit_new, backend)

transpile_circuit_new=transpile(qc,backend,optimization_level=3,initial_layout=[0,2,3])
transpile_circuit_new.draw(output="mpl")

plot_circuit_layout(transpile_circuit_new, backend)

transpile_circuit_new.depth()

