Detect a cycle in an undirected graph — then handle edges arriving one by one, reporting for each whether it creates a cycle.
Detect a cycle in an undirected graph — then handle edges arriving one by one, reporting for each whether it creates a cycle.
The discussion opens with the full question.