-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add transitive_closure_dag function #707
base: main
Are you sure you want to change the base?
Conversation
This commit adds a new function transitive_closure_dag() which is an optimized method for computing the transitive closure for DAGs. In support of this a new function descendants_at_distance() for finding the nodes a fixed distance from a given source to both rustworkx and rustworkx-core. Related to: Qiskit#704
Pull Request Test Coverage Report for Build 3344180388
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit adds a new function transitive_closure_dag() which is an optimized method for computing the transitive closure for DAGs. In support of this a new function descendants_at_distance() for finding the nodes a fixed distance from a given source to both rustworkx and rustworkx-core.
Related to: #704
TODO:
- Add tests for descendants_at_distance (both from python and rust)
Well, computing the transitive closure for a DAG is 80% of the problem for the general case because the full algorithm is:
- Condense the graph into strongly connect components (which we already implement)
- Apply the DAG algorithm and get the transitive closure for the intermediate graph
- Map the answer from the intermediate graph to the original graph
This commit adds a new function to rustworkx-core for building a transitive closure inplace out of an input DAG. The function takes ownership of the input graph and will mutate it to add edtges to make it a transitive closure before returning it. This is then used internally by the retworkx python function transitive_clsoure_dag().
This commit adds a new function transitive_closure_dag() which is an optimized method for computing the transitive closure for DAGs. In support of this a new function descendants_at_distance() for finding the nodes a fixed distance from a given source to both rustworkx and rustworkx-core.
Related to: #704
TODO: