How do you detect cycles in an undirected graph?
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: easy
Interview Round: Other
Overview: Describe how to tell whether an undirected graph contains a cycle, and give the time and space cost of your method. Tests graph traversal, handling of disconnected components, self-loops and parallel edges, union-find, and how undirected cycle detection differs from the directed case.