Pick the fix
Why does a plain visited set wrongly report a loop for the dependencies 0→1, 0→2, 1→2?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Package 2 is reached twice by different paths, which looks like a revisit
Right: reaching a finished package again is not a loop.
Only reaching a package still on the current path proves a loop, which is what the in-progress state tracks.
Why not the others?
- B Package 0 has two dependencies. Several dependencies per package are normal.
- C The graph is not connected. It is connected, and that is not the issue.