qiskit/dagcircuit/dagcircuit.py
def serial_layers(self):
        """Yield a layer for all gates of this circuit.

        A serial layer is a circuit with one gate. The layers have the
        same structure as in layers().
        """
        for next_node in self.topological_op_nodes():
            new_layer = DAGCircuit()
            for qreg in self.qregs.values():
                new_layer.add_qreg(qreg)
            for creg in self.cregs.values():
                new_layer.add_creg(creg)
            # Save the support of the operation we add to the layer
            support_list = []
            # Operation data
            op = copy.copy(next_node.op)
            qa = copy.copy(next_node.qargs)
            ca = copy.copy(next_node.cargs)
            co = copy.copy(next_node.condition)
            _ = self._bits_in_condition(co)

            # Add node to new_layer
            new_layer.apply_operation_back(op, qa, ca, co)
            # Add operation to partition
            if next_node.name not in ["barrier",
                                      "snapshot", "save", "load", "noise"]:
                support_list.append(list(qa))
            l_dict = {"graph": new_layer, "partition": support_list}
            yield l_dict
def serial_layers(self):
        for next_node in self.topological_op_nodes():
            new_layer = DAGCircuit()
            for qreg in self.qregs.values():
                new_layer.add_qreg(qreg)
            for creg in self.cregs.values():
                new_layer.add_creg(creg)
            # Save the support of the operation we add to the layer
            support_list = []
            # Operation data
            op = copy.copy(next_node.op)
            qa = copy.copy(next_node.qargs)
            ca = copy.copy(next_node.cargs)
            co = copy.copy(next_node.condition)
            _ = self._bits_in_condition(co)

            # Add node to new_layer
            new_layer.apply_operation_back(op, qa, ca, co)
            # Add operation to partition
            if next_node.name not in ["barrier",
                                      "snapshot", "save", "load", "noise"]:
                support_list.append(list(qa))
            l_dict = {"graph": new_layer, "partition": support_list}
            yield l_dict
def serial_layers ( self ) : for next_node in self . topological_op_nodes ( ) : new_layer = DAGCircuit ( ) for qreg in self . qregs . values ( ) : new_layer . add_qreg ( qreg ) for creg in self . cregs . values ( ) : new_layer . add_creg ( creg ) # Save the support of the operation we add to the layer support_list = [ ] # Operation data op = copy . copy ( next_node . op ) qa = copy . copy ( next_node . qargs ) ca = copy . copy ( next_node . cargs ) co = copy . copy ( next_node . condition ) _ = self . _bits_in_condition ( co ) # Add node to new_layer new_layer . apply_operation_back ( op , qa , ca , co ) # Add operation to partition if next_node . name not in [ "barrier" , "snapshot" , "save" , "load" , "noise" ] : support_list . append ( list ( qa ) ) l_dict = { "graph" : new_layer , "partition" : support_list } yield l_dict
Yield a layer for all gates of this circuit.

        A serial layer is a circuit with one gate. The layers have the
        same structure as in layers().
Yield a layer for all gates of this circuit .