Closed mtreinish closed 4 months ago
Self-assigning this.
There was a bit more urgency behind this as I had a few direct requests to have this implemented in rustworkx-core. So I hope you don't mind that I pushed up a PR to implement this here: #1197.
The
lexicographical_topological_sort()
function is only exposed via a Python interface currently:https://github.com/Qiskit/rustworkx/blob/ab93329be6d8aaccb6c090f4b3ab6f9540ee8114/src/dag_algo/mod.rs#L347-L485
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
(realistically aVec<N>
) of node weights we should have it return of an iterator of node ids. This would be more flexible and performant for rust space users and for the python side of rustworkx we can just consume the iterator to build the pylist return there (for api compatibility).