# Real-device error mitigation with qiskit

I'm trying to do error mitigation in IBM-Q quantum computers with qiskit. I followed the tutorial here. My thought was that in order to make sure that I'm correcting the qubits that I'm actually using in my circuits, I should specify the backend and qubits to make sure that the qubits used in my actual circuit and obtaining the correcting matrix are the same. I asked this question and followed along, but I have encountered some problems. Here is the part that is causing problem:

    qreg = qk.QuantumRegister(7)
layout = {qreg[0]: 12,
qreg[1]: 11,
qreg[2]: 13,
qreg[3]: 17,
qreg[4]: 14,
qreg[5]: 12,
qreg[6]: 6}

########## error mitigation ##########

meas_calibs, state_labels = complete_meas_cal(
qubit_list=[0, 1, 2], qr=qreg, circlabel='mcal')
print(meas_calibs[0])

# This line below is causing error if I add "initial_layout" in both qk.compiler.transpile and qk.execute
qk.compiler.transpile(meas_calibs, backend=_backend, initial_layout=layout)


qiskit.dagcircuit.exceptions.DAGCircuitError: 'not a DAG'


whenever I specify the layout. I googled about this error but found nothing. So my question is, what does this error mean? What have I done wrong and how can I fix it?

You have assigned 2 virtual qubits to the same physical qubit, both qreg[0] and qreg[5] are assigned to physical qubit 12. If you change one of these to be a different physical qubit, it should work.