Skip to content

Commit

Permalink
Merge pull request #1 from msneddon/master
Browse files Browse the repository at this point in the history
patch to nauty for OSX nfsim compilation
  • Loading branch information
jjtapia committed Mar 22, 2015
2 parents c104f1d + bcfe181 commit a26c418
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 73 deletions.
8 changes: 4 additions & 4 deletions src/nauty24/nausparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ sortints(int *x, int n)

void
init_sg(graph *gin, graph **gout, graph *hin, graph **hout, int *lab,
int *ptn, set *active, struct optionstruct *options, int *status,
int *ptn, nset *active, struct optionstruct *options, int *status,
int m, int n)
{
sparsegraph *sg,*sh;
Expand Down Expand Up @@ -515,7 +515,7 @@ distvals(sparsegraph *g, int v0, shortish *dist, int n)

void
refine_sg(graph *g, int *lab, int *ptn, int level, int *numcells,
permutation *count, set *active, int *code, int m, int n)
permutation *count, nset *active, int *code, int m, int n)
{
int i,j,k,l,v1,v2,v3,isplit;
shortish w1,w2,w3;
Expand Down Expand Up @@ -1239,7 +1239,7 @@ sg_to_nauty(sparsegraph *sg, graph *g, int reqm, int *pm)
int *v,*d,*e;
int m,n,i,j,di;
int vi;
set *gi;
nset *gi;

SG_VDE(sg,v,d,e);
n = sg->nv;
Expand Down Expand Up @@ -1291,7 +1291,7 @@ nauty_to_sg(graph *g, sparsegraph *sg, int m, int n)
int i,j,k;
int di,nde;
long l;
set *gi;
nset *gi;

if (!sg)
{
Expand Down
4 changes: 2 additions & 2 deletions src/nauty24/nausparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ extern int targetcell_sg(graph*,int*,int*,int,int,boolean,int,int,int);
extern boolean cheapautom_sg(int*,int,boolean,int);
extern boolean isautom_sg(graph*,permutation*,boolean,int,int);
extern void
refine_sg(graph*,int*,int*,int,int*,permutation*,set*,int*,int,int);
refine_sg(graph*,int*,int*,int,int*,permutation*,nset*,int*,int,int);
extern int testcanlab_sg(graph*,graph*,int*,int*,int,int);
extern void updatecan_sg(graph*,graph*,permutation*,int,int,int);
extern void init_sg(graph*,graph**,graph*,graph**,int*,int*,set*,
extern void init_sg(graph*,graph**,graph*,graph**,int*,int*,nset*,
struct optionstruct*,int*,int,int);
extern void nausparse_freedyn(void);
extern void nausparse_check(int,int,int,int);
Expand Down
20 changes: 10 additions & 10 deletions src/nauty24/nautil.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int labelorg = 0;
*****************************************************************************/

int
nextelement(set *set1, int m, int pos)
nextelement(nset *set1, int m, int pos)
{
setword setwd;
int w;
Expand Down Expand Up @@ -141,7 +141,7 @@ nextelement(set *set1, int m, int pos)
*****************************************************************************/

void
permset(set *set1, set *set2, int m, permutation *perm)
permset(nset *set1, nset *set2, int m, permutation *perm)
{
setword setw;
int pos,w,b;
Expand Down Expand Up @@ -362,7 +362,7 @@ writeperm(FILE *f, permutation *perm, boolean cartesian, int linelength, int n)
*****************************************************************************/

void
fmperm(permutation *perm, set *fix, set *mcr, int m, int n)
fmperm(permutation *perm, nset *fix, nset *mcr, int m, int n)
{
int i,k,l;

Expand Down Expand Up @@ -408,7 +408,7 @@ fmperm(permutation *perm, set *fix, set *mcr, int m, int n)
*****************************************************************************/

void
fmptn(int *lab, int *ptn, int level, set *fix, set *mcr, int m, int n)
fmptn(int *lab, int *ptn, int level, nset *fix, nset *mcr, int m, int n)
{
int i,lmin;

Expand Down Expand Up @@ -459,8 +459,8 @@ fmptn(int *lab, int *ptn, int level, set *fix, set *mcr, int m, int n)

void
doref(graph *g, int *lab, int *ptn, int level, int *numcells,
int *qinvar, permutation *invar, set *active, int *code,
void (*refproc)(graph*,int*,int*,int,int*,permutation*,set*,int*,int,int),
int *qinvar, permutation *invar, nset *active, int *code,
void (*refproc)(graph*,int*,int*,int,int*,permutation*,nset*,int*,int,int),
void (*invarproc)(graph*,int*,int*,int,int,int,permutation*,
int,boolean,int,int),
int mininvarlev, int maxinvarlev, int invararg,
Expand Down Expand Up @@ -567,7 +567,7 @@ doref(graph *g, int *lab, int *ptn, int level, int *numcells,
*****************************************************************************/

void
maketargetcell(graph *g, int *lab, int *ptn, int level, set *tcell,
maketargetcell(graph *g, int *lab, int *ptn, int level, nset *tcell,
int *tcellsize, int *cellpos, int tc_level, boolean digraph,
int hint,
int (*targetcell)(graph*,int*,int*,int,int,boolean,int,int,int),
Expand Down Expand Up @@ -595,7 +595,7 @@ maketargetcell(graph *g, int *lab, int *ptn, int level, set *tcell,
*****************************************************************************/

void
shortprune(set *set1, set *set2, int m)
shortprune(nset *set1, nset *set2, int m)
{
int i;

Expand All @@ -616,7 +616,7 @@ shortprune(set *set1, set *set2, int m)

void
breakout(int *lab, int *ptn, int level, int tc, int tv,
set *active, int m)
nset *active, int m)
{
int i,prev,next;

Expand Down Expand Up @@ -649,7 +649,7 @@ breakout(int *lab, int *ptn, int level, int tc, int tv,
*****************************************************************************/

void
longprune(set *tcell, set *fix, set *bottom, set *top, int m)
longprune(nset *tcell, nset *fix, nset *bottom, nset *top, int m)
{
int i;

Expand Down
54 changes: 27 additions & 27 deletions src/nauty24/nauty.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
typedef struct tcnode_struct
{
struct tcnode_struct *next;
set *tcellptr;
nset *tcellptr;
} tcnode;

/* aproto: header new_nauty_protos.h */
Expand Down Expand Up @@ -149,18 +149,18 @@ static int gca_first, /* level of greatest common ancestor of current
static boolean needshortprune; /* used to flag calls to shortprune */

#if !MAXN
DYNALLSTAT(set,defltwork,defltwork_sz);
DYNALLSTAT(nset,defltwork,defltwork_sz);
DYNALLSTAT(permutation,workperm,workperm_sz);
DYNALLSTAT(set,fixedpts,fixedpts_sz);
DYNALLSTAT(nset,fixedpts,fixedpts_sz);
DYNALLSTAT(permutation,firstlab,firstlab_sz);
DYNALLSTAT(permutation,canonlab,canonlab_sz);
DYNALLSTAT(short,firstcode,firstcode_sz);
DYNALLSTAT(short,canoncode,canoncode_sz);
DYNALLSTAT(shortish,firsttc,firsttc_sz);
DYNALLSTAT(set,active,active_sz);
DYNALLSTAT(nset,active,active_sz);

/* In the dynamically allocated case (MAXN=0), each level of recursion
needs one set (tcell) to represent the target cell. This is
needs one nset (tcell) to represent the target cell. This is
implemented by using a linked list of tcnode anchored at the root
of the search tree. Each node points to its child (if any) and to
the dynamically allocated tcell. Apart from the the first node of
Expand All @@ -172,22 +172,22 @@ static tcnode tcnode0 = {NULL,NULL};
static int alloc_m = 0;

#else
static set defltwork[2*MAXM]; /* workspace in case none provided */
static nset defltwork[2*MAXM]; /* workspace in case none provided */
static permutation workperm[MAXN]; /* various scratch uses */
static set fixedpts[MAXM]; /* points which were explicitly
static nset fixedpts[MAXM]; /* points which were explicitly
fixed to get current node */
static permutation firstlab[MAXN], /* label from first leaf */
canonlab[MAXN]; /* label from bsf leaf */
static short firstcode[MAXN+2], /* codes for first leaf */
canoncode[MAXN+2]; /* codes for bsf leaf */
static shortish firsttc[MAXN+2]; /* index of target cell for left path */
static set active[MAXM]; /* used to contain index to cells now
static nset active[MAXM]; /* used to contain index to cells now
active for refinement purposes */
#endif

static set *workspace,*worktop; /* first and just-after-last addresses of
static nset *workspace,*worktop; /* first and just-after-last addresses of
work area to hold automorphism data */
static set *fmptr; /* pointer into workspace */
static nset *fmptr; /* pointer into workspace */


/*****************************************************************************
Expand All @@ -201,16 +201,16 @@ static set *fmptr; /* pointer into workspace */
* Parameters - <r> means read-only, <w> means write-only, <wr> means both: *
* g <r> - the graph *
* lab,ptn <rw> - used for the partition nest which defines the colouring *
* of g. The initial colouring will be set by the program, *
* of g. The initial colouring will be nset by the program, *
* using the same colour for every vertex, if *
* options->defaultptn!=FALSE. Otherwise, you must set it *
* options->defaultptn!=FALSE. Otherwise, you must nset it *
* yourself (see the Guide). If options->getcanon!=FALSE, *
* the contents of lab on return give the labelling of g *
* corresponding to canong. This does not change the *
* initial colouring of g as defined by (lab,ptn), since *
* the labelling is consistent with the colouring. *
* active <r> - If this is not NULL and options->defaultptn==FALSE, *
* it is a set indicating the initial set of active colours. *
* it is a nset indicating the initial nset of active colours. *
* See the Guide for details. *
* orbits <w> - On return, orbits[i] contains the number of the *
* least-numbered vertex in the same orbit as i, for *
Expand All @@ -235,9 +235,9 @@ static set *fmptr; /* pointer into workspace */
*****************************************************************************/

void
nauty(graph *g_arg, int *lab, int *ptn, set *active_arg,
nauty(graph *g_arg, int *lab, int *ptn, nset *active_arg,
int *orbits_arg, optionblk *options, statsblk *stats_arg,
set *ws_arg, int worksize, int m_arg, int n_arg, graph *canong_arg)
nset *ws_arg, int worksize, int m_arg, int n_arg, graph *canong_arg)
{
int i;
int numcells;
Expand Down Expand Up @@ -328,9 +328,9 @@ nauty(graph *g_arg, int *lab, int *ptn, set *active_arg,
OPTCALL(dispatch.check)(WORDSIZE,m,n,NAUTYVERSIONID);

#if !MAXN
DYNALLOC1(set,defltwork,defltwork_sz,2*m,"nauty");
DYNALLOC1(set,fixedpts,fixedpts_sz,m,"nauty");
DYNALLOC1(set,active,active_sz,m,"nauty");
DYNALLOC1(nset,defltwork,defltwork_sz,2*m,"nauty");
DYNALLOC1(nset,fixedpts,fixedpts_sz,m,"nauty");
DYNALLOC1(nset,active,active_sz,m,"nauty");
DYNALLOC1(permutation,workperm,workperm_sz,n,"nauty");
DYNALLOC1(permutation,firstlab,firstlab_sz,n,"nauty");
DYNALLOC1(permutation,canonlab,canonlab_sz,n,"nauty");
Expand Down Expand Up @@ -504,7 +504,7 @@ nauty(graph *g_arg, int *lab, int *ptn, set *active_arg,
* *
* firstpathnode(lab,ptn,level,numcells) produces a node on the leftmost *
* path down the tree. The parameters describe the level and the current *
* colour partition. The set of active cells is taken from the global set *
* colour partition. The nset of active cells is taken from the global nset *
* 'active'. If the refined partition is not discrete, the leftmost child *
* is produced by calling firstpathnode, and the other children by calling *
* othernode. *
Expand All @@ -530,22 +530,22 @@ firstpathnode(int *lab, int *ptn, int level, int numcells)
int tv;
int tv1,index,rtnlevel,tcellsize,tc,childcount,qinvar,refcode;
#if !MAXN
set *tcell;
nset *tcell;
tcnode *tcnode_this;

tcnode_this = tcnode_parent->next;
if (tcnode_this == NULL)
{
if ((tcnode_this = (tcnode*)ALLOCS(1,sizeof(tcnode))) == NULL ||
(tcnode_this->tcellptr
= (set*)ALLOCS(alloc_m,sizeof(set))) == NULL)
= (nset*)ALLOCS(alloc_m,sizeof(nset))) == NULL)
alloc_error((char *)"tcell");
tcnode_parent->next = tcnode_this;
tcnode_this->next = NULL;
}
tcell = tcnode_this->tcellptr;
#else
set tcell[MAXM];
nset tcell[MAXM];
#endif

++stats->numnodes;
Expand Down Expand Up @@ -654,7 +654,7 @@ firstpathnode(int *lab, int *ptn, int level, int numcells)
* *
* othernode(lab,ptn,level,numcells) produces a node other than an ancestor *
* of the first leaf. The parameters describe the level and the colour *
* partition. The list of active cells is found in the global set 'active'. *
* partition. The list of active cells is found in the global nset 'active'. *
* The value returned is the level to return to. *
* *
* FUNCTIONS CALLED: (*usernodeproc)(),doref(),refine(),recover(), *
Expand All @@ -675,22 +675,22 @@ othernode(int *lab, int *ptn, int level, int numcells)
int tv1,refcode,rtnlevel,tcellsize,tc,qinvar;
short code;
#if !MAXN
set *tcell;
nset *tcell;
tcnode *tcnode_this;

tcnode_this = tcnode_parent->next;
if (tcnode_this == NULL)
{
if ((tcnode_this = (tcnode*)ALLOCS(1,sizeof(tcnode))) == NULL ||
(tcnode_this->tcellptr
= (set*)ALLOCS(alloc_m,sizeof(set))) == NULL)
= (nset*)ALLOCS(alloc_m,sizeof(nset))) == NULL)
alloc_error((char *)"tcell");
tcnode_parent->next = tcnode_this;
tcnode_this->next = NULL;
}
tcell = tcnode_this->tcellptr;
#else
set tcell[MAXM];
nset tcell[MAXM];
#endif

#ifdef NAUTY_IN_MAGMA
Expand Down Expand Up @@ -734,7 +734,7 @@ othernode(int *lab, int *ptn, int level, int numcells)
}

tc = -1;
/* If children will be required, find new target cell and set tc to its
/* If children will be required, find new target cell and nset tc to its
position in lab, tcell to its contents, and tcellsize to its size: */

if (numcells < n && (eqlev_first == level ||
Expand Down
Loading

0 comments on commit a26c418

Please sign in to comment.