static int backtrack_other(struct saucy *s) { int cf = s->start[s->lev]; int cb = cf + s->right.clen[cf]; int spec = s->specmin[s->lev]; int min; /* Avoid using pairs until we get back to leftmost. */ pick_all_the_pairs(s); clear_undiffnons(s); s->npairs = s->ndiffnons = -1; if (s->right.lab[cb] == spec) { min = find_min(s, cf); if (min == cb) { min = orbit_prune(s); } else { min -= cf; } } else { min = orbit_prune(s); if (min != -1 && s->right.lab[min + cf] == spec) { swap_labels(&s->right, min + cf, cb); min = orbit_prune(s); } } return min; }
static void backtrack(struct saucy_stats *stats) { int i, j, k, t, indx, lastnon; /* Keep backtracking for a while */ do { /* Back up from this spot to our ancestor with zeta */ for (--lev; lev > 0; --lev) { BCLEAR(bit_fixed, fixed[lev]); if (flag && (lev > anc)) continue; break; } /* If we're at the top, quit */ if (!lev) return; /* Update ancestor with zeta if we've rewound more */ if (anc > lev) { anc = lev; indmin = fixed[lev]; } /* Recover the partition nest to this level */ for (i = j = cells = 0, lastnon = -1; i < n; j = ++i) { /* Rewind ptn */ while (ptn[i] > lev) { ptn[i] = n+1; cfront[lab[i++]] = j; } /* We're at the end of a cell */ ++cells; if (i == j) continue; /* Update lengths and fronts */ clen[j] = i-j; cfront[lab[i]] = j; /* Update the nonsingleton list */ prevnon[j] = lastnon; nextnon[lastnon] = j; lastnon = j; } /* Fix the end of the nonsingleton list */ prevnon[n] = lastnon; nextnon[lastnon] = n; /* If we're at our gca with zeta, orbit prune with theta */ if (lev == anc) theta_prune(); else orbit_prune(); /* Compute |Aut(G)| found so far */ if ((target_min == n+1) && (anc == lev)) { indx = 0; i = start[lev] - 1; /* Find factor */ do { /* Find lab[i]'s minimum cell representative */ for (j = lab[++i]; j != theta[j]; j = theta[j]); k = lab[i]; while (theta[k] != j) { t = theta[k]; theta[k] = j; k = t; } /* If it is the fixed value, then increment */ if (j == indmin) ++indx; } while (ptn[i] > lev); /* Update size */ MULTIPLY(stats->grpsize_base, stats->grpsize_exp, indx); } } /* Quit when there's something left in the target */ while (target_min == n+1); }