You can decompose a quantum circuit into layers using DAGCircuit.layers()
method:
from qiskit.converters import circuit_to_dag, dag_to_circuit
from IPython.display import display
dag = circuit_to_dag(circ)
for layer in dag.layers():
layer_as_circuit = dag_to_circuit(layer['graph'])
display(layer_as_circuit.draw('mpl'))
where circ
is a QuantumCircuit
. The output will be:

DAGCircuit.layers()
method constructs the layers using a greedy algorithm.
You can also break down your circuit into layers based on some scheduling policy. In the following example we apply an "as late as possible" (ALAP) scheduling policy:
from qiskit.transpiler import PassManager, InstructionDurations
from qiskit.transpiler.passes import ALAPScheduleAnalysis, PadDelay
# Apply the scheduling policy:
instruction_durations = InstructionDurations(
[
("h", None, 160),
("x", None, 160),
("cx", None, 800),
("measure", None, 1600),
]
)
pass_manager = PassManager(
[
ALAPScheduleAnalysis(instruction_durations),
PadDelay(),
]
)
transpiled_circ = pass_manager.run(circ)
# Use DAGCircuit.layers() method with the transpiled circuit:
dag = circuit_to_dag(transpiled_circ)
for layer in dag.layers():
layer_as_circuit = dag_to_circuit(layer['graph'])
# Remove the Delay instructions:
for _inst in layer_as_circuit.data:
if _inst.operation.name == 'delay':
layer_as_circuit.data.remove(_inst)
display(layer_as_circuit.draw('mpl'))
The result:

Similarly, you can apply "as soon as possible" (ASAP) scheduling policy.
layer[0] = [X [q1]]
andlayer[1] = [H [q0], H [q1]]
. Also note that you should put identity operators to empty places in the circuit, i.e. your layer 1 should belayer[1] = [I q[0], H [q1]]
$\endgroup$