Processes take locks one at a time and hold them while they wait for more. If each waits for a lock the next one holds, round in a circle, none can ever move: a deadlock. Drawing who holds what and who waits for what as a graph turns spotting one into finding a cycle.