Commit 75abc8a9 authored by kristenk's avatar kristenk Committed by GitHub
Browse files

Merge pull request #4204 from grayjay/cycle-detection-comments

Add a comment to 'Distribution.Solver.Modular.Cycles.findCycles'.
parents efe1b211 4cd0d375
...@@ -56,10 +56,11 @@ findCycles pkg rdm = ...@@ -56,10 +56,11 @@ findCycles pkg rdm =
-- step and a slower calculation of the conflict set. -- step and a slower calculation of the conflict set.
-- --
-- 'hasCycle' checks for cycles incrementally by only looking for cycles -- 'hasCycle' checks for cycles incrementally by only looking for cycles
-- containing the current package. It searches for cycles in the 'RevDepMap', -- containing the current package, 'pkg'. It searches for cycles in the
-- which is the data structure used to store reverse dependencies in the -- 'RevDepMap', which is the data structure used to store reverse
-- search tree. We store the reverse dependencies in a map, because Data.Map -- dependencies in the search tree. We store the reverse dependencies in a
-- is smaller and/or has better sharing than Distribution.Compat.Graph. -- map, because Data.Map is smaller and/or has better sharing than
-- Distribution.Compat.Graph.
-- --
-- If there is a cycle, we call G.cycles to find a strongly connected -- If there is a cycle, we call G.cycles to find a strongly connected
-- component. Then we choose one cycle from the component to use for the -- component. Then we choose one cycle from the component to use for the
...@@ -79,6 +80,7 @@ findCycles pkg rdm = ...@@ -79,6 +80,7 @@ findCycles pkg rdm =
Just (n : _) -> G.nodeKey n Just (n : _) -> G.nodeKey n
_ -> findCyclesError "cannot find next node in the cycle" _ -> findCyclesError "cannot find next node in the cycle"
-- This function also assumes that all cycles contain 'pkg'.
oneCycle :: [QPN] oneCycle :: [QPN]
oneCycle = case iterate next pkg of oneCycle = case iterate next pkg of
[] -> findCyclesError "empty cycle" [] -> findCyclesError "empty cycle"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment