code: public int[] findTopoEquivClass(double[] weight) {
          int trialCount, i;
          int equivalentClass[] = new int[weight.length];
          int count = checkDiffNumber(weight);
          trialCount = count;
          if (count == nodeNumber) {
              for (i = 1; i <= nodeNumber; i++) {
                  equivalentClass[i] = i;
              }
              equivalentClass[0] = count;
              return equivalentClass;
          }
          do {
              count = trialCount;
              double[][] trialNodeMatrix = buildTrialNodeMatrix(weight);
              double[] trialWeight = buildWeightMatrix(trialNodeMatrix, bondMatrix);
              trialCount = checkDiffNumber(trialWeight);
              if (trialCount == nodeNumber) {
                  for (i = 1; i <= nodeNumber; i++) {
                      equivalentClass[i] = i;
                  }
                  equivalentClass[0] = count;
                  return equivalentClass;
              }
              if (trialCount <= count) {
                  equivalentClass = getEquivalentClass(weight);
                  return equivalentClass;
              }
          } while (trialCount > count);
          return equivalentClass;
      }
docs: Find the topological equivalent class for the given weight.
  
  @param weight array contains weight of the nodes
  @return an array contains the automorphism partition