Concept Flow - Cycle Detection in Undirected Graph
Start at any unvisited node
Mark node as visited
For each adjacent node
If adjacent not visited
Recurse DFS on adjacent
If adjacent visited and not parent
Cycle detected! Stop
No cycle found in this path
Repeat for all nodes
End: Cycle exists or not
Start DFS from each unvisited node, mark visited, check neighbors. If a visited neighbor is not parent, cycle exists.