-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make topological sorting support fully cyclic dependencies (#678)
In case the graph of dependencies only consisted of a directed cycle, `sort_topologically` returned an empty list. This was an issue when trying to sort the dependencies of an environment containing Python 3.12 and Pip on MacOS as both depend on each other. Even though topological sorting theoretically requires a DAG as its input, the existing implementation of `sort_topologically` already handled directed cycles just not the case where all the nodes were part of such cycles. The fix is that if we can't find any root nodes, we start cycle detection from a random (the first in the given list) node.
- Loading branch information
1 parent
3f0c3ed
commit 75de1c9
Showing
1 changed file
with
65 additions
and
3 deletions.
There are no files selected for viewing
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