Stage 2: constructing global lableing.

Implemented the 2nd (of 4) stage of the algorithm - get the global
labeling of the clusters.
The next step is to merge clusters using this global labeling.