Add DisjointSets::merge_all() function with test