/// <summary>
        /// Merges the small outlier clusters with nearby larger clusters.
        /// </summary>
        /// <returns>The number of outlier clusters merged.</returns>
        /// <param name="maxOutlierMergeDistance">An outlier will only be merged if its distance from
        /// its nearest cluster does not exceed this square distance.</param>
        public int MergeOutliers(long maxOutlierMergeDistance)
        {
            var mergesDone        = 0;
            var cc                = new ClosestCluster <string>(Clusters);
            var closeOutlierPairs = cc.FindClosestOutliers(
                MaxNeighborsToCompare,
                maxOutlierMergeDistance,
                OutlierSize
                );

            foreach (var pair in closeOutlierPairs)
            {
                pair.Relabel(Clusters);
                // We do not want an outlier to cause the merger of two large clusters
                // if each of the large clusters is near the outlier but not near each other.
                // Thus, once the outlier is merged with the nearer of its neighbors,
                // it will be ruled out from firther merges.
                if (pair.CountOutliers(Clusters, OutlierSize) != 1)
                {
                    continue;
                }
                if (Clusters.Merge(pair.Color1, pair.Color2))
                {
                    mergesDone++;
                }
            }
            return(mergesDone);
        }
        /// <summary>
        /// Merges the outliers to their nearest neighboring large cluster.
        /// In this case, any cluster smaller than UnmergeableSize is considered an outlier.
        /// </summary>
        private void MergeOutliers()
        {
            var cc = new ClosestCluster <string>(Clusters);

            foreach (var cp in cc.FindClosestOutliers(Clusters.NumPartitions, long.MaxValue, UnmergeableSize))
            {
                Merge(cp.Point1, cp.Point2);
            }
        }