static int backtrack_leftmost(struct saucy *s) { int rep = find_representative(s->indmin, s->theta); int repsize = s->thsize[rep]; int min = -1; pick_all_the_pairs(s); clear_undiffnons(s); s->ndiffs = s->nundiffs = s->npairs = s->ndiffnons = 0; if (repsize != s->right.clen[s->start[s->lev]]+1) { min = theta_prune(s); } if (min == -1) { multiply_index(s, repsize); } 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); }