Switch is_directed_acyclic_graph to use toposort internally #217
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.
Previously the retworkx.is_directed_acyclic_graph() function was
internally using the petgraph::algo::is_cyclic_directed function to look
for a potential cycle in the graph. However, as noted in the docs[1]
this function is recursive and as reported in Qiskit/qiskit#5502
with very large graphs this is causing segfaults. To avoid this
potential issue this commit changes the internal implementation to use
petgraph::algo::toposort which isn't recursive and should be more
reliable.
Fixes: Qiskit/qiskit#5502
[1] https://docs.rs/petgraph/0.5.1/petgraph/algo/fn.is_cyclic_directed.html