Cycle in an undirected graph
Every edge goes both ways, so the edge back to where we came from doesn't count. Any other neighbour that is already visited was reached a second way: that's a cycle.
Every edge goes both ways, so the edge back to where we came from doesn't count. Any other neighbour that is already visited was reached a second way: that's a cycle.