#include "config.h" #if defined HAVE_LIBNAUTY && defined HAVE_NAUTY_NAUTUTIL_H #include "nauty/nausparse.h" #include "nauty/nautinv.h" #include "nautywrapper.h" static DEFAULTOPTIONS_GRAPH(opts_undir); static DEFAULTOPTIONS_DIGRAPH(opts_dir); typedef struct { int a,b; } pair; int pair_less(const void *p,const void *q) { return ((pair*)p)->a-((pair*)q)->a; } void color_graph(int n,int *lab,int *ptn,int *col) { pair *lst=(pair*)malloc(n*sizeof(pair)); for (int i=0;ia=col[i]; p->b=i; } qsort((void*)lst,(size_t)n,sizeof(pair),pair_less); for (int i=0;ib; ptn[i]=(i>=n-1 || p->a!=lst[i+1].a)?0:1; } free(lst); } int int_less(const void *p,const void *q) { return *(int*)p-*(int*)q; } int nautywrapper_words_needed(int n) { return SETWORDSNEEDED(n); } int nautywrapper_is_isomorphic(int isdir,int n,int *adj1,int *adj2,int *sigma) { DYNALLSTAT(int,lab1,lab1_sz); DYNALLSTAT(int,lab2,lab2_sz); DYNALLSTAT(int,ptn1,ptn1_sz); DYNALLSTAT(int,ptn2,ptn2_sz); DYNALLSTAT(int,col1,col1_sz); DYNALLSTAT(int,col2,col2_sz); DYNALLSTAT(int,orbits,orbits_sz); DYNALLSTAT(graph,g1,g1_sz); DYNALLSTAT(graph,g2,g2_sz); DYNALLSTAT(graph,cg1,cg1_sz); DYNALLSTAT(graph,cg2,cg2_sz); optionblk *options=isdir!=0?&opts_dir:&opts_undir; statsblk stats; int m=SETWORDSNEEDED(n); nauty_check(WORDSIZE,m,n,NAUTYVERSIONID); DYNALLOC1(int,lab1,lab1_sz,n,"malloc"); DYNALLOC1(int,lab2,lab2_sz,n,"malloc"); DYNALLOC1(int,ptn1,ptn1_sz,n,"malloc"); DYNALLOC1(int,ptn2,ptn2_sz,n,"malloc"); DYNALLOC1(int,col1,col1_sz,n,"malloc"); DYNALLOC1(int,col2,col2_sz,n,"malloc"); DYNALLOC1(int,orbits,orbits_sz,n,"malloc"); DYNALLOC2(graph,g1,g1_sz,n,m,"malloc"); EMPTYGRAPH(g1,m,n); DYNALLOC2(graph,g2,g2_sz,n,m,"malloc"); EMPTYGRAPH(g2,m,n); DYNALLOC2(graph,cg1,cg1_sz,n,m,"malloc"); DYNALLOC2(graph,cg2,cg2_sz,n,m,"malloc"); options->getcanon=TRUE; options->writeautoms=FALSE; options->outfile=NULL; options->defaultptn=FALSE; int i=0,j=0,k,read_col=1; /* create the first graph */ while (1) { if ((k=adj1[i++])==-1) { if ((++j)==n) break; read_col=1; } else if (read_col==1) { col1[j]=k; read_col=0; } else if (jgetcanon=FALSE; options->writeautoms=TRUE; options->linelength=RAND_MAX; options->outfile=f; options->defaultptn=FALSE; int i=0,j=0,k,read_col=1; /* create the graph */ while (1) { if ((k=adj[i++])==-1) { if ((++j)==n) break; read_col=1; } else if (read_col==1) { col[j]=k; read_col=0; } else if (jgetcanon=TRUE; options->writeautoms=FALSE; options->outfile=NULL; options->defaultptn=FALSE; int i=0,j=0,k,read_col=1; /* create the graph */ while (1) { if ((k=adj[i++])==-1) { if ((++j)==n) break; read_col=1; } else if (read_col==1) { col[j]=k; read_col=0; } else if (j int nautywrapper_is_isomorphic(int isdir,int n,int *adj1,int *adj2,int *sigma){ return 0; } void nautywrapper_aut_generators(int isdir,int n,int *adj,FILE *f){} void nautywrapper_canonical(int isdir,int n,int *adj,int *clab,unsigned long *cgrph,int *cols){ *clab=*cgrph=*cols=16; } #endif // HAVE_LIBNAUTY