qiskit.dagcircuit.DAGCircuit.substitute_node¶
- DAGCircuit.substitute_node(node, op, inplace=False)[ソース]¶
Replace an DAGOpNode with a single operation. qargs, cargs and conditions for the new operation will be inferred from the node to be replaced. The new operation will be checked to match the shape of the replaced operation.
- パラメータ
node (DAGOpNode) – Node to be replaced
op (qiskit.circuit.Operation) – The
qiskit.circuit.Operation
instance to be added to the DAGinplace (bool) – Optional, default False. If True, existing DAG node will be modified to include op. Otherwise, a new DAG node will be used.
- 戻り値
the new node containing the added operation.
- 戻り値の型
- 例外
DAGCircuitError – If replacement operation was incompatible with
location of target node. –