replace indexing by enumeration
convert to common parents dict
build merged adj for any number of modes
mv pairwise merging to merge_partition_pair
iteratively merge partitions
mv consistency check from merge_partition_pair to its own loop
update merge_partition_pairs to be compatible with merge_partitions
bugfix: introduced in 94c7b4ab2085676de2c93d496977a2aa7325d92e