UnionFind
PythonでのUnion-Find(素集合データ構造)の実装と使い方 / note.nkmk.me
素集合データ構造(Union-Find) / ei1333
Union Find の計算量 / 37zigen