forked from Qiskit/rustworkx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always return a cycle in
digraph_find_cycle
if no node is specified…
… and a cycle exists (Qiskit#1181) * Handle find arbitrary cycle case * Find node in cycle more smartly * Implement find_node_in_arbitrary_cycle * Switch to Tarjan SCC for single pass DFS * Improve cycle checking logic * More assert_cycle! * Cargo fmt * Add test case for no cycle and no source * assertCycle for existing unit tests * Add more tests * Add self loop Python test * Add release notes and fix test * Address PR comments * Use less traits * Update release notes --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
12f8af5
commit 8e81911
Showing
3 changed files
with
133 additions
and
36 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
releasenotes/notes/fix-digraph-find-cycle-141e302ff4a8fcd4.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed the behavior of :func:`~rustworkx.digraph_find_cycle` when | ||
no source node was provided. Previously, the function would start looking | ||
for a cycle at an arbitrary node which was not guaranteed to return a cycle. | ||
Now, the function will smartly choose a source node to start the search from | ||
such that if a cycle exists, it will be found. | ||
other: | ||
- | | ||
The `rustworkx-core` function `rustworkx_core::connectivity::find_cycle` now | ||
requires the `petgraph::visit::Visitable` trait. |
This file contains 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
This file contains 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