Qiskit / rustworkx

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

Move `layers` functionality to rustworkx-core #1167

Closed mtreinish closed 3 months ago

mtreinish commented 5 months ago

The layers() function is only exposed via a Python interface currently:

https://github.com/Qiskit/rustworkx/blob/ab93329be6d8aaccb6c090f4b3ab6f9540ee8114/src/dag_algo/mod.rs#L227-L345

We should port it to rustworkx-core, so that rust users can leverage the function.

One tweak that probably makes sense for the rustworkx-core version is that instead of returning a PyList for a Vec of Vecs of node weights we should have it return of an iterator of Vecs of node ids. This would be more flexible and performant for rust space users and for the python side of rustworkx we can just collect the iterator to a pylist (for backwards compatibility).

raynelfss commented 5 months ago

Can I be assigned to this?