Qiskit / rustworkx

A high performance Python graph library implemented in Rust.
https://www.rustworkx.org
Apache License 2.0
981 stars 141 forks source link

Allow single node indices in `TopologicalSorter.done` #1157

Closed jakelishman closed 3 months ago

jakelishman commented 3 months ago

What is the expected enhancement?

Following #1128, another thing that would help performance for TopologicalSorter for the intended use-cases on Qiskit is if it were to allow single indices in its done method. In practice, all the reasons we use the on-line sorter for involve looking at nodes one at a time and making a decision about them, and the overhead of constructing new Python lists and then unwrapping them into Rust vecs is quite expensive.

I'm happy to make a PR, just before I do: would we prefer to have a separate done_single method, or to overload done?