Open
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 |
Collaborator
IvanIsCoding
left a comment
There was a problem hiding this comment.
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: