diff --git a/crates/circuit/src/dag_circuit.rs b/crates/circuit/src/dag_circuit.rs index 7a869644415..7ad3a89f0ee 100644 --- a/crates/circuit/src/dag_circuit.rs +++ b/crates/circuit/src/dag_circuit.rs @@ -3201,8 +3201,9 @@ def _format(operand): } } - let elements : Vec<_> = qubits_in_cone.iter().map(|&qubit| qubit.0.into_py(py)).collect(); - Ok(PySet::new_bound(py, &elements)?.unbind()) + let qubits_in_cone_vec: Vec<_> = qubits_in_cone.iter().map(|&&qubit| qubit).collect(); + let elements = self.qubits.map_indices(&qubits_in_cone_vec[..]); + Ok(PySet::new_bound(py, elements)?.unbind()) } /// Return a dictionary of circuit properties. @@ -3286,7 +3287,7 @@ impl DAGCircuit { self.dag .edges_directed(node, Outgoing) .filter_map(|e| match e.weight() { - Wire::Qubit(_) => Some(e.source()), + Wire::Qubit(_) => Some(e.target()), _ => None, }) .unique()