Mental Model
We want to find if a path loops back to a node already visited, showing a cycle.
Analogy: Imagine walking paths in a park. If you return to a spot you already visited without retracing your last step, you found a loop.
0 -> 1 -> 2 ↑ ↓ 4 ← 3 ← 5 Each arrow is a path connecting places (nodes).
