concept disjoint set in category algorithms

appears as: disjoint sets, disjoint set, disjoint set, A disjoint set
Algorithms and Data Structures in Action

This is an excerpt from Manning's book Algorithms and Data Structures in Action.

Chapter 5 introduces a few alternative data structures used to keep track of disjoint sets, a cornerstone needed to build countless advanced algorithms and used in several practical real-world applications.

We will use a disjoint-set every time that, starting with a set of objects, we would like to account for the partitioning of this set into disjoint groups (i.e. subsets without any element in common between them), for instance: we might start with a list of wines, which would be the starting set, and we partition those wines depending on their flavor, creating a disjoint set where wines with a similar flavor are grouped together, and groups have no intersections with each other. Or, likewise, we could group food based on their nature and properties, grouping vegetables, fruit, processed food etc.: a trivial example of disjoint-set, shown in figure 5.1.

Figure 5.1 An example of a disjoint-set.
The whole set, the so-called Universe, is the set of “food”. Three partitions are shown: fruit, vegetables, and sweets. The key point is that these subsets have no intersections with each-other.

We will tackle this problem starting with its definition, then cover the most basic (and naïve) algorithms, to give readers an understanding of what an actual solution looks like; once that’s clear, we will be ready to delve into making our solutions more efficient, and show how to use it as part of more complex algorithms, so that by the end of the chapter you will be able to code up the best possible solution for disjoint sets, and employ it to improve the performance of higher level applications.

Listing 13.4 MapReduce canopy clustering
function MRcanopyClustering(points, T1, T2, numShards)            #1
  shards ← randomShard(points, numShards)                #2
  mappers ← initMappers(numShards, canopyClustering, shards)        #3
  reducers ← initReducers(1, canopyClustering)                #4
  centroids ← mapReduce(T1, T2, mappers, reducers)                 #5
  mappers.setMethod(classifyPoints)                    #6
  reducers ← initReducers(|centroids|, join)                #7
  canopies ← mapReduce(T1+T2, mappers, reducers)                #8
  return (canopies, centroids)                        #9