• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / rustworkx / 8576567307
94%

Build:
DEFAULT BRANCH: main
Ran 05 Apr 2024 11:48PM UTC
Jobs 1
Files 98
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

05 Apr 2024 10:47PM UTC coverage: 96.52% (+0.01%) from 96.509%
8576567307

push

github

web-flow
Add node-removal methods linear in node degree (#1083)

* Add node-removal methods linear in node degree

The existing method, `PyDiGraph.remove_node_retain_edges` is quadratic
in node degree, because the ``condition`` function takes in pairs of
edges.  This poses a problem for extreme-degree nodes (for example
massive barriers in Qiskit).

This commit adds two methods based on making edge-retention decisions by
hashable keys, making it linear in the degree of the node (at least;
the MIMO broadcasting can make it quadratic again if all edges have the
same key, but that's fundamental to the output, rather than the
algorithm).

The ideal situation (for performance) is that the edges can be
disambiguated by Python object identity, which doesn't require
Python-space calls to retrieve or hash, so can be in pure Rust.  This is
`remove_node_retain_edges_by_id`.

The more general situation is that the user wants to supply a Python key
function, which naturally returns a Python object that we need to use
Python hashing and equality semantics for.  This means using Python
collections to do the tracking, which impacts the performance (very
casual benchmarking using the implicit identity function as the key
shows it's about 2x slower than using the identity).  This method is
`remove_node_retain_edges_by_key`.

* Format

* Update conversion actions to be by `Bound` reference

This is partly a PyO3 0.21 upgrade, partly fixing a dodgy `extract` in
favour of `downcast`.

* Update out-of-date comment

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

113 of 115 new or added lines in 1 file covered. (98.26%)

17305 of 17929 relevant lines covered (96.52%)

1174213.14 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
98.41
-0.01% src/digraph.rs
Jobs
ID Job ID Ran Files Coverage
1 8576567307.1 05 Apr 2024 11:48PM UTC 98
96.52
GitHub Action Run
Source Files on build 8576567307
  • Tree
  • List 98
  • Changed 19
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #8576567307
  • 783f30c8 on github
  • Prev Build on main (#8571532908)
  • Next Build on main (#8638957457)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc