Dynamic connectivity and grouping.
1 pages
One class. Memorise it verbatim — it's ~20 lines and it solves an entire category of graph problems that would otherwise need DFS plus bookkeeping.