diff --git a/qiskit/dagcircuit/dagcircuit.py b/qiskit/dagcircuit/dagcircuit.py index 3f0fa48be8dc..8eb5571895c2 100644 --- a/qiskit/dagcircuit/dagcircuit.py +++ b/qiskit/dagcircuit/dagcircuit.py @@ -34,6 +34,7 @@ from qiskit.circuit.gate import Gate from qiskit.circuit.instruction import Instruction from qiskit.circuit.parameterexpression import ParameterExpression +from qiskit.circuit.controlflow import ControlFlowOp from qiskit.dagcircuit.exceptions import DAGCircuitError from qiskit.dagcircuit.dagnode import DAGNode, DAGOpNode, DAGInNode, DAGOutNode from qiskit.utils import optionals as _optionals @@ -1438,6 +1439,10 @@ def multi_qubit_ops(self): ops.append(node) return ops + def control_flow_ops(self): + """return control flow operations""" + return self.op_nodes(op=ControlFlowOp) + def longest_path(self): """Returns the longest path in the dag as a list of DAGOpNodes, DAGInNodes, and DAGOutNodes.""" return [self._multi_graph[x] for x in rx.dag_longest_path(self._multi_graph)]