A cycle in a dependency graph means something can never finish, like two courses that require each other. In an undirected graph, DFS with a parent check or Union-Find detects cycles. In a directed graph a plain visited array gives false alarms, so you track which nodes are on the current DFS path. Use it to validate prerequisites, deadlock graphs or build dependencies before processing them.