code: private static List<Set<Integer>> enlargeAggregates(
                  List<Set<Integer>> C, List<Set<Integer>> N, boolean[] R) {
  
              // Contains the aggregates each node is coupled to
              List<List<Integer>> belong = new ArrayList<List<Integer>>(R.length);
              for (int i = 0; i < R.length; ++i)
                  belong.add(new ArrayList<Integer>());
  
              // Find which aggregate each node is coupled to. This is used for
              // the intersection between Ni and Ck
              for (int k = 0; k < C.size(); ++k)
                  for (int j : C.get(k))
                      belong.get(j).add(k);
  
              // Number of nodes in the intersection between each C and Ni
              int[] intersect = new int[C.size()];
  
              for (int i = 0; i < R.length; ++i) {
  
                  // Skip non-free nodes
                  if (!R[i])
                      continue;
  
                  // Find the number of nodes intersecting Ni and every C, and
                  // keep a track on the largest overlap
                  Arrays.fill(intersect, 0);
                  int largest = 0, maxValue = 0;
                  for (int j : N.get(i))
  
                      // The k-index is to an aggregate coupled to node j
                      for (int k : belong.get(j)) {
                          intersect[k]++;
                          if (intersect[k] > maxValue) {
                              largest = k;
                              maxValue = intersect[largest];
                          }
                      }
  
                  // Add the node to the proper C-set, and mark it as used
                  // Also, check if the node actually does couple to a set
                  if (maxValue > 0) {
                      R[i] = false;
                      C.get(largest).add(i);
                  }
              }
  
              return C;
          }
docs: Enlarges the aggregates