Cadence Design Systems interview question

How to detect cycles in a undirected graph using the union-find data structure?