code: public Partition getAutomorphismPartition() {
          final int n = group.getSize();
          final DisjointSetForest forest = new DisjointSetForest(n);
          group.apply(new PermutationGroup.Backtracker() {
  
              boolean[]       inOrbit      = new boolean[n];
              private int     inOrbitCount = 0;
              private boolean isFinished;
  
              @Override
              public boolean isFinished() {
                  return isFinished;
              }
  
              @Override
              public void applyTo(Permutation p) {
                  for (int elementX = 0; elementX < n; elementX++) {
                      if (inOrbit[elementX]) {
                          continue;
                      } else {
                          int elementY = p.get(elementX);
                          while (elementY != elementX) {
                              if (!inOrbit[elementY]) {
                                  inOrbitCount++;
                                  inOrbit[elementY] = true;
                                  forest.makeUnion(elementX, elementY);
                              }
                              elementY = p.get(elementY);
                          }
                      }
                  }
                  if (inOrbitCount == n) {
                      isFinished = true;
                  }
              }
          });
  
          // convert to a partition
          Partition partition = new Partition();
          for (int[] set : forest.getSets()) {
              partition.addCell(set);
          }
  
          // necessary for comparison by string
          partition.order();
          return partition;
      }
docs: The automorphism partition is a partition of the elements of the group.
  
  @return a partition of the elements of group