add test for union-find algorithm