Detect dependency cycles beyond a depth = 2 #274
Merged
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.
Should resolve #191.
The previous implementation of
cyclic_deps()
only detected a dependency cycle when a dependency of aDistPackage
was dependent on thatDistPackage
(e.g. a -> b -> a). Sadly, this did not bid well when you have a cycle such as a -> b -> c -> d -> e -> a (i.e. it has a depth > 2 with "a" as the root).This CL reimplements it to use DFS, where we perform DFS on each
DistPackage
and just check to see if thisDistPackage
(think of it as the root node) was revisited (by comparing the current node's key that were are visiting to the root node's key).