static int trythisone(grouprec *group, int ne, int n) { int i,k; boolean accept; first = TRUE; ADDBIG(ngen,1); nix = ne; newgroupsize = 1; if (!group || groupsize == 1) accept = TRUE; else if (lastrejok && !ismax(lastreject,n)) accept = FALSE; else if (lastrejok && groupsize == 2) accept = TRUE; else { newgroupsize = 1; if (allgroup2(group,testmax) == 0) accept = TRUE; else accept = FALSE; } if (accept) { #ifdef GROUPTEST if (groupsize % newgroupsize != 0) gt_abort("group size error\n"); totallab += groupsize/newgroupsize; #endif ADDBIG(nout,1); if (outfile) { fprintf(outfile,"%d %ld",n,ne); if (Gswitch) fprintf(outfile," %lu",newgroupsize); for (i = -1; (i = nextelement(x,me,i)) >= 0; ) { k = i >> 1; if (i & 1) fprintf(outfile," %d %d",v1[k],v0[k]); else fprintf(outfile," %d %d",v0[k],v1[k]); } fprintf(outfile,"\n"); } return MAXNE+1; } else return rejectlevel;
static void genextend(graph *g, int n2, int *deg, int ne, boolean rigid, int xlb, int xub) /* extend from n2 to n2+1 */ { int x,y,d; int *xorb,xc; int nx,i,j,imin,imax,dmax; int xlbx,xubx,n; graph gx[MAXN]; int degx[MAXN]; boolean rigidx; int dneed,need,nfeet,hideg,deg1,ft[MAXN],nfrag,frag[MAXN]; #ifdef INSTRUMENT boolean haschild; haschild = FALSE; ++nodes[n2]; if (rigid) ++rigidnodes[n2]; #endif n = n1 + n2; nx = n2 + 1; dmax = deg[n-1]; d = 0; dneed = mindeg1 - maxn2 + n2; need = 0; hideg = 0; deg1 = 0; for (i = 0; i < n1; ++i) { if (deg[i] == maxdeg1) d |= xbit[i]; if (deg[i] <= dneed) need |= xbit[i]; if (deg[i] >= 2) hideg |= xbit[i]; if (deg[i] == 1) deg1 |= xbit[i]; } if (xlb < XPOPCOUNT(need)) xlb = XPOPCOUNT(need); if (xlb > xub) return; imin = xstart[xlb]; imax = xstart[xub+1]; xorb = data[n2].xorb; if (nx == maxn2) { if (footfree) { nfeet = 0; for (j = 0; j < n2; ++j) { x = xval[j] & hideg; IFLE1BITS(x) ft[nfeet++] = xval[j] & deg1; } } if (cutfree) fragments(xval,n2,frag,&nfrag); for (i = imin; i < imax; ++i) { if (!rigid && xorb[i] != i) continue; x = xset[i]; xc = xcard[i]; if ((x & d) != 0) continue; if ((need & ~x) != 0) continue; if (simple) { for (j = n2; --j >= 0;) if (x == xval[j]) break; if (j >= 0) continue; } if (maxcommon >= 0) { for (j = n2; --j >= 0;) { y = x & xval[j]; if (XPOPCOUNT(y) > maxcommon) break; } if (j >= 0) continue; } if (antichain) { for (j = 0; j < n2; ++j) if ((xval[j] & ~x) == 0) break; if (j < n2) continue; } if (footfree) { y = x & (hideg | deg1); IFLE1BITS(y) continue; for (j = 0; j < nfeet; ++j) if ((x & ft[j]) == 0) break; if (j < nfeet) continue; } if (cutfree) { y = x & (hideg | deg1); IFLE1BITS(y) continue; for (j = 0; j < nfrag; ++j) if ((x & frag[j]) == 0) break; if (j < nfrag) continue; } xval[n2] = x; if (nx == nprune) { if (curres == 0) curres = mod; #ifdef SPLITTEST --curres; ++splitcases; continue; #else if (--curres != 0) continue; #endif } if (accept2(g,n2,x,gx,deg,xc > dmax)) if (!connec || isconnected(gx,n+1)) { ADDBIG(ecount[ne+xc],1); #ifdef INSTRUMENT haschild = TRUE; #endif (*outproc)(outfile,canonise ? gcan : gx,n1,n2+1); } } } else { for (i = imin; i < imax; ++i)
static void genextend(graph *g, int n, int *deg, boolean rigid) /* extend from n to n+1 -- version for general graphs */ { xword x,dlow,dhigh,dcrit; xword *xset,*xcard,*xorb; xword i,imin,imax; int nx,xc,j,dmax; int xlb,xub,xlbx,xubx; graph gx[MAXN]; int degx[MAXN]; boolean rigidx; boolean subconnec; #ifdef INSTRUMENT boolean haschild; haschild = FALSE; if (rigid) ++rigidnodes[n]; #endif nx = n + 1; ADDBIG(nodes[n],1); if (regular && nx == maxn) { x = 0; for (i = 0; i < n; ++i) if (deg[i] == maxdeg) x |= xbit[i]; if (accept2(g,n,x,gx,deg,FALSE)) { #ifdef PRUNE if (!PRUNE(gx,nx,maxn)) #endif { #ifdef INSTRUMENT haschild = TRUE; #endif ADDBIG(nout,1); (*outproc)(outfile,canonise ? gcan : gx,nx); } } #ifdef INSTRUMENT if (haschild) ++fertilenodes[n]; #endif return; } dmax = deg[n-1]; xlb = mindeg + n + 1 - maxn; if (0 > xlb) xlb = 0; xub = dmax+1; if (n/2 < xub) xub = n/2; if (maxdeg < xub) xub = maxdeg; if (xlb > xub) return; dlow = dcrit = dhigh = 0; for (i = 0; i < n; ++i) { if (deg[i] == dmax) dlow |= xbit[i]; if (deg[i] == maxdeg) dhigh |= xbit[i]; if (deg[i] == mindeg + n - maxn) dcrit |= xbit[i]; } if (XPOPCOUNT(dhigh) > xlb) xlb = XPOPCOUNT(dhigh); if (n-XPOPCOUNT(dcrit) < xub) xub = n - XPOPCOUNT(dcrit); if (xub == dmax+1 && XPOPCOUNT(dlow)+dmax >= n) --xub; if (xlb > xub) return; #ifdef PRUNE if (PRUNE(g,n,maxn)) return; #endif imin = data[n].xstart[xlb]; imax = data[n].xstart[xub+1]; xset = data[n].xset; xcard = data[n].xcard; xorb = data[n].xorb; if (nx == maxn) { subconnec = connec && isstrong(g,n); for (i = imin; i < imax; ++i) { if (!rigid && xorb[i] != i) continue; x = xset[i]; xc = xcard[i]; if (xc == dmax+1 && (x & dlow) != 0) continue; if ((dhigh & ~x) != 0) continue; if ((dcrit & x) != 0) continue; if (accept2(g,n,x,gx,deg, xc < dmax || (xc == dmax && (x & dlow) == 0))) if (!connec || (subconnec && x != 0) || isstrong(gx,nx)) { #ifdef PRUNE if (!PRUNE(gx,nx,maxn)) #endif { #ifdef INSTRUMENT haschild = TRUE; #endif ADDBIG(nout,1); (*outproc)(outfile,canonise ? gcan : gx,nx); } } } } else { for (i = imin; i < imax; ++i) { if (!rigid && xorb[i] != i) continue; x = xset[i]; xc = xcard[i]; if (xc == dmax+1 && (x & dlow) != 0) continue; if ((dhigh & ~x) != 0) continue; if ((dcrit & x) != 0) continue; if (nx == splitlevel) { if (odometer-- != 0) continue; odometer = mod - 1; } for (j = 0; j < n; ++j) degx[j] = deg[j]; xlbx = mindeg+nx+1-maxn; if (xlbx < 0) xlbx = 0; xubx = xc + 1; if (maxdeg < xubx) xubx = maxdeg; if (nx/2 < xubx) xubx = nx/2; if (xlbx > xubx) continue; data[nx].lo = data[nx].xstart[xlbx]; data[nx].hi = data[nx].xstart[xubx+1]; if (accept1(g,n,x,gx,degx,&rigidx)) { #ifdef INSTRUMENT haschild = TRUE; #endif genextend(gx,nx,degx,rigidx); } } } if (n == splitlevel-1 && n >= min_splitlevel && ISASBIG(nodes[n],multiplicity)) --splitlevel; #ifdef INSTRUMENT if (haschild) ++fertilenodes[n]; #endif }