From 26e919683203794aeca2e807a3705c9c3b69796c Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 11 Jul 2024 06:22:49 -0400 Subject: [PATCH] Use rustworkx 0.15.0 features in DAGCircuit.remove_op_node This commit updates the minimum rustworkx version to 0.15.0 to pull in the new PyDiGraph.remove_node_retain_edges_by_id() method introduced in that release. This new function is used for the DAGCircuit.remove_op_node() method instead of the PyDiGraph.remove_node_retain_edges() function. This new method has much better scaling characteristics and should improve the performance characteristics of removing very wide operations from a DAGCircuit. Fixes #11677 Part of #12156 --- qiskit/dagcircuit/dagcircuit.py | 4 +--- .../update-rustworkx-min-version-4f07aacfebccae80.yaml | 7 +++++++ requirements.txt | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/update-rustworkx-min-version-4f07aacfebccae80.yaml diff --git a/qiskit/dagcircuit/dagcircuit.py b/qiskit/dagcircuit/dagcircuit.py index 5d6739d72198..796e0bc2b700 100644 --- a/qiskit/dagcircuit/dagcircuit.py +++ b/qiskit/dagcircuit/dagcircuit.py @@ -1986,9 +1986,7 @@ def remove_op_node(self, node): "node type was wrongly provided." ) - self._multi_graph.remove_node_retain_edges( - node._node_id, use_outgoing=False, condition=lambda edge1, edge2: edge1 == edge2 - ) + self._multi_graph.remove_node_retain_edges_by_id(node._node_id) self._decrement_op(node.name) def remove_ancestors_of(self, node): diff --git a/releasenotes/notes/update-rustworkx-min-version-4f07aacfebccae80.yaml b/releasenotes/notes/update-rustworkx-min-version-4f07aacfebccae80.yaml new file mode 100644 index 000000000000..7661f82aee8b --- /dev/null +++ b/releasenotes/notes/update-rustworkx-min-version-4f07aacfebccae80.yaml @@ -0,0 +1,7 @@ +--- +upgrade_misc: + - | + The minimum version of rustworkx required to run this release has been + increased from 0.14.0 to 0.15.0. This is required because Qiskit is now + using new functionality added in the rustworkx 0.15.0 release which + improves performance. diff --git a/requirements.txt b/requirements.txt index 539f9587994d..2dd5e49e2b3d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -rustworkx>=0.14.0 +rustworkx>=0.15.0 numpy>=1.17,<3 scipy>=1.5 sympy>=1.3