def countComponents(self, n, edges):
        union_find = UnionFind(n)
        for i, j in edges:
            union_find.union_set(i, j)
        return union_find.count
:type n: int
dataset/ETHPy150Open kamyu104/LeetCode/Python/number-of-connected-components-in-an-undirected-graph.py/Solution.countComponents