[Nauty] A question.
Sterten at aol.com
Sterten at aol.com
Thu Feb 17 08:15:01 EST 2005
//this is gautt.c (choose other name, if you want)
// see the printfs in lines 32ff below for what it does
//compile with:
//gcc -O2 -c gautt.c
//gcc gautt.o naugraph.o nautil.o nauty.o -O2 -o gautt.exe
// nauty is copyright by Brendan McKay, bdm at cs.anu.edu.au
#include <stdio.h>
#define MAXN 2700
#include "nauty.h"
char c[2700*2700];
graph g[MAXN*MAXM];
graph canong[MAXN*MAXM];
int main(int argc,char*argv[]) {
FILE *f1;
nvector lab[MAXN],ptn[MAXN],orbits[MAXN];
static DEFAULTOPTIONS(options);
statsblk(stats);
setword workspace[160*MAXM];
int x,y,z,i,j,n=12,m,v,gntk=0;
set *gv;
options.writeautoms = TRUE;
options.writeautoms = FALSE;
options.writemarkers = FALSE;
options.getcanon = TRUE;
options.defaultptn = TRUE;
options.digraph = TRUE;
if(argc<2){printf("\nusage: gautt file (g) \n\n");
printf("prints automorphismgroup for the (di-)graph in file\n");
printf("and writes it to stdout\n");
printf("prints generators also, when g is specified\n\n");
printf("graph-format: n*n entries from {0,1} of adjacency matrix ,\n");
printf(" other characters are ignored\n");exit(1);}
if((f1=fopen(argv[1],"rb"))==NULL){printf("file-error");exit(1);}
if(argc==3)options.writeautoms = TRUE;
i=0;in1:c[i]=fgetc(f1)-48;
if(c[i]==0 || c[i]==1)i++;if(feof(f1)==0)goto in1;
fclose(f1);n=0;while(n*n<=i)n++;n--;
m=(n+WORDSIZE-1)/WORDSIZE;
printf("%i entries of graph read with n=%i vertices , %i bytes per row
\n",i,n,m*WORDSIZE/8);
for(v=0;v<n;v++){
gv=GRAPHROW(g,v,m);
EMPTYSET(gv,m);
for(i=0;i<n;i++){
if(c[v*n+i])ADDELEMENT(gv,i);}
}
printf("calling nauty..\n");
nauty(g,lab,ptn,NILSET,orbits,&options,&stats,workspace,160*MAXM,m,n,canong);
j=stats.grpsize1;v=stats.grpsize2;
printf("size of automorphismgroup : %i\n",j);
}
/*
this file
01100
10010
10001
01001
00110
gives:
C:\>gautt reg5 g
32 entries of graph read with n=5 vertices , 4 bytes per row
calling nauty..
(1 2)(3 4)
(0 1)(2 3)
size of automorphismgroup : 10
Note, that you can add any comments into the file, as long as you don't use
too many
0s and 1s, (36-25=9 are allowed in this case) only the first n*n binary
entries are considered.
*/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.anu.edu.au/mailman/private/nauty/attachments/20050217/75cc33d3/attachment.html
More information about the Nauty
mailing list