code: public int[] getEquivalentClass(double[] weight) {
          double category[] = new double[weight.length];
          int equivalentClass[] = new int[weight.length];
          int i, j;
          int count = 1;
          double t;
          category[1] = weight[1];
          for (i = 2; i < weight.length; i++) {
              for (j = 1; j <= count; j++) {
                  t = weight[i] - category[j];
                  if (t < 0.0) {
                      t = -t;
                  }
                  if (t < LOST) {
                      break;
                  }
              }
              if (j > count) {
                  count += 1;
                  category[count] = weight[i];
              }
          }
  
          for (i = 1; i < weight.length; i++) {
              for (j = 1; j <= count; j++) {
                  t = weight[i] - category[j];
                  if (t < 0.0) {
                      t = -t;
                  }
                  if (t < LOST) {
                      equivalentClass[i] = j;
                  }
              }
          }
          equivalentClass[0] = count;
          return equivalentClass;
      }
docs: Get the final equivalent class.
  
  @param weight array contains weight of the nodes
  @return an array contains the automorphism partition