Skip to content

Commit

Permalink
Use rustworkx 0.15.0 features in DAGCircuit.remove_op_node (#12756)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mtreinish authored Jul 11, 2024
1 parent 4c9ca6e commit 99ae318
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 1 addition & 3 deletions qiskit/dagcircuit/dagcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rustworkx>=0.14.0
rustworkx>=0.15.0
numpy>=1.17,<3
scipy>=1.5
sympy>=1.3
Expand Down

0 comments on commit 99ae318

Please sign in to comment.