Skip to content

Commit

Permalink
add controlflow handling to stochastic swap pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ewinston committed Sep 8, 2022
1 parent 072c550 commit 0161913
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions qiskit/dagcircuit/dagcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)]
Expand Down

0 comments on commit 0161913

Please sign in to comment.