#ifndef _NAUTY_H_ /* only process this file once */ #define _NAUTY_H_
/* The parts between the ==== lines are modified by configure when creatingnauty.houtofnauty-h.in.Ifconfigureisnotbeingused, itisnecessarytochecktheyarecorrect.
====================================================================*/
/* Check whether various headers or options are available */ #define HAVE_UNISTD_H @header_unistd_h@ /* <unistd.h> */ #define HAVE_SYSTYPES_H @header_sys_types_h@ /* <sys/types.h> */ #define HAVE_STDDEF_H @header_stddef_h@ /* <stddef.h> */ #define HAVE_STDLIB_H @header_stdlib_h@ /* <stdlib.h> */ #define HAVE_STRING_H @header_string_h@ /* <string.h> */ #define HAVE_LIMITS_H @header_limits_h@ /* <limits.h> */ #define HAVE_STDINT_H @header_stdint_h@ /* <stdint.h> */ #define MALLOC_DEC @malloc_dec@ /* 1 = malloc() is declared in stdlib.h, */ /* 2 = in malloc.h, 0 = in neither place */ #define HAS_MATH_INF @has_math_inf@ /* INFINITY is defined in math.h or */ /* some system header likely to be used */ #define HAVE_FLOCKFILE @have_flockfile@ /* Whether flockfile() is available */ #define HAS_STDIO_UNLOCK @stdio_nolock@ /* Whether there are getc_unlocked, */ /* putc_unlocked,flockfile and funlockfile */
#define DEFAULT_WORDSIZE @default_wordsize@
/* Note that thread-local storage (TLS) is only useful for running nauty
in multiple threads and will slow it down a little otherwise. */ #define TLS_SUPPORTED @tls_supported@ /* Compiler supports thread-local */
/* If USE_TLS is defined, define TLS_ATTR to be the attribute name forTLSanddefineHAVE_TLS=1.OtherwisedefineTLS_ATTRtobeempty andHAVE_TLS=0.USE_TLScanbedefinedonthecommandlineorby
configuring with --enable-tls. */ #ifndef USE_TLS
@use_tls@ #endif #ifdef USE_TLS #if !TLS_SUPPORTED #error"TLS is requested but not available" #else #define TLS_ATTR @ac_cv_tls@ #define HAVE_TLS 1 #endif #else #define TLS_ATTR #define HAVE_TLS 0 #endif
#define USE_ANSICONTROLS @have_ansicontrols@ /* whether --enable-ansicontrols is used */ #define FLEX_ARRAY_OK @flex_array_ok@ /* whether the compiler supports flexible array members in structures */
/* Now we determine some sizes, relying on limits.h and stdint.hfirstincaseconfigurationwasnotdone. Noneofthesetestsareperfect,butsizeof()isnot allowedinpreprocessortests.Theprogramnautest.c
will check these. */
#ifndef MAXN /* maximum allowed n value; use 0 for dynamic sizing. */ #define MAXN 0 #define MAXM 0 #else #define MAXM ((MAXN+WORDSIZE-1)/WORDSIZE) /* max setwords in a set */ #endif/* MAXN */
/* Starting at version 2.2, set operations work for all set sizes unless ONE_WORD_SETSisdefined.Inthelattercase,ifMAXM=1,setops workonlyforsingle-setwordsets.Inanycase,macroversions endingwith1workforsingle-setwordsetsandversionsendingwith 0workforallsetsizes.
*/
#if WORDSIZE==16 #define SETWD(pos) ((pos)>>4) /* number of setword containing bit pos */ #define SETBT(pos) ((pos)&0xF) /* position within setword of bit pos */ #define TIMESWORDSIZE(w) ((w)<<4) #define SETWORDSNEEDED(n) ((((n)-1)>>4)+1) /* setwords needed for n bits */ #endif
#define NOTSUBSET(word1,word2) ((word1) & ~(word2)) /* test if the 1-bits
in setword word1 do not form a subset of those in word2 */ #define INTERSECT(word1,word2) ((word1) &= (word2)) /* AND word2 into word1 */ #defineUNION(word1,word2) ((word1) |= (word2)) /* OR word2 into word1 */ #define SETDIFF(word1,word2) ((word1) &= ~(word2)) /* - word2 into word1 */ #defineXOR(word1,word2) ((word1) ^= (word2)) /* XOR word2 into word1 */ #define ZAPBIT(word,x) ((word) &= ~BITT[x]) /* delete bit x in setword */ #define TAKEBIT(iw,w) {(iw) = FIRSTBITNZ(w); (w) ^= BITT[iw];}
#define SWHIBIT(w) ((w)&(-(w))) /* Lowest order bit of unsigned type */ #define REMOVEHIBIT(bit,w) {(bit) = SWHIBIT(w); (w) ^= (bit);} #define ATMOSTONEBIT(w) (((w)&(-(w)))==(w)) /* True if |w| <= 1 */ #define WITHOUTHIBIT(w) ((w)&((w)-1)) /* w without the lowest order bit */
/* POPCOUNT(x) = number of 1-bits in a setword x POPCOUNTMAC(x)=MacroversionofPOPCOUNT FIRSTBIT(x)=numberoffirst1-bitinnon-zerosetword(0..WORDSIZE-1) orWORDSIZEifx==0 FIRSTBITNZ(x)=asFIRSTBIT(x)butassumesxisnotzero BITMASK(x)=setwordwhoserightmostWORDSIZE-x-1(numbered)bits are1andtherest0(0<=x<WORDSIZE) (I.e.,bits0..xareunselectedandtherestselected.) Note:BITMASK(WORDSIZE)iserroneous!
ALLBITS = all (numbered) bits in a setword */
/* Now fall back on macros for things not defined */ #ifdefined(FIRSTBITNZ) && !defined(FIRSTBIT) #define FIRSTBIT(x) ((x) ? FIRSTBITNZ(x) : WORDSIZE) #else #ifndef FIRSTBITNZ #define FIRSTBITNZ FIRSTBITNZMAC #endif #ifndef FIRSTBIT #define FIRSTBIT FIRSTBITMAC #endif #endif
typedefstruct
{ double grpsize1; /* size of group is */
int grpsize2; /* grpsize1 * 10^grpsize2 */ #define groupsize1 grpsize1 /* for backwards compatibility */ #define groupsize2 grpsize2
int numorbits; /* number of orbits in group */
int numgenerators; /* number of generators found */
int errstatus; /* if non-zero : an error code */ #define outofspace errstatus; /* for backwards compatibility */ unsigned long numnodes; /* total number of nodes */ unsigned long numbadleaves; /* number of leaves of no use */
int maxlevel; /* maximum depth of search */ unsigned long tctotal; /* total size of all target cells */ unsigned long canupdates; /* number of updates of best label */ unsigned long invapplics; /* number of applications of invarproc */ unsigned long invsuccesses; /* number of successful uses of invarproc() */
int invarsuclevel; /* least level where invarproc worked */
} statsblk;
/* codes for errstatus field (see nauty.c for more accurate descriptions): */ /* 0 is normal - no error */ #define NTOOBIG 1/* n > MAXN or n > WORDSIZE*m */ #define MTOOBIG 2/* m > MAXM */ #define CANONGNIL 3/* canong = NULL, but getcanon = TRUE */ #define NAUABORTED 4/* nauty is terminated early under program control */ #define NAUKILLED 5/* nauty is terminated early by caught signal */
/* manipulation of real approximation to group size */ #define MULTIPLY(s1,s2,i) if ((s1 *= i) >= 1e10) {s1 /= 1e10; s2 += 10;}
struct optionstruct; /* incomplete definition */
typedefstruct
{
boolean (*isautom) /* test for automorphism */
(graph*,int*,boolean,int,int);
int (*testcanlab) /* test for better labelling */
(graph*,graph*,int*,int*,int,int); void (*updatecan) /* update canonical object */
(graph*,graph*,int*,int,int,int); void (*refine) /* refine partition */
(graph*,int*,int*,int,int*,int*,set*,int*,int,int); void (*refine1) /* refine partition, MAXM==1 */
(graph*,int*,int*,int,int*,int*,set*,int*,int,int);
boolean (*cheapautom) /* test for easy automorphism */
(int*,int,boolean,int);
int (*targetcell) /* decide which cell to split */
(graph*,int*,int*,int,int,boolean,int,int,int); void (*freedyn)(void); /* free dynamic memory */ void (*check) /* check compilation parameters */
(int,int,int,int); void (*init)(graph*,graph**,graph*,graph**,int*,int*,set*, struct optionstruct*,int*,int,int); void (*cleanup)(graph*,graph**,graph*,graph**,int*,int*, struct optionstruct*,statsblk*,int,int);
} dispatchvec;
typedefstruct optionstruct
{
int getcanon; /* make canong and canonlab? */ #define LABELONLY 2/* new value UNIMPLEMENTED */
boolean digraph; /* multiple edges or loops? */
boolean writeautoms; /* write automorphisms? */
boolean writemarkers; /* write stats on pts fixed, etc.? */
boolean defaultptn; /* set lab,ptn,active for single cell? */
boolean cartesian; /* use cartesian rep for writing automs? */
int linelength; /* max chars/line (excl. '\n') for output */
FILE *outfile; /* file for output, if any */ void (*userrefproc) /* replacement for usual refine procedure */
(graph*,int*,int*,int,int*,int*,set*,int*,int,int); void (*userautomproc) /* procedure called for each automorphism */
(int,int*,int*,int,int,int); void (*userlevelproc) /* procedure called for each level */
(int*,int*,int,int*,statsblk*,int,int,int,int,int,int); void (*usernodeproc) /* procedure called for each node */
(graph*,int*,int*,int,int,int,int,int,int);
int (*usercanonproc) /* procedure called for better labellings */
(graph*,int*,graph*,unsigned long,int,int,int); void (*invarproc) /* procedure to compute vertex-invariant */
(graph*,int*,int*,int,int,int,int*,int,boolean,int,int);
int tc_level; /* max level for smart target cell choosing */
int mininvarlevel; /* min level for invariant computation */
int maxinvarlevel; /* max level for invariant computation */
int invararg; /* value passed to (*invarproc)() */
dispatchvec *dispatch; /* vector of object-specific routines */
boolean schreier; /* use random schreier method */ void *extra_options; /* arbitrary extra options */ #ifdef NAUTY_IN_MAGMA
boolean print_stats; /* CAYLEY specfic - GYM Sep 1990 */
char *invarprocname; /* Magma - no longer global sjc 1994 */
int lab_h; /* Magma - no longer global sjc 1994 */
int ptn_h; /* Magma - no longer global sjc 1994 */
int orbitset_h; /* Magma - no longer global sjc 1994 */ #endif
} optionblk;
#ifndef CONSOLWIDTH #define CONSOLWIDTH 78 #endif
/* The following are obsolete. Just use NULL. */ #define NILFUNCTION ((void(*)())NULL) /* nil pointer to user-function */ #define NILSET ((set*)NULL) /* nil pointer to set */ #define NILGRAPH ((graph*)NULL) /* nil pointer to graph */
/* We hope that malloc, free, realloc are declared either in <stdlib.h> or<malloc.h>.Otherwisewewilldefinethem.Wealsoassumethat
size_t has been defined by the time we get to define malloc(). */ #ifndef NAUTY_IN_MAGMA #if MALLOC_DEC==2 #include <malloc.h> #endif #if MALLOC_DEC==0
extern void *malloc(size_t);
extern void *realloc(void*,size_t);
extern void free(void*); #endif #endif
/* ALLOCS(x,y) should return a pointer (any pointer type) to x*y units of new storage,notnecessarilyinitialised.A"unit"ofstorageisdefinedby thesizeofoperator.xandyareintegervaluesoftypeintorlarger, butx*ymaywellbetoolargeforanint.Themacroshouldcasttothe correcttypeforthecall.Onfailure,ALLOCS(x,y)shouldreturnaNULL pointer.FREES(p)shouldfreestoragepreviouslyallocatedbyALLOCS,
where p is the value that ALLOCS returned. */
/* The following macros are used by nauty if MAXN=0. They dynamically allocatearraysofsizedependentonmorn.Foreacharraythere shouldbetwostaticvariables: type*name; size_tname_sz; "name"willholdapointertoanallocatedarray."name_sz"willhold thesizeoftheallocatedarrayinunitsofsizeof(type).DYNALLSTAT declaresbothvariablesandinitialisesname_sz=0.DYNALLOC1and DYNALLOC2testifthereisenoughspaceallocated,andifnotfree theexistingspaceandallocateabiggerspace.Theallocatedspace isnotinitialised. InthecaseofDYNALLOC1,thespaceisallocatedusing ALLOCS(sz,sizeof(type)). InthecaseofDYNALLOC2,thespaceisallocatedusing ALLOCS(sz1,sz2*sizeof(type)).
#define DYNALLSTAT(type,name,name_sz) \ static TLS_ATTR type *name; static TLS_ATTR size_t name_sz=0 #define DYNALLOC1(type,name,name_sz,sz,msg) \
if ((size_t)(sz) > name_sz) \
{ if (name_sz) FREES(name); name_sz = (sz); \
if ((name=(type*)ALLOCS(sz,sizeof(type))) == NULL) {alloc_error(msg);}} #define DYNALLOC2(type,name,name_sz,sz1,sz2,msg) \
if ((size_t)(sz1)*(size_t)(sz2) > name_sz) \
{ if (name_sz) FREES(name); name_sz = (size_t)(sz1)*(size_t)(sz2); \
if ((name=(type*)ALLOCS((sz1),(sz2)*sizeof(type))) == NULL) \
{alloc_error(msg);}} #define DYNREALLOC(type,name,name_sz,sz,msg) \
{if ((size_t)(sz) > name_sz) \
{ if ((name = (type*)REALLOCS(name,(sz)*sizeof(type))) == NULL) \
{alloc_error(msg);} else name_sz = (sz);}} #define DYNFREE(name,name_sz) \
{ if (name) FREES(name); name = NULL; name_sz = 0;} #define CONDYNFREE(name,name_sz,minsz) \
if (name_sz > (size_t)(minsz)) {DYNFREE(name,name_sz);}
/* File to write error messages to (used as first argument to fprintf()). */ #define ERRFILE stderr
/* Don't use OLDEXTDEFS, it is only still here for Magma. */ #ifdef OLDEXTDEFS #define EXTDEF_CLASS #ifdef EXTDEFS #define EXTDEF_TYPE 1 #else #define EXTDEF_TYPE 2 #endif #else #define EXTDEF_CLASS static #define EXTDEF_TYPE 2 #endif
#ifndef NAUTY_IN_MAGMA /* Things equivalent to bit, bytecount, leftbit are defined
in bs.h for Magma. */ #if EXTDEF_TYPE==1
extern setword bit[];
extern int bytecount[];
extern int leftbit[];
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.