DisjointSet and UnionFind pure Python classes with linking by weight, rank, value, cross, random linking. Path compression, splitting, halving.
Use cases:
http://www.spoj.com/problems/SOCNETC/
http://www.spoj.com/problems/PT07Y/
http://www.spoj.com/problems/FOXLINGS/
http://www.spoj.com/problems/FRNDCIRC/
http://www.spoj.com/problems/IAPCR2F/
http://www.spoj.com/problems/MST/
http://www.spoj.com/problems/CSTREET/
http://www.spoj.com/problems/BLINNET/
http://www.spoj.com/problems/HERDING/
http://www.spoj.com/problems/ADABANKET/
http://www.spoj.com/problems/IITWPC4I/
https://www.hackerrank.com/challenges/merging-communities/problem
https://www.hackerrank.com/challenges/components-in-graph/problem
https://www.hackerrank.com/challenges/kundu-and-tree/problem
https://www.hackerrank.com/challenges/kruskalmstrsub/problem
https://www.hackerrank.com/challenges/journey-to-the-moon/problem