Visualize how Union-Find builds connected components from a list of edges. Watch components merge as each edge is processed in O(E·α(N)) total time.
Given a list of undirected edges, DSU can find all connected components in O(E·α(N)) time. Each Union call merges two components, and at the end nodes sharing a root are in the same component.
Start with N singleton components (each node is its own root). Process each edge (u, v): if Find(u) ≠ Find(v), call Union(u, v) to merge their components. After all edges, nodes with the same root form a component.
In this visualizer each component gets a unique color. When two components merge, they share a single color. Watch colors consolidate as edges are processed.
Processing E edges takes O(E·α(N)) time, which is essentially linear for any practical graph.
Pick a preset edge list and click Run to watch components form edge by edge. Notice how the color groups evolve as unions are applied.