2,80c2,80
< *                                                                            *
< * This is the main file for dreadnaut() version 2.2, which is a test-bed     *
< *   for nauty() version 2.2.                                                 *
< *                                                                            *
< *   Copyright (1984-2004) Brendan McKay.  All rights reserved.               *
< *   Subject to the waivers and disclaimers in nauty.h.                       *
< *                                                                            *
< *   CHANGE HISTORY                                                           *
< *       10-Nov-87 : final changes for version 1.2                            *
< *        5-Dec-87 - replaced all uses of fscanf() by appropriate uses        *
< *                   of the new procedures readinteger() and readstring()     *
< *                 - changed the '<' command slightly.  If a file of the      *
< *                   given name cannot be openned, an attempt is made to      *
< *                   open a file with the same name extended by DEFEXT.       *
< *                 - improved error processing for 'n' command.               *
< *       28-Sep-88 : changes for version 1.4 :                                *
< *                 - replaced incorrect %d by %ld in fprintf for ? command    *
< *       23-Mar-89 : changes for version 1.5 :                                *
< *                 - added optional startup message                           *
< *                 - enabled use of refine1 in 'i' command                    *
< *                 - implemented $$ command                                   *
< *                 - replaced ALLOCS test by DYNALLOC test                    *
< *                 - modified @ command and added # command                   *
< *                 - declared local procedures static                         *
< *       25-Mar-89 - implemented k command                                    *
< *       27-Mar-89 - implemented * and I commands                             *
< *       29-Mar-89 - implemented K command                                    *
< *        2-Apr-89 - added reporting of vertex-invariant statistics           *
< *        2-Apr-89 - added ## command                                         *
< *        4-Apr-89 - added triples(), quadruples(), adjtriang()               *
< *                 - updated error reporting for nauty()                      *
< *        5-Apr-89 - removed flushline() from g and e commands                *
< *                 - added T command                                          *
< *        6-Apr-89 - added cellquads() and distances()                        *
< *       26-Apr-89 - modified ? command, added & and && commands              *
< *                 - added indsets(), cliques(), cellquins()                  *
< *       18-Aug-89 - made g, lab, canong dynamically allocated always         *
< *        2-Mar-90 - added celltrips(), cellcliq(), cellind()                 *
< *       13-Mar-90 - changed canong and savedg in output to h and h'          *
< *       19-Mar-90 - revised help() a little                                  *
< *       19-Apr-90 : changes for version 1.6                                  *
< *                 - rewrote "*" command to avoid bug in Pyramid C compiler   *
< *       20-Apr-90 - rewrote above rewrite to avoid bug in SUN3 gcc           *
< *       23-Apr-90 - undid above rewrite and fixed *my* bug <blush> by        *
< *                   making NUMINVARS have type int.  Sorry, gcc.             *
< *       10-Nov-90 - added calls to null routines (see comment on code)       *
< *       27-Aug-92 : renamed to version 1.7, no changes to this file          *
< *        5-Jun-93 : renamed to version 1.7+, no changes to this file         *
< *       18-Aug-93 : renamed to version 1.8, no changes to this file          *
< *       17-Sep-93 : changes for version 1.9 :                                *
< *                 - added invariant adjacencies()                            *
< *        7-Jun-96 : changes for version 2.0 :                                *
< *                 - added invariants cellfano() and cellfano2()              *
< *                 - made y=10 the default                                    *
< *       11-Jul-96 - added dynamic allocation                                 *
< *                 - rewrote h command and added H command                    *
< *                 - implemented M and R commands                             *
< *       15-Aug-96 - changed z command to use sethash()                       *
< *       30-Aug-96 - no need to declare seed; already in naututil.h           *
< *       12-Sep-96 - let i and I commands use userrefproc                     *
< *        9-Dec-96 - made y=infinity the default                              *
< *        6-Sep-97 - allocated arrays before accepting commands               *
< *        7-Sep-97 - make g,canong,savedg 1-d arrays even statically          *
< *       22-Sep-97 - undid error introduced on 7-Sep (worksize)               *
< *        9-Jan-00 - used *_check() instead of *_null()                       *
< *       12-Feb-00 - minor code formatting                                    *
< *       17-Aug-00 - now use tc_level from DEFAULTOPTIONS                     *
< *       16-Nov-00 - made changes listed in nauty.h                           *
< *       22-Apr-01 - include nautyinv.h                                       *
< *                 - improve worksize processing for MAXN=0                   *
< *        5-May-01 - k=0 1 automatic for *, also K=3 or K=0                   *
< *        2-Jun-01 - added __ command for digraph converse                    *
< *       18-Oct-01 - moved WORKSIZE to here                                   *
< *       21-Nov-01 - use NAUTYREQUIRED in *_check() calls                     *
< *        1-Sep-02 - Undid the previous change                                *
< *       17-Nov-03 - Changed INFINITY to NAUTY_INFINITY                       *
< *       15-Nov-04 - Completed all prototypes                                 *
< *                                                                            *
< *****************************************************************************/
---
>  *                                                                            *
>  * This is the main file for dreadnaut() version 2.2, which is a test-bed     *
>  *   for nauty() version 2.2.                                                 *
>  *                                                                            *
>  *   Copyright (1984-2002) Brendan McKay.  All rights reserved.               *
>  *   Subject to the waivers and disclaimers in nauty.h.                       *
>  *                                                                            *
>  *   CHANGE HISTORY                                                           *
>  *       10-Nov-87 : final changes for version 1.2                            *
>  *        5-Dec-87 - replaced all uses of fscanf() by appropriate uses        *
>  *                   of the new procedures readinteger() and readstring()     *
>  *                 - changed the '<' command slightly.  If a file of the      *
>  *                   given name cannot be openned, an attempt is made to      *
>  *                   open a file with the same name extended by DEFEXT.       *
>  *                 - improved error processing for 'n' command.               *
>  *       28-Sep-88 : changes for version 1.4 :                                *
>  *                 - replaced incorrect %d by %ld in fprintf for ? command    *
>  *       23-Mar-89 : changes for version 1.5 :                                *
>  *                 - added optional startup message                           *
>  *                 - enabled use of refine1 in 'i' command                    *
>  *                 - implemented $$ command                                   *
>  *                 - replaced ALLOCS test by DYNALLOC test                    *
>  *                 - modified @ command and added # command                   *
>  *                 - declared local procedures static                         *
>  *       25-Mar-89 - implemented k command                                    *
>  *       27-Mar-89 - implemented * and I commands                             *
>  *       29-Mar-89 - implemented K command                                    *
>  *        2-Apr-89 - added reporting of vertex-invariant statistics           *
>  *        2-Apr-89 - added ## command                                         *
>  *        4-Apr-89 - added triples(), quadruples(), adjtriang()               *
>  *                 - updated error reporting for nauty()                      *
>  *        5-Apr-89 - removed flushline() from g and e commands                *
>  *                 - added T command                                          *
>  *        6-Apr-89 - added cellquads() and distances()                        *
>  *       26-Apr-89 - modified ? command, added & and && commands              *
>  *                 - added indsets(), cliques(), cellquins()                  *
>  *       18-Aug-89 - made g, lab, canong dynamically allocated always         *
>  *        2-Mar-90 - added celltrips(), cellcliq(), cellind()                 *
>  *       13-Mar-90 - changed canong and savedg in output to h and h'          *
>  *       19-Mar-90 - revised help() a little                                  *
>  *       19-Apr-90 : changes for version 1.6                                  *
>  *                 - rewrote "*" command to avoid bug in Pyramid C compiler   *
>  *       20-Apr-90 - rewrote above rewrite to avoid bug in SUN3 gcc           *
>  *       23-Apr-90 - undid above rewrite and fixed *my* bug <blush> by        *
>  *                   making NUMINVARS have type int.  Sorry, gcc.             *
>  *       10-Nov-90 - added calls to null routines (see comment on code)       *
>  *       27-Aug-92 : renamed to version 1.7, no changes to this file          *
>  *        5-Jun-93 : renamed to version 1.7+, no changes to this file         *
>  *       18-Aug-93 : renamed to version 1.8, no changes to this file          *
>  *       17-Sep-93 : changes for version 1.9 :                                *
>  *                 - added invariant adjacencies()                            *
>  *        7-Jun-96 : changes for version 2.0 :                                *
>  *                 - added invariants cellfano() and cellfano2()              *
>  *                 - made y = 10 the default                                    *
>  *       11-Jul-96 - added dynamic allocation                                 *
>  *                 - rewrote h command and added H command                    *
>  *                 - implemented M and R commands                             *
>  *       15-Aug-96 - changed z command to use sethash()                       *
>  *       30-Aug-96 - no need to declare seed; already in naututil.h           *
>  *       12-Sep-96 - let i and I commands use userrefproc                     *
>  *        9-Dec-96 - made y = infinity the default                              *
>  *        6-Sep-97 - allocated arrays before accepting commands               *
>  *        7-Sep-97 - make g,canong,savedg 1-d arrays even statically          *
>  *       22-Sep-97 - undid error introduced on 7-Sep (worksize)               *
>  *        9-Jan-00 - used *_check() instead of *_null()                       *
>  *       12-Feb-00 - minor code formatting                                    *
>  *       17-Aug-00 - now use tc_level from DEFAULTOPTIONS                     *
>  *       16-Nov-00 - made changes listed in nauty.h                           *
>  *       22-Apr-01 - include nautyinv.h                                       *
>  *                 - improve worksize processing for MAXN = 0                   *
>  *        5-May-01 - k = 0 1 automatic for *, also K = 3 or K = 0                   *
>  *        2-Jun-01 - added __ command for digraph converse                    *
>  *       18-Oct-01 - moved WORKSIZE to here                                   *
>  *       21-Nov-01 - use NAUTYREQUIRED in *_check() calls                     *
>  *        1-Sep-02 - Undid the previous change                                *
>  *                                                                            *
>  *****************************************************************************/
> 
> #define MAXN 12000
83a84,90
> #include "naugroup.h"
> #include <stdlib.h>
> #include "group.h"
> #include "storage.h"
> 
> #define MASH(l,i) ((((l) ^ 065435) + (i)) & 077777)
> #define CLEANUP(l) ((int)((l) % 077777))
86c93
< #define SS(n,sing,plur)  (n),((n)==1?(sing):(plur))
---
> #define SS(n,sing,plur)  (n),((n) == 1?(sing):(plur))
120c127
< static DEFAULTOPTIONS_GRAPH(options);
---
> static DEFAULTOPTIONS(options);
137c144
< extern void NODEPROC(graph*,int*,int*,int,int,int,int,int,int);
---
> extern void NODEPROC();
143c150
< extern void AUTOMPROC(int,permutation*,int*,int,int,int);
---
> extern void AUTOMPROC();
149c156
< extern void LEVELPROC(int*,int*,int,int*,statsblk*,int,int,int,int,int,int);
---
> extern void LEVELPROC();
155,156c162
< extern void TCELLPROC(graph*,int*,int*,int,int,set*,int*,int*,int,int,
<               int(*)(graph*,int*,int*,int,int,int,int),int,int);
---
> extern void TCELLPROC();
162c168
< extern void REFPROC(graph*,int*,int*,int,int*,permutation*,set*,int*,int,int);
---
> extern void REFPROC();
169,170c175
< extern void INVARPROC(graph*,int*,int*,int,int,int,permutation*,
<                       int,boolean,int,int);
---
> extern void INVARPROC();
177c182
<                       int,boolean,int,int);
---
> 					   int,boolean,int,int);
180,196c185,201
<     = {{INVARPROC, INVARPROCNAME},
<        {NULL, "none"},
<        {twopaths,    "twopaths"},
<        {adjtriang,   "adjtriang"},
<        {triples,     "triples"},
<        {quadruples,  "quadruples"},
<        {celltrips,   "celltrips"},
<        {cellquads,   "cellquads"},
<        {cellquins,   "cellquins"},
<        {distances,   "distances"},
<        {indsets,     "indsets"},
<        {cliques,     "cliques"},
<        {cellcliq,    "cellcliq"},
<        {cellind,     "cellind"},
<        {adjacencies, "adjacencies"},
<        {cellfano,    "cellfano"},
<        {cellfano2,   "cellfano2"}};
---
> =  {{INVARPROC, INVARPROCNAME},
> 	{NULL, "none"},
> 	{twopaths,    "twopaths"},
> 	{adjtriang,   "adjtriang"},
> 	{triples,     "triples"},
> 	{quadruples,  "quadruples"},
> 	{celltrips,   "celltrips"},
> 	{cellquads,   "cellquads"},
> 	{cellquins,   "cellquins"},
> 	{distances,   "distances"},
> 	{indsets,     "indsets"},
> 	{cliques,     "cliques"},
> 	{cellcliq,    "cellcliq"},
> 	{cellind,     "cellind"},
> 	{adjacencies, "adjacencies"},
> 	{cellfano,    "cellfano"},
> 	{cellfano2,   "cellfano2"}};
200,202c205,335
< static void userautom(int,permutation*,int*,int,int,int);
< static void usernode(graph*,int*,int*,int,int,int,int,int,int);
< static void userlevel(int*,int*,int,int*,statsblk*,int,int,int,int,int,int);
---
> static void userautom();
> static void usernode();
> static void userlevel();
> 
> /***********************  Adolfo ********************************************/
> typedef struct Candidate 
> {
> 	int *lab;
> 	int *ptn;
> 	int cells;
> 	int n_pos;
> 	int code;
> 	struct Candidate *next;
> 	struct Candidate *prev;
> } Candidate;
> typedef struct AttemptInfo 
> {
> 	int cells;
> 	int pos;
> 	int flag;
> } AttemptInfo;
> 
> Candidate *CurrCand, *NextCand, *AuxCand, *CurrCandList, *NextCandList;
> AttemptInfo		CellSeq[MAXN];
> int     auxlab[MAXN];
> int     auxptn[MAXN];
> int		ActClasses[MAXN];
> int		ActClassesMR[MAXN];
> int		Distrib[MAXN];
> int		DistribMR[MAXN];
> int		inverseptn[MAXN];
> int		inverseptnList[MAXN];
> int     ind0,ind1,ind2,ind3,ind4,ind5,ind6,ind7,ind8,ind9,igen;
> int     auxnumcells,RaffArg,NClasses,NDistrib,NCR,NDistribMR,NClassesMR;
> int     chia1, chia2,effect,lines;
> int		foglie = 0;
> int		printquoz = 0;
> int printOrbits = 0;
> int newSize = FALSE;
> int TheGroupHasChanged = FALSE;
> int Trace = FALSE;
> int TraceCfr = FALSE;
> int TraceRaff = FALSE;
> int PrintTrace = FALSE;
> int TraceCount = 0;
> int TraceLen = 0;
> int FirstTrace = TRUE;
> double timebefore,timeafter;
> double auxtime;
> int *QuozList[MAXN];
> int *QuozSplit[MAXN];
> int *SplitPositions[MAXN];
> int *GraphList[MAXN];
> int *GensSofar[MAXN];
> int *GensSofar1[MAXN];
> int *MR_lab[MAXN];
> int *MR_ptn;
> int PartClass[MAXN];
> int PrtInd = 0;
> int GrLeGens;
> permutation permuta[MAXN];
> //int *comp_cell[MAXN];
> //int *comp_ptn[MAXN];
> int QuozRapp[MAXN];
> int *QuozRapp2D[MAXN];
> int ClassRapp[MAXN];
> int APBasind,APTentInd;
> int IndivPos[MAXN], APBasvect[MAXN], IndivElts[MAXN];
> int IndivCount;
> double t_cb;
> set AuxSet[MAXM];
> //int IdGroup;
> int IdGroup;
> //static int OrbProva[MAXN];
> int *APAuxSgrOrb;
> int *GroupOrbits;
> int where[MAXN];
> int *TraceList;
> char striso[255];
> char chartemp[10];
> int Iteration;
> int FirstAttempt = 0;
> int FirstInIteration = 0;
> int tuttitentativi = 0;
> int tentativi = 0;
> int multirefs = 0;
> int TCSize = 0;
> int Residual = 0;
> int FinalLevel = 0;
> int AllTree = 1;
> int printime = 1;
> 
> int Ngen;
> 
> // Per Leon
> PermGroup  *AuxGrLe;
> PermGroup  *GrLe1;
> Permutation *LePerm, *oldLePerm, *gen;
> int genSetFlag;
> int strGenSetFlag;
> RandomSchreierOptions rOptions = {0,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,
> UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN};
> GroupOptions Loptions;
> int column;
> int *PP;
> permutation NewGenerator[MAXN];
> int argc; 
> char *argv[10];
> 
> FILE *groupFile;
> char *groupName = "GruppoAttuale";
> 
> 
> void    CopyVect(int*,int*,int);
> int		CfrVect(int*,int*,int,int);
> int		CfrVectPlus(int*,int*,int,int,int);
> void    PrintVect(int*,int,int,int);
> void    PrintVectNoCR(int*,int,int,int);
> void    PrintVectD(long*,int,int);
> void    swap(int*,int*);
> struct Candidate *NewCandidate(int);
> struct Candidate *FreeCandidate(struct Candidate*,int);
> void	Graph2List(graph*,int,int,int*[]);
> void	IsStronglyReg(graph*,int,int);
> void	PrintList(int*[],int);
> void	Raffina(Candidate*,int*,int*,int,int*);
> int		MultiRaffina(graph*,Candidate*,int*,int,int,int,int*,optionblk*,statsblk*);
> int		RaffinaPerMult(int,int,int,int);
> void	ScriviGrLe(PermGroup*);
> void	CostruisciPermPerRSS(int,int*,int*);
> /***********************  Adolfo ********************************************/
207a341,378
> int curlen = 0;
> void ordina(int cell[MAXN],int ptn[MAXN],int n)
> {
> 	int ord[MAXN];
> 	int i,j,k;
> 	for (i = 0;i<n;i++) ord[i] = 0;
> 	for (i = 0;i<n;i++)
> 	{
> 		if (ptn[i])
> 			ord[cell[i]] = 1;
> 		else
> 		{
> 			k = i;
> 			ord[cell[i]] = 1;
> 			for (j = n-1; j>= 0; j--)
> 				if (ord[j])
> 				{
> 					cell[k] = j;
> 					k = k-1;
> 					ord[j] = 0;
> 				}
> 		}
> 	}
> 	return;
> }
> 
> void
> writeautom(permutation *p, int n)
> /* Called by allgroup.  Just writes the permutation p. */
> {
>     int i;
> 	
>     for (i = 0; i < n; ++i) printf(" %2d",p[i]);
>     printf("\n");
> }
> 
> /**************************************************************************/
> 
209,215c380,386
< *                                                                            *
< *  This is a program which illustrates the use of nauty.                     *
< *  Commands are read from stdin, and may be separated by white space,        *
< *  commas or not separated.  Output is written to stdout.                    *
< *  For a short description, see the nauty User's Guide.                      *
< *                                                                            *
< *****************************************************************************/
---
>  *                                                                            *
>  *  This is a program which illustrates the use of nauty.                     *
>  *  Commands are read from stdin, and may be separated by white space,        *
>  *  commas or not separated.  Output is written to stdout.                    *
>  *  For a short description, see the nauty User's Guide.                      *
>  *                                                                            *
>  *****************************************************************************/
218c389
< main(int argc, char *argv[])
---
> main()
220,230c391,401
<         int m,n,newm,newn;
<         boolean gvalid,ovalid,cvalid,pvalid,minus,prompt,doquot;
<         int i,worksize,numcells,refcode,umask,qinvar;
<         int oldorg;
<         char *s1,*s2,*invarprocname;
<         int c,d;
<         register long li;
<         set *gp;
<         double timebefore,timeafter;
<         char filename[200];
<         int sgn,sgorg,nperm;
---
> 	int m,n,newm,newn,j,singletons,elim;
> 	boolean gvalid,ovalid,cvalid,pvalid,minus,prompt,doquot;
> 	int i,worksize,numcells,refcode,umask,qinvar;
> 	int oldorg;
> 	char *s1,*s2,*invarprocname;
> 	int c,d;
> 	register long li;
> 	set *gp;
> 	double timebefore,timeafter;
> 	char filename[200];
> 	int sgn,sgorg,nperm;
234,238c405,430
< 
<         curfile = 0;
<         fileptr[curfile] = stdin;
<         prompt = DOPROMPT(INFILE);
<         outfile = stdout;
---
> 	// Adovars //
> 	register int numcells_iter;
> 	
> 	register int ind0, ind1, ind3, ind4, ind5, ind6, ind9;
> 	register int ind14, AUXn_pos;
> 	register int n_pos;
> 	register int i_cont,i_code,i_raff,i_auto,i_nxtn,i_nxtc,i_quoz;
> 	static int AttemptPartition[MAXN];
> 	static int work_lab[MAXN], work_ptn[MAXN];
> 	static int verbose = 0;
> 	
> 	int ran_next;
> 	// Fine Adovars //
> 	
> 	// Allocazione //
> 	for (ind1 = 0; ind1 < 10; ind1++)
> 		if ( ( argv[ind1] = (char *) malloc(1000*sizeof(char)) )  == NULL )
> 		{
> 			fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 			exit(1);
> 		}
> 	// Fine Allocazione //
> 	curfile = 0;
> 	fileptr[curfile] = stdin;
> 	prompt = DOPROMPT(INFILE);
> 	outfile = stdout;
240,242c432,434
<         n = m = 1;
<         worksize = 2*WORKSIZE;
< 
---
> 	n = m = 1;
> 	worksize = 2*WORKSIZE;
> 	
245,252c437,444
<         DYNALLOC2(graph,g,g_sz,n,m,"dreadnaut");
<         DYNALLOC1(int,lab,lab_sz,n,"dreadnaut");
<         DYNALLOC1(int,ptn,ptn_sz,n,"dreadnaut");
<         DYNALLOC1(setword,workspace,workspace_sz,
<                                             worksize,"dreadnaut");
<         DYNALLOC1(int,orbits,orbits_sz,n,"dreadnaut");
<         DYNALLOC1(permutation,perm,perm_sz,n,"dreadnaut");
<         DYNALLOC1(set,active,active_sz,m,"dreadnaut");
---
> 	DYNALLOC2(graph,g,g_sz,n,m,"dreadnaut");
> 	DYNALLOC1(int,lab,lab_sz,n,"dreadnaut");
> 	DYNALLOC1(int,ptn,ptn_sz,n,"dreadnaut");
> 	DYNALLOC1(setword,workspace,workspace_sz,
> 			  worksize,"dreadnaut");
> 	DYNALLOC1(int,orbits,orbits_sz,n,"dreadnaut");
> 	DYNALLOC1(permutation,perm,perm_sz,n,"dreadnaut");
> 	DYNALLOC1(set,active,active_sz,m,"dreadnaut");
255c447
< 
---
> 	
257c449
<         INITSEED;
---
> 	INITSEED;
260,269c452,461
< 
<         umask = 0;
<         pvalid = FALSE;
<         gvalid = FALSE;
<         ovalid = FALSE;
<         cvalid = FALSE;
<         minus = FALSE;
<         labelorg = oldorg = 0;
<         multiplicity = 1;
< 
---
> 	
> 	umask = 0;
> 	pvalid = FALSE;
> 	gvalid = FALSE;
> 	ovalid = FALSE;
> 	cvalid = FALSE;
> 	minus = FALSE;
> 	labelorg = oldorg = 0;
> 	multiplicity = 1;
> 	
271c463
<         INITIALIZE;
---
> 	INITIALIZE;
273,276c465,470
< 
<         invarprocname = "none";
<         if (prompt)
<         {
---
> 	
> 	invarprocname = "none";
> 	options.getcanon = TRUE;
> 	
> 	if (prompt)
> 	{
278c472
<             fprintf(PROMPTFILE,"Dreadnaut version %s [BIG].\n",NAUTYVERSION);
---
> 		fprintf(PROMPTFILE,"Dreadnaut version %s [BIG].\n",NAUTYVERSION);
280c474
<             fprintf(PROMPTFILE,"Dreadnaut version %s.\n",NAUTYVERSION);
---
> 		fprintf(PROMPTFILE,"Traces version Apr, 2008 (%s). Dreadnaut version %s.\n",(options.getcanon ? "Canonical" : "Aut Group"),NAUTYVERSION);
282,306c476,500
<             fprintf(PROMPTFILE,"> ");
<         }
< 
<         nauty_check(WORDSIZE,1,1,NAUTYVERSIONID);
<         nautinv_check(WORDSIZE,1,1,NAUTYVERSIONID);
<         nautil_check(WORDSIZE,1,1,NAUTYVERSIONID);
<         naututil_check(WORDSIZE,1,1,NAUTYVERSIONID);
< 
<         while (curfile >= 0)
<             if ((c = getc(INFILE)) == EOF || c == '\004')
<             {
<                 fclose(INFILE);
<                 --curfile;
<                 if (curfile >= 0) prompt = DOPROMPT(INFILE);
<             }
<             else switch (c)
<             {
<             case '\n':  /* possibly issue prompt */
<                 if (prompt)
<                     fprintf(PROMPTFILE,"> ");
<                 minus = FALSE;
<                 break;
< 
<             case ' ':   /* do nothing */
<             case '\t':
---
> 		fprintf(PROMPTFILE,"> ");
> 	}
> 	
> 	nauty_check(WORDSIZE,1,1,NAUTYVERSIONID);
> 	nautinv_check(WORDSIZE,1,1,NAUTYVERSIONID);
> 	nautil_check(WORDSIZE,1,1,NAUTYVERSIONID);
> 	naututil_check(WORDSIZE,1,1,NAUTYVERSIONID);
> 	
> 	while (curfile >=  0)
> 		if ((c = getc(INFILE))  == EOF || c  == '\004')
> 		{
> 			fclose(INFILE);
> 			--curfile;
> 			if (curfile >=  0) prompt = DOPROMPT(INFILE);
> 		}
> 		else switch (c)
> 		{
> 			case '\n':  /* possibly issue prompt */
> 				if (prompt)
> 					fprintf(PROMPTFILE,"> ");
> 				minus = FALSE;
> 				break;
> 				
> 				case ' ':   /* do nothing */
> 				case '\t':
308c502
<             case '\r':
---
> 				case '\r':
310,404c504,598
<             case '\f':
<                 break;
< 
<             case '-':   /* remember this for next time */
<                 minus = TRUE;
<                 break;
< 
<             case '+':   /* forget - */
<             case ',':
<             case ';':
<                 minus = FALSE;
<                 break;
< 
<             case '<':   /* new input file */
<                 minus = FALSE;
<                 if (curfile == MAXIFILES - 1)
<                     fprintf(ERRFILE,"exceeded maximum input nesting of %d\n\n",
<                             MAXIFILES);
<                 if (!readstring(INFILE,filename,200))
<                 {
<                     fprintf(ERRFILE,
<                             "missing file name on '>' command : ignored\n\n");
<                     break;
<                 }
<                 if ((fileptr[curfile+1] = fopen(filename,"r")) == NULL)
<                 {
<                     for (s1 = filename; *s1 != '\0'; ++s1) {}
<                     for (s2 = def_ext; (*s1 = *s2) != '\0'; ++s1, ++s2) {}
<                     fileptr[curfile+1] = fopen(filename,"r");
<                 }
<                 if (fileptr[curfile+1] != NULL)
<                 {
<                     ++curfile;
<                     prompt = DOPROMPT(INFILE);
<                     if (prompt)
<                         fprintf(PROMPTFILE,"> ");
<                 }
<                 else
<                     fprintf(ERRFILE,"can't open input file\n\n");
<                 break;
< 
<             case '>':   /* new output file */
<                 if ((d = getc(INFILE)) != '>')
<                     ungetc((char)d,INFILE);
<                 if (minus)
<                 {
<                     minus = FALSE;
<                     if (outfile != stdout)
<                     {
<                         fclose(outfile);
<                         outfile = stdout;
<                     }
<                 }
<                 else
<                 {
<                     if (!readstring(INFILE,filename,200))
<                     {
<                         fprintf(ERRFILE,
<                             "improper file name, reverting to stdout\n\n");
<                         outfile = stdout;
<                         break;
<                     }
<                     OPENOUT(outfile,filename,d=='>');
<                     if (outfile == NULL)
<                     {
<                         fprintf(ERRFILE,
<                             "can't open output file, reverting to stdout\n\n");
<                         outfile = stdout;
<                     }
<                 }
<                 break;
< 
<             case '!':   /* ignore rest of line */
<                 do
<                     c = getc(INFILE);
<                 while (c != '\n' && c != EOF);
<                 if (c == '\n') ungetc('\n',INFILE);
<                 break;
< 
<             case 'n':   /* read n value */
<                 minus = FALSE;
<                 i = getint(INFILE);
<                 if (i <= 0 || (MAXN && i > MAXN)
< 			   || (!MAXN && i > NAUTY_INFINITY-2))
<                     fprintf(ERRFILE,
<                          " n can't be less than 1 or more than %d\n\n",
<                            MAXN ? MAXN : NAUTY_INFINITY-2);
<                 else
<                 {
<                     gvalid = FALSE;
<                     ovalid = FALSE;
<                     cvalid = FALSE;
<                     pvalid = FALSE;
<                     n = i;
<                     m = (n + WORDSIZE - 1) / WORDSIZE;
---
> 				case '\f':
> 				break;
> 				
> 				case '-':   /* remember this for next time */
> 				minus = TRUE;
> 				break;
> 				
> 				//				   case '+':   /* forget - */
> 				case ',':
> 				case ';':
> 				minus = FALSE;
> 				break;
> 				
> 				case '<':   /* new input file */
> 				minus = FALSE;
> 				if (curfile  == MAXIFILES - 1)
> 					fprintf(ERRFILE,"exceeded maximum input nesting of %d\n\n",
> 							MAXIFILES);
> 				if (!readstring(INFILE,filename,200))
> 				{
> 					fprintf(ERRFILE,
> 							"missing file name on '>' command : ignored\n\n");
> 					break;
> 				}
> 				if ((fileptr[curfile+1] = fopen(filename,"r"))  == NULL)
> 				{
> 					for (s1 = filename; *s1 !=  '\0'; ++s1) {}
> 					for (s2 = def_ext; (*s1 = *s2) !=  '\0'; ++s1, ++s2) {}
> 					fileptr[curfile+1] = fopen(filename,"r");
> 				}
> 				if (fileptr[curfile+1] !=  NULL)
> 				{
> 					++curfile;
> 					prompt = DOPROMPT(INFILE);
> 					if (prompt)
> 						fprintf(PROMPTFILE,"> ");
> 				}
> 				else
> 					fprintf(ERRFILE,"can't open input file\n\n");
> 				break;
> 				
> 				case '>':   /* new output file */
> 				if ((d = getc(INFILE)) !=  '>')
> 					ungetc((char)d,INFILE);
> 				if (minus)
> 				{
> 					minus = FALSE;
> 					if (outfile !=  stdout)
> 					{
> 						fclose(outfile);
> 						outfile = stdout;
> 					}
> 				}
> 				else
> 				{
> 					if (!readstring(INFILE,filename,200))
> 					{
> 						fprintf(ERRFILE,
> 								"improper file name, reverting to stdout\n\n");
> 						outfile = stdout;
> 						break;
> 					}
> 					OPENOUT(outfile,filename,d == '>');
> 					if (outfile  == NULL)
> 					{
> 						fprintf(ERRFILE,
> 								"can't open output file, reverting to stdout\n\n");
> 						outfile = stdout;
> 					}
> 				}
> 				break;
> 				
> 				case '!':   /* ignore rest of line */
> 				do
> 					c = getc(INFILE);
> 				while (c !=  '\n' && c !=  EOF);
> 				if (c  == '\n') ungetc('\n',INFILE);
> 				break;
> 				
> 				case 'n':   /* read n value */
> 				minus = FALSE;
> 				i = getint(INFILE);
> 				if (i <=  0 || (MAXN && i > MAXN)
> 					|| (!MAXN && i > INFINITY-2))
> 					fprintf(ERRFILE,
> 							" n can't be less than 1 or more than %d\n\n",
> 							MAXN ? MAXN : INFINITY-2);
> 				else
> 				{
> 					gvalid = FALSE;
> 					ovalid = FALSE;
> 					cvalid = FALSE;
> 					pvalid = FALSE;
> 					n = i;
> 					m = (n + WORDSIZE - 1) / WORDSIZE;
406,440c600,740
< 		    worksize = 2 * m * WORKSIZE;
< 		    DYNALLOC2(graph,g,g_sz,n,m,"dreadnaut");
< 		    DYNALLOC1(int,lab,lab_sz,n,"dreadnaut");
< 		    DYNALLOC1(int,ptn,ptn_sz,n,"dreadnaut");
<                     DYNALLOC1(setword,workspace,workspace_sz,
<                                                         worksize,"dreadnaut");
< 		    DYNALLOC1(int,orbits,orbits_sz,n,"dreadnaut");
< 		    DYNALLOC1(permutation,perm,perm_sz,n,"dreadnaut");
< 		    DYNALLOC1(set,active,active_sz,m,"dreadnaut");
< #endif
<                 }
<                 break;
< 
<             case 'g':   /* read graph */
<                 minus = FALSE;
<                 readgraph(INFILE,g,options.digraph,prompt,FALSE,
<                           options.linelength,m,n);
<                 gvalid = TRUE;
<                 cvalid = FALSE;
<                 ovalid = FALSE;
<                 break;
< 
<             case 'e':   /* edit graph */
<                 minus = FALSE;
<                 readgraph(INFILE,g,options.digraph,prompt,gvalid,
<                           options.linelength,m,n);
<                 gvalid = TRUE;
<                 cvalid = FALSE;
<                 ovalid = FALSE;
<                 break;
< 
<             case 'r':   /* relabel graph and current partition */
<                 minus = FALSE;
<                 if (gvalid)
<                 {
---
> 					worksize = 2 * m * WORKSIZE;
> 					DYNALLOC2(graph,g,g_sz,n,m,"dreadnaut");
> 					DYNALLOC1(int,lab,lab_sz,n,"dreadnaut");
> 					DYNALLOC1(int,ptn,ptn_sz,n,"dreadnaut");
> 					DYNALLOC1(setword,workspace,workspace_sz,
> 							  worksize,"dreadnaut");
> 					DYNALLOC1(int,orbits,orbits_sz,n,"dreadnaut");
> 					DYNALLOC1(permutation,perm,perm_sz,n,"dreadnaut");
> 					DYNALLOC1(set,active,active_sz,m,"dreadnaut");
> #endif
> 				}
> 				break;
> 				
> 				case 'g':   /* read graph */
> 				if (gvalid)
> 				{
> 					for (i = 0; i<n; i++)
> 					{
> 						free(QuozList[i]);
> 						free(QuozSplit[i]);
> 						free(SplitPositions[i]);
> 						free(GraphList[i]);
> 						free(MR_lab[i]);
> 						free(QuozRapp2D[i]);
> 			      	}
> 					free(APAuxSgrOrb);
> 					free(GroupOrbits);
> 					free(TraceList);
> 					free(MR_ptn);
> 				}
> 				minus = FALSE;
> 				readgraph(INFILE,g,options.digraph,prompt,FALSE,
> 						  options.linelength,m,n);
> 				gvalid = TRUE;
> 				//				cvalid = FALSE;
> 				pvalid = FALSE;
> 				ovalid = FALSE;
> 				
> 				if (!pvalid)
> 					unitptn(lab,ptn,&numcells,n);
> 				cellstarts(ptn,0,active,m,n);
> 				refine(g,lab,ptn,0,&numcells,perm,active,&refcode,m,n);
> 				if (numcells > 1) pvalid = TRUE;
> 				
> 				LePerm= allocPermutation();
> 				LePerm->degree = n;
> 				LePerm->image = (UnsignedS *) malloc( (n+2) * sizeof(UnsignedS) );	
> 				//LePerm->image = allocIntArrayDegree();	
> 				for (i = 0; i <=  n; i++)
> 					if ( ( QuozList[i] = (int *)malloc(n*sizeof(int)) )  == NULL )
> 					{
> 						fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 						exit(1);
> 					}
> 				
> 				for (i = 0; i < n; i++)
> 					if ( ( QuozSplit[i] = (int *)malloc(n*sizeof(int)) )  == NULL )
> 					{
> 						fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 						exit(1);
> 					}
> 				
> 				for (i = 0; i < n; i++)
> 					if ( ( SplitPositions[i] = (int *)malloc((n+1)*sizeof(int)) )  == NULL )
> 					{
> 						fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 						exit(1);
> 					}
> 				
> 				for (i = 0; i < n; i++)
> 					if ( ( GraphList[i] = (int *)malloc(n*sizeof(int)) )  == NULL )
> 					{
> 						fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 						exit(1);
> 					}
> 				
> 				for (i = 0; i < n; i++)
> 					if ( ( MR_lab[i] = (int *)malloc((n+10)*sizeof(int)) )  == NULL )
> 					{
> 						fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 						exit(1);
> 					}
> 				if ( ( APAuxSgrOrb = (int *)malloc(n*sizeof(int)) )  == NULL )
> 				{
> 					fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 					exit(1);
> 				}
> 				if ( ( GroupOrbits = (int *)malloc(n*sizeof(int)) )  == NULL )
> 				{
> 					fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 					exit(1);
> 				}
> 				if ( ( TraceList = (int *)malloc(n*sizeof(int)) )  == NULL )
> 				{
> 					fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 					exit(1);
> 				}
> 				if ( ( MR_ptn = (int *)malloc((n+10)*sizeof(int)) )  == NULL )
> 				{
> 					fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 					exit(1);
> 				}
> 				for (i = 0; i < n; i++)
> 					if ( ( QuozRapp2D[i] = (int *)malloc(n*sizeof(int)) )  == NULL )
> 					{
> 						fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 						exit(1);
> 					}
> 				Graph2List(g,n,m,GraphList);	
> 				IsStronglyReg(g,n,m);
> 				ind0 = 0;
> 				if (ptn[0])
> 				{
> 					NClasses = 1;
> 					ActClasses[1] = 0;
> 				}
> 				for (i = 0; i<n; i++)
> 				{
> 					TraceList[i] = n+1;
> 					if (ptn[i] == 0) 
> 					{
> 						ind0 = i+1;
> 						if ((ind0<n) && (ptn[ind0])) ActClasses[++NClasses] = ind0;
> 					}
> 				}
> 				
> 				break;
> 				
> 				case 'e':   /* edit graph */
> 				minus = FALSE;
> 				readgraph(INFILE,g,options.digraph,prompt,gvalid,
> 						  options.linelength,m,n);
> 				gvalid = TRUE;
> 				cvalid = FALSE;
> 				ovalid = FALSE;
> 				break;
> 				
> 				case 'r':   /* relabel graph and current partition */
> 				minus = FALSE;
> 				if (gvalid)
> 				{
442c742
< 		    DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
---
> 					DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
444,455c744,755
<                     readvperm(INFILE,perm,prompt,n,&nperm);
<                     relabel(g,(pvalid ? lab : NULL),perm,canong,m,n);
<                     cvalid = FALSE;
<                     ovalid = FALSE;
<                 }
<                 else
<                     fprintf(ERRFILE,"g is not defined\n\n");
<                 break;
< 
<             case 'R':   /* form subgraph */
<                 if (gvalid)
<                 {
---
> 					readvperm(INFILE,perm,prompt,n,&nperm);
> 					relabel(g,(pvalid ? lab : NULL),perm,canong,m,n);
> 					cvalid = FALSE;
> 					ovalid = FALSE;
> 				}
> 				else
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 				break;
> 				
> 				case 'R':   /* form subgraph */
> 				if (gvalid)
> 				{
457c757
<                     DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
---
> 					DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
459,500c759,800
<                     readvperm(INFILE,perm,prompt,n,&nperm);
< 		    if (minus && nperm == n || !minus && nperm == 0)
< 			fprintf(ERRFILE,"can't form null graph\n\n");
< 		    else if (minus)
< 		    {
<                         sublabel(g,perm+nperm,n-nperm,canong,m,n);
< 			n = n - nperm;
< 		    }
< 		    else
<                     {
<                         sublabel(g,perm,nperm,canong,m,n);
<                         n = nperm;
<                     }
<                     cvalid = FALSE;
< 		    pvalid = FALSE;
<                     ovalid = FALSE;
< 		    m = (n + WORDSIZE - 1) / WORDSIZE;
<                 }
<                 else
<                     fprintf(ERRFILE,"g is not defined\n\n");
<                 minus = FALSE;
<                 break;
< 
<             case '_':   /* complement graph or converse digraph */
<                 minus = FALSE;
<                 if ((d = getc(INFILE)) != '_') ungetc((char)d,INFILE);
< 
<                 if (gvalid)
<                 {
<                     if (d == '_') converse(g,m,n);
<                     else          complement(g,m,n);
<                     cvalid = FALSE;
<                     ovalid = FALSE;
<                 }
<                 else
<                     fprintf(ERRFILE,"g is not defined\n\n");
<                 break;
< 
<             case '@':   /* copy canong into savedg */
<                 minus = FALSE;
<                 if (cvalid)
<                 {
---
> 					readvperm(INFILE,perm,prompt,n,&nperm);
> 					if (minus && nperm  == n || !minus && nperm  == 0)
> 						fprintf(ERRFILE,"can't form null graph\n\n");
> 					else if (minus)
> 					{
> 						sublabel(g,perm+nperm,n-nperm,canong,m,n);
> 						n = n - nperm;
> 					}
> 					else
> 					{
> 						sublabel(g,perm,nperm,canong,m,n);
> 						n = nperm;
> 					}
> 					cvalid = FALSE;
> 					pvalid = FALSE;
> 					ovalid = FALSE;
> 					m = (n + WORDSIZE - 1) / WORDSIZE;
> 				}
> 				else
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 				minus = FALSE;
> 				break;
> 				
> 				case '_':   /* complement graph or converse digraph */
> 				minus = FALSE;
> 				if ((d = getc(INFILE)) !=  '_') ungetc((char)d,INFILE);
> 				
> 				if (gvalid)
> 				{
> 					if (d  == '_') converse(g,m,n);
> 					else          complement(g,m,n);
> 					cvalid = FALSE;
> 					ovalid = FALSE;
> 				}
> 				else
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 				break;
> 				
> 				case '@':   /* copy canong into savedg */
> 				minus = FALSE;
> 				if (cvalid)
> 				{
502,503c802,803
< 		    DYNALLOC2(graph,savedg,savedg_sz,n,m,"dreadnaut");
< 		    DYNALLOC1(int,savedlab,savedlab_sz,n,"dreadnaut");
---
> 					DYNALLOC2(graph,savedg,savedg_sz,n,m,"dreadnaut");
> 					DYNALLOC1(int,savedlab,savedlab_sz,n,"dreadnaut");
505,551c805,851
<                     sgn = n;
<                     for (li = (long)n * (long)m; --li >= 0;)
<                         savedg[li] = canong[li];
<                     for (i = n; --i >= 0;) savedlab[i] = lab[i];
<                     sgorg = labelorg;
<                 }
<                 else
<                     fprintf(ERRFILE,"h is not defined\n\n");
<                 break;
< 
<             case '#':   /* compare canong to savedg */
<                 if ((d = getc(INFILE)) != '#') ungetc((char)d,INFILE);
< 
<                 if (cvalid)
<                 {
<                     if (sgn > 0)
<                     {
<                         if (sgn != n)
<                             fprintf(OUTFILE,
<                                   "h and h' have different sizes.\n");
<                         else
<                         {
<                             for (li = (long)n * (long)m; --li >= 0;)
<                                 if (savedg[li] != canong[li]) break;
<                             if (li >= 0)
<                                 fprintf(OUTFILE,"h and h' are different.\n");
<                             else
<                             {
<                                 fprintf(OUTFILE,
<                                    "h and h' are identical.\n");
<                                 if (d == '#')
<                                     putmapping(OUTFILE,savedlab,sgorg,
<                                            lab,labelorg,options.linelength,n);
<                             }
<                         }
<                     }
<                     else
<                         fprintf(ERRFILE,"h' is not defined\n\n");
<                 }
<                 else
<                     fprintf(ERRFILE,"h is not defined\n\n");
<                 break;
< 
<             case 'j':   /* relabel graph randomly */
<                 minus = FALSE;
<                 if (gvalid)
<                 {
---
> 					sgn = n;
> 					for (li = (long)n * (long)m; --li >=  0;)
> 						savedg[li] = canong[li];
> 					for (i = n; --i >=  0;) savedlab[i] = lab[i];
> 					sgorg = labelorg;
> 				}
> 				else
> 					fprintf(ERRFILE,"h is not defined\n\n");
> 				break;
> 				
> 				case '#':   /* compare canong to savedg */
> 				if ((d = getc(INFILE)) !=  '#') ungetc((char)d,INFILE);
> 				
> 				if (cvalid)
> 				{
> 					if (sgn > 0)
> 					{
> 						if (sgn !=  n)
> 							fprintf(OUTFILE,
> 									"h and h' have different sizes.\n");
> 						else
> 						{
> 							for (li = (long)n * (long)m; --li >=  0;)
> 								if (savedg[li] !=  canong[li]) break;
> 							if (li >=  0)
> 								fprintf(OUTFILE,"h and h' are different.\n");
> 							else
> 							{
> 								fprintf(OUTFILE,
> 										"h and h' are identical.\n");
> 								if (d  == '#')
> 									putmapping(OUTFILE,savedlab,sgorg,
> 											   lab,labelorg,options.linelength,n);
> 							}
> 						}
> 					}
> 					else
> 						fprintf(ERRFILE,"h' is not defined\n\n");
> 				}
> 				else
> 					fprintf(ERRFILE,"h is not defined\n\n");
> 				break;
> 				
> 				case 'j':   /* relabel graph randomly */
> 				minus = FALSE;
> 				if (gvalid)
> 				{
553c853
< 		    DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
---
> 					DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
555,575c855,883
<                     ranperm(perm,n);
<                     relabel(g,(pvalid ? lab : NULL),perm,canong,m,n);
<                     cvalid = FALSE;
<                     ovalid = FALSE;
<                 }
<                 else
<                     fprintf(ERRFILE,"g is not defined\n\n");
<                 break;
< 
<             case 'v':   /* write vertex degrees */
<                 minus = FALSE;
<                 if (gvalid)
<                     putdegs(OUTFILE,g,options.linelength,m,n);
<                 else
<                     fprintf(ERRFILE,"g is not defined\n\n");
<                 break;
< 
<             case '%':   /* do Mathon doubling operation */
<                 minus = FALSE;
<                 if (gvalid)
<                 {
---
> 					ranperm(perm,n);
> 					relabel(g,(pvalid ? lab : NULL),perm,canong,m,n);
> 					cvalid = FALSE;
> 					ovalid = FALSE;
> 				}
> 				else
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 				break;
> 				
> 				case 'J':   /* relabel graph randomly */
> 				minus = FALSE;
> 				if (!gvalid)
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 				else
> 					putgraph1(OUTFILE,g,options.linelength,m,n);
> 				break;
> 				
> 				case 'v':   /* write vertex degrees */
> 				minus = FALSE;
> 				if (gvalid)
> 					putdegs(OUTFILE,g,options.linelength,m,n);
> 				else
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 				break;
> 				
> 				case '%':   /* do Mathon doubling operation */
> 				minus = FALSE;
> 				if (gvalid)
> 				{
577,582c885,890
< 		    if (2L * ((long)n + 1L) > NAUTY_INFINITY-2)
<                     {
<                         fprintf(ERRFILE,
< 			     "n can't be more than %d\n\n",NAUTY_INFINITY-2);
<                         break;
<                     }
---
> 					if (2L * ((long)n + 1L) > INFINITY-2)
> 					{
> 						fprintf(ERRFILE,
> 								"n can't be more than %d\n\n",INFINITY-2);
> 						break;
> 					}
584,588c892,896
<                     if (2L * ((long)n + 1L) > MAXN)
<                     {
<                         fprintf(ERRFILE,"n can't be more than %d\n\n",MAXN);
<                         break;
<                     }
---
> 					if (2L * ((long)n + 1L) > MAXN)
> 					{
> 						fprintf(ERRFILE,"n can't be more than %d\n\n",MAXN);
> 						break;
> 					}
590,591c898,899
<                     newn = 2 * (n + 1);
<                     newm = (newn + WORDSIZE - 1) / WORDSIZE;
---
> 					newn = 2 * (n + 1);
> 					newm = (newn + WORDSIZE - 1) / WORDSIZE;
593c901
< 		    DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
---
> 					DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
595,598c903,906
< 
<                     for (li = (long)n * (long)m; --li >= 0;)
<                         canong[li] = g[li];
< 
---
> 					
> 					for (li = (long)n * (long)m; --li >=  0;)
> 						canong[li] = g[li];
> 					
600,643c908,951
<                     DYNALLOC2(graph,g,g_sz,newn,newm,"dreadnaut");
<                     DYNALLOC1(int,lab,lab_sz,newn,"dreadnaut");
<                     DYNALLOC1(int,ptn,ptn_sz,newn,"dreadnaut");
< 		    worksize = 2*WORKSIZE*newm;
<                     DYNALLOC1(setword,workspace,workspace_sz,
<                                                         worksize,"dreadnaut");
<                     DYNALLOC1(int,orbits,orbits_sz,newn,"dreadnaut");
<                     DYNALLOC1(permutation,perm,perm_sz,newn,"dreadnaut");
<                     DYNALLOC1(set,active,active_sz,newm,"dreadnaut");
< #endif
<                     mathon(canong,m,n,g,newm,newn);
<                     m = newm;
<                     n = newn;
<                     cvalid = FALSE;
<                     ovalid = FALSE;
<                     pvalid = FALSE;
<                 }
<                 else
<                     fprintf(ERRFILE,"g is not defined\n\n");
<                 break;
< 
<             case 's':   /* generate random graph */
<                 minus = FALSE;
<                 i = getint(INFILE);
<                 if (i <= 0) i = 2;
<                 rangraph(g,options.digraph,i,m,n);
<                 gvalid = TRUE;
<                 cvalid = FALSE;
<                 ovalid = FALSE;
<                 break;
< 
<             case 'q':   /* quit */
<                 EXIT;
<                 break;
< 
<             case '"':   /* copy comment to output */
<                 minus = FALSE;
<                 copycomment(INFILE,OUTFILE,'"');
<                 break;
< 
<             case 'I':   /* do refinement and invariants procedure */
<                 if (!pvalid)
<                     unitptn(lab,ptn,&numcells,n);
<                 cellstarts(ptn,0,active,m,n);
---
> 					DYNALLOC2(graph,g,g_sz,newn,newm,"dreadnaut");
> 					DYNALLOC1(int,lab,lab_sz,newn,"dreadnaut");
> 					DYNALLOC1(int,ptn,ptn_sz,newn,"dreadnaut");
> 					worksize = 2*WORKSIZE*newm;
> 					DYNALLOC1(setword,workspace,workspace_sz,
> 							  worksize,"dreadnaut");
> 					DYNALLOC1(int,orbits,orbits_sz,newn,"dreadnaut");
> 					DYNALLOC1(permutation,perm,perm_sz,newn,"dreadnaut");
> 					DYNALLOC1(set,active,active_sz,newm,"dreadnaut");
> #endif
> 					mathon(canong,m,n,g,newm,newn);
> 					m = newm;
> 					n = newn;
> 					cvalid = FALSE;
> 					ovalid = FALSE;
> 					pvalid = FALSE;
> 				}
> 				else
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 				break;
> 				
> 				case 's':   /* generate random graph */
> 				minus = FALSE;
> 				i = getint(INFILE);
> 				if (i <=  0) i = 2;
> 				rangraph(g,options.digraph,i,m,n);
> 				gvalid = TRUE;
> 				cvalid = FALSE;
> 				ovalid = FALSE;
> 				break;
> 				
> 				case 'q':   /* quit */
> 				EXIT;
> 				break;
> 				
> 				case '"':   /* copy comment to output */
> 				minus = FALSE;
> 				copycomment(INFILE,OUTFILE,'"');
> 				break;
> 				
> 				case 'I':   /* do refinement and invariants procedure */
> 				if (!pvalid)
> 					unitptn(lab,ptn,&numcells,n);
> 				cellstarts(ptn,0,active,m,n);
645c953
<                 timebefore = CPUTIME;
---
> 				timebefore = CPUTIME;
647,651c955,959
<                 doref(g,lab,ptn,0,&numcells,&qinvar,perm,active,&refcode,
<                         options.userrefproc ? options.userrefproc : 
< 			(m == 1 ? refine1 : refine),
<                         options.invarproc,0,0,
<                         options.invararg,options.digraph,m,n);
---
> 				doref(g,lab,ptn,0,&numcells,&qinvar,perm,active,&refcode,
> 					  options.userrefproc ? options.userrefproc : 
> 					  (m  == 1 ? refine1 : refine),
> 					  options.invarproc,0,0,
> 					  options.invararg,options.digraph,m,n);
653c961
<                 timeafter = CPUTIME;
---
> 				timeafter = CPUTIME;
655,659c963,967
<                 fprintf(OUTFILE," %d cell%s; code = %x",
<                         SS(numcells,"","s"),refcode);
<                 if (options.invarproc != NULL)
<                     fprintf(OUTFILE," (%s %s)",invarprocname,
<                         (qinvar == 2 ? "worked" : "failed"));
---
> 				fprintf(OUTFILE," %d cell%s; code = %x",
> 						SS(numcells,"","s"),refcode);
> 				if (options.invarproc !=  NULL)
> 					fprintf(OUTFILE," (%s %s)",invarprocname,
> 							(qinvar  == 2 ? "worked" : "failed"));
661,662c969,970
<                 fprintf(OUTFILE,"; cpu time = %.2f seconds\n",
<                         timeafter-timebefore);
---
> 				fprintf(OUTFILE,"; cpu time = %.2f seconds\n",
> 						timeafter-timebefore);
664c972
<                 fprintf(OUTFILE,"\n");
---
> 				fprintf(OUTFILE,"\n");
666,704c974,1012
<                 if (numcells > 1) pvalid = TRUE;
<                 break;
< 
<             case 'i':   /* do refinement */
<                 if (!pvalid)
<                     unitptn(lab,ptn,&numcells,n);
<                 cellstarts(ptn,0,active,m,n);
< 		if (options.userrefproc)
< 		    (*options.userrefproc)
<                          (g,lab,ptn,0,&numcells,perm,active,&refcode,m,n);
<                 else if (m == 1)
<                     refine1(g,lab,ptn,0,&numcells,perm,active,&refcode,m,n);
<                 else
<                     refine(g,lab,ptn,0,&numcells,perm,active,&refcode,m,n);
<                 fprintf(OUTFILE," %d cell%s; code = %x\n",
<                         SS(numcells,"","s"),refcode);
<                 if (numcells > 1) pvalid = TRUE;
<                 break;
< 
<             case 'x':   /* execute nauty */
<                 minus = FALSE;
<                 ovalid = FALSE;
<                 cvalid = FALSE;
<                 if (!gvalid)
<                 {
<                     fprintf(ERRFILE,"g is not defined\n\n");
<                     break;
<                 }
<                 if (pvalid)
<                 {
<                     fprintf(OUTFILE,"[fixing partition]\n");
<                     options.defaultptn = FALSE;
<                 }
<                 else
<                     options.defaultptn = TRUE;
<                 options.outfile = outfile;
< 
<                 if (options.getcanon)
<                 {
---
> 				if (numcells > 1) pvalid = TRUE;
> 				break;
> 				
> 				case 'i':   /* do refinement */
> 				if (!pvalid)
> 					unitptn(lab,ptn,&numcells,n);
> 				cellstarts(ptn,0,active,m,n);
> 				if (options.userrefproc)
> 					(*options.userrefproc)
> 					(g,lab,ptn,0,&numcells,perm,active,&refcode,m,n);
> 				else if (m  == 1)
> 					refine1(g,lab,ptn,0,&numcells,perm,active,&refcode,m,n);
> 				else
> 					refine(g,lab,ptn,0,&numcells,perm,active,&refcode,m,n);
> 				fprintf(OUTFILE," %d cell%s; code = %x\n",
> 						SS(numcells,"","s"),refcode);
> 				if (numcells > 1) pvalid = TRUE;
> 				break;
> 				
> 				case 'x':   /* execute nauty */
> 				minus = FALSE;
> 				ovalid = FALSE;
> 				cvalid = FALSE;
> 				if (!gvalid)
> 				{
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 					break;
> 				}
> 				if (pvalid)
> 				{
> 					fprintf(OUTFILE,"[fixing partition]\n");
> 					options.defaultptn = FALSE;
> 				}
> 				else
> 					options.defaultptn = TRUE;
> 				options.outfile = outfile;
> 				
> 				if (options.getcanon)
> 				{
706c1014
< 		    DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
---
> 					DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
708,712c1016,1020
<                 }
< 
<                 firstpath = TRUE;
< 		options.writeautoms = options_writeautoms;
< 		options.writemarkers = options_writemarkers;
---
> 				}
> 				
> 				firstpath = TRUE;
> 				options.writeautoms = options_writeautoms;
> 				options.writemarkers = options_writemarkers;
714c1022
<                 timebefore = CPUTIME;
---
> 				timebefore = CPUTIME;
716,722c1024,1030
< 		for (i = 0; i < multiplicity; ++i)
< 		{
<                     nauty(g,lab,ptn,NULL,orbits,&options,&stats,workspace,
<                          worksize,m,n,canong);
< 		    options.writeautoms = FALSE;
<                     options.writemarkers = FALSE;
< 		}
---
> 				for (i = 0; i < multiplicity; ++i)
> 				{
> 					nauty(g,lab,ptn,NULL,orbits,&options,&stats,workspace,
> 						  worksize,m,n,canong);
> 					options.writeautoms = FALSE;
> 					options.writemarkers = FALSE;
> 				}
724c1032
<                 timeafter = CPUTIME;
---
> 				timeafter = CPUTIME;
726,756c1034,1064
<                 if (stats.errstatus != 0)
<                     fprintf(ERRFILE,
<                       "nauty returned error status %d [this can't happen]\n\n",
<                        stats.errstatus);
<                 else
<                 {
<                     if (options.getcanon) cvalid = TRUE;
<                     ovalid = TRUE;
<                     fprintf(OUTFILE,"%d orbit%s",SS(stats.numorbits,"","s"));
<                     if (stats.grpsize2 == 0)
<                         fprintf(OUTFILE,"; grpsize=%.0f",stats.grpsize1+0.1);
<                     else
<                     {
<                         while (stats.grpsize1 >= 10.0)
<                         {
<                             stats.grpsize1 /= 10.0;
<                             ++stats.grpsize2;
<                         }
<                         fprintf(OUTFILE,"; grpsize=%12.10fe%d",
<                                    stats.grpsize1,stats.grpsize2);
<                     }
<                     fprintf(OUTFILE,"; %d gen%s",
<                             SS(stats.numgenerators,"","s"));
<                     fprintf(OUTFILE,"; %ld node%s",SS(stats.numnodes,"","s"));
<                     if (stats.numbadleaves)
<                         fprintf(OUTFILE," (%ld bad lea%s)",
<                                 SS(stats.numbadleaves,"f","ves"));
<                     fprintf(OUTFILE,"; maxlev=%d\n", stats.maxlevel);
<                     fprintf(OUTFILE,"tctotal=%ld",stats.tctotal);
<                     if (options.getcanon)
<                         fprintf(OUTFILE,"; canupdates=%ld",stats.canupdates);
---
> 				if (stats.errstatus !=  0)
> 					fprintf(ERRFILE,
> 							"nauty returned error status %d [this can't happen]\n\n",
> 							stats.errstatus);
> 				else
> 				{
> 					if (options.getcanon) cvalid = TRUE;
> 					ovalid = TRUE;
> 					fprintf(OUTFILE,"%d orbit%s",SS(stats.numorbits,"","s"));
> 					if (stats.grpsize2  == 0)
> 						fprintf(OUTFILE,"; grpsize = %.0f",stats.grpsize1+0.1);
> 					else
> 					{
> 						while (stats.grpsize1 >=  10.0)
> 						{
> 							stats.grpsize1 /=  10.0;
> 							++stats.grpsize2;
> 						}
> 						fprintf(OUTFILE,"; grpsize = %12.10fe%d",
> 								stats.grpsize1,stats.grpsize2);
> 					}
> 					fprintf(OUTFILE,"; %d gen%s",
> 							SS(stats.numgenerators,"","s"));
> 					fprintf(OUTFILE,"; %ld node%s",SS(stats.numnodes,"","s"));
> 					if (stats.numbadleaves)
> 						fprintf(OUTFILE," (%ld bad lea%s)",
> 								SS(stats.numbadleaves,"f","ves"));
> 					fprintf(OUTFILE,"; maxlev = %d\n", stats.maxlevel);
> 					fprintf(OUTFILE,"tctotal = %ld",stats.tctotal);
> 					if (options.getcanon)
> 						fprintf(OUTFILE,"; canupdates = %ld",stats.canupdates);
758,761c1066,1069
<                     fprintf(OUTFILE,multiplicity == 1 ?
< 			      "; cpu time = %.2f seconds\n" :
< 			      "; cpu time = %.5f seconds\n",
<                             (timeafter-timebefore)/multiplicity);
---
> 					fprintf(OUTFILE,multiplicity  == 1 ?
> 							"; cpu time = %.2f seconds\n" :
> 							"; cpu time = %.5f seconds\n",
> 							(timeafter-timebefore)/multiplicity);
763c1071
<                     fprintf(OUTFILE,"\n");
---
> 					fprintf(OUTFILE,"\n");
765,880c1073,1125
<                     if (options.invarproc != NULL &&
<                                            options.maxinvarlevel != 0)
<                     {
<                         fprintf(OUTFILE,"invarproc \"%s\" succeeded %ld/%ld",
<                             invarprocname,stats.invsuccesses,stats.invapplics);
<                         if (stats.invarsuclevel > 0)
<                             fprintf(OUTFILE," beginning at level %d.\n",
<                                     stats.invarsuclevel);
<                         else
<                             fprintf(OUTFILE,".\n");
<                     }
<                 }
<                 break;
< 
<             case 'f':   /* read initial partition */
<                 if (minus)
<                 {
<                     pvalid = FALSE;
<                     minus = FALSE;
<                 }
<                 else
<                 {
<                     readptn(INFILE,lab,ptn,&numcells,prompt,n);
<                     pvalid = TRUE;
<                 }
<                 break;
< 
<             case 't':   /* type graph */
<                 minus = FALSE;
<                 if (!gvalid)
<                     fprintf(ERRFILE,"g is not defined\n\n");
<                 else
<                     putgraph(OUTFILE,g,options.linelength,m,n);
<                 break;
< 
<             case 'T':   /* type graph preceded by n, $ and g commands */
<                 minus = FALSE;
<                 if (!gvalid)
<                     fprintf(ERRFILE,"g is not defined\n\n");
<                 else
<                 {
<                     fprintf(OUTFILE,"n=%d $=%d g\n",n,labelorg);
<                     putgraph(OUTFILE,g,options.linelength,m,n);
<                     fprintf(OUTFILE,"$$\n");
<                 }
<                 break;
< 
<             case 'u':   /* call user procs */
<                 if (minus)
<                 {
<                     umask = 0;
<                     minus = FALSE;
<                 }
<                 else
<                 {
<                     umask = getint(INFILE);
<                     if (umask < 0)
<                         umask = ~0;
<                 }
<                 if (umask & U_NODE)  options.usernodeproc = NODEPROC;
<                 else                 options.usernodeproc = NULL;
<                 if (umask & U_AUTOM) options.userautomproc = AUTOMPROC;
<                 else                 options.userautomproc = NULL;
<                 if (umask & U_LEVEL) options.userlevelproc = LEVELPROC;
<                 else                 options.userlevelproc = NULL;
<                 if (umask & U_TCELL) options.usertcellproc = TCELLPROC;
<                 else                 options.usertcellproc = NULL;
<                 if (umask & U_REF)   options.userrefproc = REFPROC;
<                 else                 options.userrefproc = NULL;
<                 break;
< 
<             case 'o':   /* type orbits */
<                 minus = FALSE;
<                 if (ovalid)
<                     putorbits(OUTFILE,orbits,options.linelength,n);
<                 else
<                     fprintf(ERRFILE,"orbits are not defined\n\n");
<                 break;
< 
<             case 'b':   /* type canonlab and canong */
<                 minus = FALSE;
<                 if (cvalid)
<                     putcanon(OUTFILE,lab,canong,options.linelength,m,n);
<                 else
<                     fprintf(ERRFILE,"h is not defined\n\n");
<                 break;
< 
<             case 'z':   /* type hashcode for canong */
<                 minus = FALSE;
<                 if (cvalid)
< 		{
< 		    zseed = n;
< 		    for (i = 0, gp = canong; i < n; ++i, gp += m)   
< 			zseed = sethash(gp,n,zseed,321);
<                     fprintf(OUTFILE,"[%7lx",zseed);
< 		    
<                     for (i = 0, gp = canong; i < n; ++i, gp += m) 
<                         zseed = sethash(gp,n,zseed,3109);
<                     fprintf(OUTFILE," %7lx",zseed);
<                     
<                     for (i = 0, gp = canong; i < n; ++i, gp += m) 
<                         zseed = sethash(gp,n,zseed,4317); 
<                     fprintf(OUTFILE," %7lx]\n",zseed);
< 		}
<                 else
<                     fprintf(ERRFILE,"h is not defined\n\n");
<                 break;
< 
<             case 'c':   /* set getcanon option */
<                 options.getcanon = !minus;
<                 minus = FALSE;
<                 break;
< 
<             case 'w':   /* read size of workspace */
<                 minus = FALSE;
<                 worksize = getint(INFILE);
---
> 					if (options.invarproc !=  NULL &&
> 						options.maxinvarlevel !=  0)
> 					{
> 						fprintf(OUTFILE,"invarproc \"%s\" succeeded %ld/%ld",
> 								invarprocname,stats.invsuccesses,stats.invapplics);
> 						if (stats.invarsuclevel > 0)
> 							fprintf(OUTFILE," beginning at level %d.\n",
> 									stats.invarsuclevel);
> 						else
> 							fprintf(OUTFILE,".\n");
> 					}
> 				}
> 				break;
> 				
> 				case 'Q':   /* quoziente */
> 				printime = !printime;
> 				fprintf(OUTFILE, "PrintTime: %d\n", printime);
> 				break;
> 				
> 				case 'V':   /* verboso */
> 				verbose = !verbose;
> 				fprintf(OUTFILE, "Verboso: %d\n", verbose);
> 				break;
> 				
> 				case 'L':   /* printquoz */
> 				printquoz = !printquoz;
> 				fprintf(OUTFILE, "Stampa Quoziente: %d\n", printquoz);
> 				break;
> 				
> 				case 'O':   /* verboso */
> 				printOrbits = !printOrbits;
> 				fprintf(OUTFILE, "printOrbits: %d\n", printOrbits);
> 				break;
> 				
> 				case 'Z':   /* verboso */
> 				Trace = !Trace;
> 				fprintf(OUTFILE, "Trace: %d\n", Trace);
> 				break;
> 				
> 				case '1':   /* verboso */
> 				TraceCfr = !TraceCfr;
> 				fprintf(OUTFILE, "TraceCfr: %d\n", TraceCfr);
> 				break;
> 				
> 				case '2':   /* verboso */
> 				PrintTrace = !PrintTrace;
> 				fprintf(OUTFILE, "PrintTrace: %d\n", PrintTrace);
> 				break;
> 				
> 				case 'P':   /* do doubling operation */
> 				minus = FALSE;
> 				if (gvalid)
> 				{
882c1127,1132
< 		DYNALLOC1(setword,workspace,workspace_sz,worksize,"dreadnaut");
---
> 					if (2L * ((long)n + 1L) > INFINITY-2)
> 					{
> 						fprintf(ERRFILE,
> 								"n can't be more than %d\n\n",INFINITY-2);
> 						break;
> 					}
884,1058c1134,2090
<                 if (worksize > 2*MAXM*WORKSIZE)
<                 {
<                     fprintf(ERRFILE,
<                        "too big - setting worksize = %d\n\n", 2*MAXM*WORKSIZE);
<                     worksize = 2*MAXM*WORKSIZE;
<                 }
< #endif
<                 break;
< 
<             case 'l':   /* read linelength for output */
<                 options.linelength = getint(INFILE);
<                 minus = FALSE;
<                 break;
< 
<             case 'y':   /* set tc_level field of options */
<                 options.tc_level = getint(INFILE);
<                 minus = FALSE;
<                 break;
< 
<             case 'M':   /* set multiplicity */
<                 multiplicity = getint(INFILE);
< 		if (multiplicity <= 0) multiplicity = 1;
<                 minus = FALSE;
<                 break;
< 
<             case 'k':   /* set invarlev fields of options */
<                 options.mininvarlevel = getint(INFILE);
<                 options.maxinvarlevel = getint(INFILE);
<                 minus = FALSE;
<                 break;
< 
<             case 'K':   /* set invararg field of options */
<                 options.invararg = getint(INFILE);
<                 minus = FALSE;
<                 break;
< 
<             case '*':   /* set invarproc field of options */
<                 minus = FALSE;
<                 d = getint(INFILE);
<                 if (d >= -1 && d <= NUMINVARS-2)
<                 {
<                     options.invarproc = invarproc[d+1].entrypoint;
<                     invarprocname = invarproc[d+1].name;
< 		    if (options.invarproc != NULL)
< 		    {
< 			options.mininvarlevel = 0;
< 			options.maxinvarlevel = 1;
< 			if (options.invarproc == indsets ||
< 			    options.invarproc == cliques ||
< 			    options.invarproc == cellind ||
< 			    options.invarproc == cellcliq)
< 				options.invararg = 3;
< 			else
< 			    options.invararg = 0;
< 		    }
<                 }
<                 else
<                     fprintf(ERRFILE,"no such vertex-invariant\n\n");
<                 break;
< 
<             case 'a':   /* set writeautoms option */
<                 options_writeautoms = !minus;
<                 minus = FALSE;
<                 break;
< 
<             case 'm':   /* set writemarkers option */
<                 options_writemarkers = !minus;
<                 minus = FALSE;
<                 break;
< 
<             case 'p':   /* set cartesian option */
<                 options.cartesian = !minus;
<                 minus = FALSE;
<                 break;
< 
<             case 'd':   /* set digraph option */
<                 if (options.digraph && minus)
<                     gvalid = FALSE;
<                 options.digraph = !minus;
<                 minus = FALSE;
<                 break;
< 
<             case '$':   /* set label origin */
<                 if ((d = getc(INFILE)) == '$')
<                     labelorg = oldorg;
<                 else
<                 {
<                     ungetc((char)d,INFILE);
<                     oldorg = labelorg;
<                     i = getint(INFILE);
<                     if (i < 0)
<                         fprintf(ERRFILE,"labelorg must be >= 0\n\n");
<                     else
<                         labelorg = i;
<                 }
<                 break;
< 
<             case '?':   /* type options, etc. */
<                 minus = FALSE;
<                 fprintf(OUTFILE,"m=%d n=%d labelorg=%d",m,n,labelorg);
<                 if (!gvalid)
<                     fprintf(OUTFILE," g=undef");
<                 else
<                 {
<                     li = 0;
<                     for (i = 0, gp = g; i < n; ++i, gp += m)
<                         li += setsize(gp,m);
<                     if (options.digraph)
<                         fprintf(OUTFILE," arcs=%ld",li);
<                     else
<                         fprintf(OUTFILE," edges=%ld",li/2);
<                 }
<                 fprintf(OUTFILE," options=(%cc%ca%cm%cp%cd",
<                             PM(options.getcanon),PM(options_writeautoms),
<                             PM(options_writemarkers),PM(options.cartesian),
<                             PM(options.digraph));
<                 if (umask & 31)
<                     fprintf(OUTFILE," u=%d",umask&31);
<                 if (options.tc_level > 0)
<                     fprintf(OUTFILE," y=%d",options.tc_level);
<                 if (options.mininvarlevel != 0 || options.maxinvarlevel != 0)
<                     fprintf(OUTFILE," k=(%d,%d)",
<                                   options.mininvarlevel,options.maxinvarlevel);
<                 if (options.invararg > 0)
<                     fprintf(OUTFILE," K=%d",options.invararg);
< 		if (multiplicity > 1) fprintf(OUTFILE," M=%d",multiplicity);
<                 fprintf(OUTFILE,")\n");
<                 fprintf(OUTFILE,"linelen=%d worksize=%d input_depth=%d",
<                                 options.linelength,worksize,curfile);
<                 if (options.invarproc != NULL)
<                     fprintf(OUTFILE," invarproc=%s",invarprocname);
<                 if (pvalid)
<                     fprintf(OUTFILE,"; %d cell%s",SS(numcells,"","s"));
<                 else
<                     fprintf(OUTFILE,"; 1 cell");
<                 fprintf(OUTFILE,"\n");
<                 if (OUTFILE != PROMPTFILE)
<                     fprintf(PROMPTFILE,"m=%d n=%d depth=%d labelorg=%d\n",
<                             m,n,curfile,labelorg);
<                 break;
< 
<             case '&':   /* list the partition and possibly the quotient */
<                 if ((d = getc(INFILE)) == '&')
<                     doquot = TRUE;
<                 else
<                 {
<                     ungetc((char)d,INFILE);
<                     doquot = FALSE;
<                 }
<                 minus = FALSE;
<                 if (pvalid)
<                     putptn(OUTFILE,lab,ptn,0,options.linelength,n);
<                 else
<                     fprintf(OUTFILE,"unit partition\n");
<                 if (doquot)
<                 {
<                     if (!pvalid) unitptn(lab,ptn,&numcells,n);
<                     putquotient(OUTFILE,g,lab,ptn,0,options.linelength,m,n);
<                 }
<                 break;
< 
<             case 'h':   /* type help information */
< 	    case 'H':
<                 minus = FALSE;
<                 help(PROMPTFILE,c == 'H');
<                 break;
< 
<             default:    /* illegal command */
<                 fprintf(ERRFILE,"'%c' is illegal - type 'h' for help\n\n",c);
<                 flushline(INFILE);
<                 if (prompt) fprintf(PROMPTFILE,"> ");
<                 break;
< 
<             }  /* end of switch */
< 
---
> 					if (2L * ((long)n + 1L) > MAXN)
> 					{
> 						fprintf(ERRFILE,"n can't be more than %d\n\n",MAXN);
> 						break;
> 					}
> #endif
> 					newn = (2 * n);
> 					newm = (newn + WORDSIZE - 1) / WORDSIZE;
> #if !MAXN
> 					DYNALLOC2(graph,canong,canong_sz,n,m,"dreadnaut");
> #endif
> 					
> 					for (li = (long)n * (long)m; --li >=  0;)
> 						canong[li] = g[li];
> 					if (!pvalid)
> 						unitptn(lab,ptn,&numcells,n);
> 					
> 					for (ind0 = 0;ind0<n;ind0++)
> 					{
> 						work_lab[ind0] = lab[ind0];
> 						work_ptn[ind0] = ptn[ind0];
> 					}
> 					
> 					
> #if !MAXN
> 					DYNALLOC2(graph,g,g_sz,newn,newm,"dreadnaut");
> 					DYNALLOC1(int,lab,lab_sz,newn,"dreadnaut");
> 					DYNALLOC1(int,ptn,ptn_sz,newn,"dreadnaut");
> 					worksize = 2*WORKSIZE*newm;
> 					DYNALLOC1(setword,workspace,workspace_sz,
> 							  worksize,"dreadnaut");
> 					DYNALLOC1(int,orbits,orbits_sz,newn,"dreadnaut");
> 					DYNALLOC1(permutation,perm,perm_sz,newn,"dreadnaut");
> 					DYNALLOC1(set,active,active_sz,newm,"dreadnaut");
> #endif
> 					//raddoppia(canong,m,n,g,newm,newn,lab,ptn);
> 					m = newm;
> 					n = newn;
> 					cvalid = FALSE;
> 					ovalid = FALSE;
> 					pvalid = TRUE;
> 					putgraph(OUTFILE,g,options.linelength,m,n);
> 					putptn(OUTFILE,work_lab,work_ptn,0,options.linelength,n/2);
> 					for (ind0 = 0;ind0<n;ind0 = ind0+2)
> 					{
> 						ptn[ind0] = INFINITY;
> 						lab[ind0] = work_lab[ind0/2];
> 					}
> 					for (ind0 = 1;ind0<n;ind0 = ind0+2)
> 					{
> 						ptn[ind0] = work_ptn[ind0/2];
> 						lab[ind0] = work_lab[ind0/2]+(n/2);
> 					}
> 					lab[n-1] = n-1;
> 					ptn[n-1] = 0;
> 					putptn(OUTFILE,lab,ptn,0,options.linelength,n);
> 				}
> 				else
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 				ranperm(perm,n/2);
> 				for (ind0 = n/2;ind0<n;ind0++)
> 					perm[ind0] = ind0;
> 				relabel(g,(pvalid ? lab : NULL),perm,canong,m,n);
> 				break;
> 				
> 				
> 				case ':':   /* execute APnauty */
> 				if (printime) auxtime = 0;
> 				//fprintf(OUTFILE,"%d\n\n",options.getcanon);
> 				FinalLevel = 0;
> 				AllTree = 1;				
> 				
> 				timebefore = CPUTIME;
> 				CurrCandList = NextCandList = NULL;
> 				newSize = FALSE;
> 				TheGroupHasChanged = FALSE;
> 				TraceCount = 0;
> 				TraceLen = 0;
> 				FirstTrace = TRUE;
> 				Trace = FALSE;
> 				multirefs = 0;
> 				
> 				// inizializza gruppo //
> 				AuxGrLe = NULL;
> 				Loptions.maxBaseSize = DEFAULT_MAX_BASE_SIZE;
> 				IdGroup = TRUE;
> 				GrLeGens = 0;
> 				strcpy(striso,"\0");
> 				// fine iniz. gruppo //
> 				
> 				for (i = 0; i<n; i++)
> 				{
> 					QuozSplit[i][0] = 0;
> 					SplitPositions[i][0] = 0;
> 					QuozRapp[i] = 0;
> 					ClassRapp[i] = -1;
> 				}
> 				
> 				for (ind0 = 0; ind0 < n; ++ind0) 
> 				{
> 					orbits[ind0] = ind0;
> 					APAuxSgrOrb[ind0] = ind0;
> 					GroupOrbits[ind0] = ind0;
> 				}
> 				
> 				
> 				i_code = n+1;
> 				i_cont = n+2;
> 				i_raff = n+3;
> 				i_auto = n+4;
> 				i_nxtn = n+5;
> 				i_nxtc = n+6;
> 				i_quoz = n+7;
> 				tentativi = 0;
> 				t_cb = 0;
> 				tuttitentativi = 0;
> 				
> 				minus = FALSE;
> 				ovalid = FALSE;
> 				cvalid = FALSE;
> 				if (!gvalid)
> 				{
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 					break;
> 				}
> 				options.writeautoms = options_writeautoms;
> 				options.writemarkers = options_writemarkers;
> 				options.linelength = 80;
> 				stats.numorbits = 1;
> 				
> 				setbuf(OUTFILE,NULL);
> 				if (!pvalid)
> 					unitptn(lab,ptn,&numcells,n);
> 				//if (verbose)
> 				{
> 					fprintf(OUTFILE,"Initial partition: %d cell%s\n",SS(numcells,"","s"));		
> 					putptn(OUTFILE,lab,ptn,0,options.linelength,n);
> 				}
> 				NextCand = NewCandidate(n);
> 				NextCandList = NextCand;
> 				CopyVect(lab,NextCand->lab,n);
> 				CopyVect(ptn,NextCand->ptn,n);
> 				cellstarts(NextCand->ptn,0,active,m,n);
> 				numcells = setsize(active,m);
> 				refine(g,NextCand->lab,NextCand->ptn,0,&numcells,perm,active,&refcode,m,n);
> 				NextCand->cells = NextCand->lab[n] = numcells;
> 				//if (verbose)
> 				{
> 					fprintf(OUTFILE,"Refined partition: %d cell%s\n",SS(NextCand->cells,"","s"));		
> 					putptn(OUTFILE,NextCand->lab,NextCand->ptn,0,options.linelength,n);
> 				}
> 				if (numcells != n)
> 					n_pos = MultiRaffina(g,NextCand,NextCand->ptn,m,n,verbose,orbits,&options,&stats);
> 				numcells = NextCand->cells = NextCand->lab[n];
> 				NextCand->code = NextCand->lab[n+1];
> 				//if (verbose)
> 				{
> 					fprintf(OUTFILE,"Multi-refined partition: %d cell%s\n",SS(numcells,"","s"));
> 					putptn(OUTFILE,NextCand->lab,NextCand->ptn,0,options.linelength,n);
> 				}
> 				//				fprintf(OUTFILE,"Inserire un mumero ");
> 				//				readinteger(INFILE,&RaffArg);
> 				numcells_iter = numcells;
> 				Iteration = 0;
> 				IndivPos[0] = n_pos;
> 				CurrCandList = NULL;
> 				FirstAttempt = TRUE;
> 				
> 				while (numcells_iter != n)  
> 				{	 
> 					// Creazione TENTATIVI //
> 					
> 					AuxCand = NextCandList;				// swap delle liste
> 					NextCandList = CurrCandList;		// swap delle liste
> 					CurrCandList = AuxCand;				// swap delle liste
> 					
> 					NextCand = NextCandList;
> 					
> 					AuxCand = CurrCandList;
> 					if (!IdGroup) 
> 					{	
> 						/*						if (verbose)
> 						 {
> 						 for (i=0; i <IndivCount; i++)
> 						 fprintf(OUTFILE,"(%d,%d)",CellSeq[i].cells,CellSeq[i].flag);
> 						 fprintf(OUTFILE,"\n");
> 						 }
> 						 */
> 						if (TheGroupHasChanged)
> 						{
> 							fprintf(OUTFILE,"✓");
> 							TheGroupHasChanged = FALSE;
> 						}
> 						fprintf(OUTFILE,"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n(Sub)group size: ");
> 						informGroupForAP(GrLe1);
> 						fprintf(OUTFILE,"; %d gen%s; %d orbit%s.\n",SS(GrLeGens,"","s"),SS(stats.numorbits,"","s"));
> 						if (printOrbits) 
> 						{
> 							fprintf(OUTFILE,"Orbits:");
> 							if (stats.numorbits < 12)
> 								putorbitsList(OUTFILE,GroupOrbits,options.linelength,n);
> 							else
> 								putorbits1(OUTFILE,GroupOrbits,options.linelength,n);
> 						}
> 					}
> 					TCSize = 0;
> 					while (CurrCandList->ptn[n_pos+TCSize]) TCSize++;
> 					if (printime)
> 						fprintf(OUTFILE, "ITERATION %d (%d cell%s); next position: %d; target size: %d; group time/time = %.2f/%.2f seconds.\n", 
> 								Iteration, SS(numcells_iter,"","s"),n_pos,TCSize+1,auxtime,CPUTIME-timebefore);
> 					else
> 						fprintf(OUTFILE, "ITERATION %d (%d cell%s); next position: %d; target size: %d.\n", 
> 								Iteration, SS(numcells_iter,"","s"),n_pos,TCSize+1);
> 					
> 					FirstTrace = TRUE;
> 					TraceLen = 0;
> 					AUXn_pos = 0;
> 					
> 					if (Iteration) CopyVect(CurrCandList->lab,auxlab,n);
> 					
> 					while (CurrCandList)
> 					{
> 						if (!options.getcanon && FinalLevel && AllTree) AllTree = FALSE;
> 						if ((GroupOrbits[CurrCandList->lab[IndivPos[0]]] == CurrCandList->lab[IndivPos[0]]) && CurrCandList->cells)   // QUI LA CONDIZIONE SUL GRUPPO
> 						{
> 							CurrCand = CurrCandList;
> 							ordina(CurrCand->lab,CurrCand->ptn,n);
> 							if (!IdGroup)
> 							{
> 								if (printime) auxtime -= CPUTIME;
> 								if (AuxGrLe!=NULL)
> 									AuxGrLe = (PermGroup *)copyOfPermGroup2(GrLe1,AuxGrLe);
> 								else  
> 									AuxGrLe = (PermGroup *)copyOfPermGroup(GrLe1);
> 								if (Iteration)
> 								{
> 									argc = 3;
> 									sprintf(argv[1],"GruppoSGS");
> 									sprintf(argv[2],"%d",CurrCand->lab[IndivPos[0]]+1);
> 									for (i=1; i<Iteration; i++)
> 									{
> 										sprintf(chartemp,",%d",CurrCand->lab[IndivPos[i]]+1);
> 										strcat(argv[2],chartemp);
> 									}
> 								}
> 								else
> 								{
> 									argc = 2;
> 									sprintf(argv[1],"GruppoSGS");
> 								}
> 								Orblist2(argc,argv,orbits,AuxGrLe);
> 								if (printime) auxtime += CPUTIME;
> 							}
> 							
> 							ind3 = n_pos-1;
> 							do
> 							{ 
> 								ind3++;
> 								if (orbits[CurrCand->lab[ind3]] == CurrCand->lab[ind3])
> 								{
> 									if (NextCandList)
> 									{
> 										if (AUXn_pos != -2)
> 										{
> 											NextCand->next = NewCandidate(n);
> 											AuxCand = NextCand;
> 											NextCand = NextCand->next;
> 											NextCand->prev = AuxCand;
> 											NextCand->next = NULL;
> 										}
> 									}
> 									else
> 									{
> 										NextCand = NewCandidate(n);
> 										NextCandList = NextCand;
> 										NextCand->prev = NULL;
> 										NextCand->next = NULL;
> 									}
> 									NextCand->lab[i_cont] = TRUE;
> 									
> 									CopyVect(CurrCand->lab,NextCand->lab,n+10);
> 									CopyVect(CurrCand->ptn,NextCand->ptn,n);
> 									NextCand->ptn[n_pos] = 0;
> 									ind4 = NextCand->lab[n_pos];
> 									NextCand->lab[n_pos] = NextCand->lab[ind3];
> 									NextCand->lab[ind3] = ind4;
> 									NextCand->lab[n] = CurrCand->cells+1;  //??
> 									
> 									NDistrib = 1;
> 									Distrib[1] = n_pos;
> 									NClasses = 1;
> 									ActClasses[1] = 0;
> 									for (i = 0; i<n; i++)
> 									{
> 										QuozRapp[i] = 0;
> 										if ((NextCand->ptn[i] == 0) && (i+1<n)) ActClasses[++NClasses] = i+1;
> 									}
> 									Trace = FALSE;
> 									Raffina(NextCand,NextCand->ptn,&NextCand->lab[n],n,&NextCand->lab[i_code]);
> 									IndivCount = Iteration+1;
> 									for (ind14 = 0; ind14<IndivCount; ind14++)
> 										IndivElts[ind14] = NextCand->lab[IndivPos[ind14]];									
> 									if (options.getcanon || !FinalLevel) Trace = TraceCfr = TRUE;
> 									
> 									AUXn_pos = MultiRaffina(g,NextCand,NextCand->ptn,m,n,verbose,orbits,&options,&stats);
> 									
> 									// qui NO_CAN
> 									if ((!options.getcanon) && (!FinalLevel) && (NextCand->lab[n] == n))
> 									{
> 										FinalLevel = TRUE;
> 										//fprintf(OUTFILE,"Entering NoCan mode...\n");
> 									}
> 									
> 									NextCand->code = NextCand->lab[n+1];
> 									
> 									if (AUXn_pos != -2)
> 									{
> 										if (numcells_iter < NextCand->lab[n]) numcells_iter = NextCand->lab[n];  // ??
> 										NextCand->n_pos = AUXn_pos;
> 										NextCand->cells = NextCand->lab[n];
> 										
> 										Trace = TraceCfr = FALSE;
> 										CopyVect(NextCand->ptn,AttemptPartition,n);
> 										
> 										if (NextCand == NextCandList) 
> 										{
> 											TraceLen = TraceCount;
> 											Residual = 1;
> 											if (ind3 == n_pos)
> 											{
> 												fprintf(OUTFILE, "┌──────────────────");
> 												for (ind5 = 0; ind5 <=  Iteration; ind5++)
> 													fprintf(OUTFILE, "────");
> 												fprintf(OUTFILE, "─┐\n");
> 												fprintf(OUTFILE, "|                   ");
> 												for (ind5 = 0; ind5 <=  Iteration; ind5++)
> 													fprintf(OUTFILE, "%3d ", IndivPos[ind5]);
> 												fprintf(OUTFILE, "|\n");
> 												fprintf(OUTFILE, "└──────────────────");
> 												for (ind5 = 0; ind5 <= Iteration; ind5++)
> 													fprintf(OUTFILE, "────");
> 												if (AUXn_pos != -1) fprintf(OUTFILE, "─┤ next position: %d; cells: %d; multi-refs: %d\n",AUXn_pos,NextCand->cells,multirefs);
> 												else fprintf(OUTFILE, "─┤ discrete partition; multi-refs: %d\n",multirefs);
> 												if (Iteration) FirstInIteration = TRUE;
> 											}
> 											else 
> 											{
> 												fprintf(OUTFILE, " -------------------");
> 												for (ind5 = 0; ind5 <= Iteration; ind5++)
> 													fprintf(OUTFILE, "----");
> 												if (AUXn_pos != -1) fprintf(OUTFILE, "| (%d,%d)\n",AUXn_pos,NextCand->cells);
> 												else fprintf(OUTFILE, "|\n");
> 												FirstAttempt = TRUE;
> 											}
> 										}
> 										TraceList[TraceCount++] = n+1;
> 										fprintf(OUTFILE,"%5d %5d %5d)  ",++tentativi,tuttitentativi,Residual++);
> 										for (ind6 = 0; ind6 <=  Iteration; ind6++)
> 											fprintf(OUTFILE,"%3d ",IndivElts[ind6]+labelorg);
> 										fprintf(OUTFILE,"| ");
> 										
> 										if (FirstInIteration) 
> 										{
> 											fprintf(OUTFILE,"... see above");
> 											FirstInIteration = FALSE;
> 											CopyVect(auxlab,NextCand->lab,n);
> 										}
> 										else
> 											while (NextCand->lab[n] < n)   // nodo - foglia
> 											{
> 												if (FirstAttempt) ran_next = 0; else ran_next = randInteger(0,1);
> 												if (ran_next)
> 												{
> 													ind6 = NextCand->lab[AUXn_pos];
> 													NextCand->lab[AUXn_pos] = NextCand->lab[AUXn_pos+ran_next];
> 													NextCand->lab[AUXn_pos+ran_next] = ind6;
> 												}
> 												
> 												AttemptPartition[AUXn_pos] = 0;
> 												NextCand->lab[n]++;
> 												
> 												NDistrib = 1;
> 												Distrib[1] = AUXn_pos;
> 												NClasses = 1;
> 												ActClasses[1] = 0;
> 												for (i = 0; i<n; i++)
> 												{
> 													QuozRapp[i] = 0;
> 													if ((AttemptPartition[i] == 0) && (i+1<n)) ActClasses[++NClasses] = i+1;
> 												}
> 												Raffina(NextCand,AttemptPartition,&NextCand->lab[n],n,&NextCand->lab[i_code]);
> 												ind5 = IndivCount;
> 												ind6 = NextCand->lab[n];
> 												IndivElts[IndivCount++] = NextCand->lab[AUXn_pos];
> 												fprintf(OUTFILE,"%3d ",NextCand->lab[AUXn_pos]+labelorg);
> 												
> 												if (FirstAttempt) 
> 												{
> 													CellSeq[ind5].cells = NextCand->lab[n];
> 													AUXn_pos = MultiRaffina(g,NextCand,AttemptPartition,m,n,verbose,orbits,&options,&stats);
> 													CellSeq[ind5].pos = AUXn_pos;
> 													if (NextCand->lab[n] == CellSeq[ind5].cells) CellSeq[ind5].flag = FALSE; 
> 													else CellSeq[ind5].flag = NextCand->lab[n];
> 													//if (verbose) fprintf(OUTFILE,"FA ");
> 												}
> 												else
> 												{
> 													if ((CellSeq[ind5].flag) || (NextCand->lab[n] != CellSeq[ind5].cells))
> 													{
> 														AUXn_pos = MultiRaffina(g,NextCand,AttemptPartition,m,n,verbose,orbits,&options,&stats);
> 														//if (verbose) fprintf(OUTFILE,"MR ");
> 													}
> 													else AUXn_pos = CellSeq[ind5].pos;
> 												}
> 												if (verbose) fprintf(OUTFILE,"(%d: %d⤏%d) ",AUXn_pos,ind6,NextCand->lab[n]);											   
> 											}
> 										if (FirstAttempt) 
> 										{
> 											FirstAttempt = FALSE;
> 										}
> 										AuxCand = NextCandList;
> 										while (AuxCand != NextCand)
> 										{
> 											for (i = 0; i < n; i++)
> 												permuta[AuxCand->lab[i]] = NextCand->lab[i];
> 											if (isautom(g,permuta,options.digraph,m,n))
> 											{
> 												CostruisciPermPerRSS(n,AuxCand->lab,NextCand->lab);
> 												if ((IdGroup) || (!isElementOf(LePerm,GrLe1)))	
> 												{	
> 													//strcat(striso,"▩");
> 													strcat(striso,"▮");
> 													newSize = TRUE;
> 													IdGroup = 0;
> 													GensSofar1[GrLeGens] = (int *)malloc(n*sizeof(int));
> 													for (i = 0; i < n; i++)
> 														GensSofar1[GrLeGens][i] = LePerm->image[i+1];
> 													GrLeGens++;
> 													if (printime) auxtime -= CPUTIME;
> 													groupFile = fopen( groupName,"w");
> 													fprintf( groupFile, "LIBRARY %s;\n", groupName);
> 													fprintf( groupFile, "%s: Permutation group(%d);\n", groupName,n);
> 													fprintf( groupFile, "%s.generators:\n", groupName);
> 													for (igen = 0; igen < GrLeGens; igen++)
> 													{
> 														fprintf( groupFile, "a%d = /%d",igen,GensSofar1[igen][0]);
> 														for (ind9 = 1; ind9 < n; ind9++)
> 															fprintf( groupFile, ",%d",GensSofar1[igen][ind9]);
> 														if (igen < GrLeGens-1) fprintf( groupFile, "/,\n");
> 													}
> 													fprintf( groupFile, "/;\nFINISH;");
> 													fclose( groupFile);
> 													
> 													argc = 3;
> 													sprintf(argv[1],"%s",groupName);
> 													sprintf(argv[2],"GruppoSGS");
> 													
> 													GrLe1 = (PermGroup *)Generate(argc,argv);
> 													if (printime) auxtime += CPUTIME;
> 													stats.numorbits = orbjoin(GroupOrbits,NewGenerator,n);
> 													
> 													if (!IdGroup)
> 													{
> 														if (printime) auxtime -= CPUTIME;
> 														if (AuxGrLe!=NULL)
> 															AuxGrLe = (PermGroup *)copyOfPermGroup2(GrLe1,AuxGrLe);
> 														else  
> 															AuxGrLe = (PermGroup *)copyOfPermGroup(GrLe1);
> 														if (Iteration)
> 														{
> 															argc = 3;
> 															sprintf(argv[1],"GruppoSGS");
> 															sprintf(argv[2],"%d",CurrCand->lab[IndivPos[0]]+1);
> 															for (i=1; i<Iteration; i++)
> 															{
> 																sprintf(chartemp,",%d",CurrCand->lab[IndivPos[i]]+1);
> 																strcat(argv[2],chartemp);
> 															}
> 														}
> 														else
> 														{
> 															argc = 2;
> 															sprintf(argv[1],"GruppoSGS");
> 														}
> 														Orblist2(argc,argv,orbits,AuxGrLe);
> 														if (printime) auxtime += CPUTIME;
> 													}
> 													
> 												}
> 												NextCand = NextCand->prev;
> 												NextCand->next = FreeCandidate(NextCand->next,n);
> 												break;
> 											}
> 											AuxCand = AuxCand->next;
> 										}
> 										if (newSize) 
> 										{
> 											fprintf(OUTFILE, " %s  size: ",striso);
> 											informGroupForAP(GrLe1);
> 											fprintf(OUTFILE, "; %d orbit%s.\n",SS(stats.numorbits,"","s"));
> 											TheGroupHasChanged = TRUE;
> 										}
> 										else
> 											fprintf(OUTFILE, "\n");
> 										newSize = FALSE;
> 										if (printquoz)
> 										{
> 											fprintf(OUTFILE, "aaa\n");
> 											for (i=0; i<n; i++)
> 												perm[i] = NextCand->lab[i];
> 											updatecan(g, canong, perm, 0, m, n);
> 											putgraph(OUTFILE,canong,0,m,n);
> 										}
> 										if (NextCand != NextCandList)
> 										{
> 											j = 0;
> 											singletons = 0;
> 											elim = n;
> 											for (i = 0; i<n; i++)
> 											{
> 												inverseptn[NextCand->lab[i]] = i;
> 												inverseptnList[NextCandList->lab[i]] = i;
> 												if (NextCand->ptn[i] == 0) 
> 													j = i+1;
> 											}
> 											for (i = 0; i<n; i++)
> 											{
> 												if ((NextCand->ptn[i] == 0) && ((i == 0) || (NextCand->ptn[i-1] == 0)))
> 												{
> 													singletons++;
> 													EMPTYSET(AuxSet,m);
> 													
> 													for (j=1; j<=GraphList[NextCand->lab[i]][0]; j++)
> 														ADDELEMENT(AuxSet,inverseptn[GraphList[NextCand->lab[i]][j]]);
> 													for (j=1; j<=GraphList[NextCandList->lab[i]][0]; j++)
> 														if (!ISELEMENT(AuxSet,inverseptnList[GraphList[NextCandList->lab[i]][j]]))
> 														{
> 															if (inverseptnList[GraphList[NextCandList->lab[i]][j]] < elim)
> 																elim = inverseptnList[GraphList[NextCandList->lab[i]][j]];
> 														}
> 														else
> 															DELELEMENT(AuxSet,inverseptnList[GraphList[NextCandList->lab[i]][j]]);
> 												}
> 											}
> 											if (elim < n) 
> 											{
> 											    //fprintf(OUTFILE,"ELIMINARE ");
> 												NextCand->cells = 0;
> 											}
> 											//if (elim < nextelement(AuxSet,m,-1)) fprintf(OUTFILE,"ALTRI; "); else fprintf(OUTFILE,"QUESTO; ");
> 											//fprintf(OUTFILE,"%d singletons\n",singletons);
> 											//putptn(OUTFILE,NextCand->lab,NextCand->ptn,0,options.linelength,n);
> 										}
> 									}
> 								}
> 							}
> 							while (CurrCand->ptn[ind3] && AllTree);
> 						}
> 						AuxCand = CurrCandList;
> 						CurrCandList = CurrCandList->next;
> 						free(AuxCand->lab);
> 						free(AuxCand->ptn);
> 						free(AuxCand);
> 					}
> 					if (AUXn_pos == -2)
> 					{
> 						NextCand = NextCand->prev;
> 						NextCand->next = FreeCandidate(NextCand->next,n);
> 					}
> 					n_pos = NextCandList->n_pos;
> 					Iteration++;
> 					IndivPos[Iteration] = n_pos;
> 				}      // 0 //
> 				
> 				timeafter = CPUTIME;
> 				
> 				li = 0;
> 				for (i = 0, gp = g; i < n; ++i, gp +=  m)
> 					li +=  setsize(gp,m);
> 				fprintf(OUTFILE,"────────────────────────────────────────────────────────────────\nGraph: %s; nodes: %d; edges = %ld\n",filename,n,li/2);
> 				if (GrLeGens)
> 				{
> 					fprintf(OUTFILE,"Group size: ");
> 					informGroupForAP(GrLe1);
> 					fprintf(OUTFILE,"; %d gen%s; %d orbit%s\n",SS(GrLeGens,"","s"),SS(stats.numorbits,"","s"));
> 				}
> 				else
> 				{
> 					fprintf(OUTFILE,"Group size: 1; %d orbits\n",n);
> 					stats.numorbits = n;
> 				}
> 				if (printime)
> 					fprintf(OUTFILE,"Cpu time = %.2f seconds; %d attempts (%d aborted); %d Mref steps; GroupTime = %.2f seconds\n",timeafter-timebefore,tentativi,tuttitentativi-tentativi,multirefs,auxtime);
> 				else
> 					fprintf(OUTFILE,"Cpu time = %.2f seconds; %d attempts (%d aborted); %d Mref steps.\a\n",timeafter-timebefore,tentativi,tuttitentativi-tentativi,multirefs);
> 				//fprintf(OUTFILE,"%.2f MR1, %.2f MR2, %.2f RPM, %.2f auxtime1, %.2f auxtime2, %.2f auxtime3(0), %.2f auxtime3(1), %.2f auxtime3(-1)\n",MR1time,MR2time,auxtime,auxtime1,auxtime2,auxtime30,auxtime31,auxtime32);
> 				
> 				fprintf(OUTFILE,"────────────────────────────────────────────────────────────────\nOrbits: ");
> 				if (stats.numorbits < 12)
> 					putorbitsList(OUTFILE,GroupOrbits,options.linelength,n);
> 				else
> 					if (GrLeGens) putorbits1(OUTFILE,GroupOrbits,options.linelength,n); else fprintf(OUTFILE, "all singletons\n");
> 				if (verbose)
> 				{
> 					fprintf(OUTFILE,"────────────────────────────────────────────────────────────────\nCandidati residui:\n");
> 					AuxCand = NextCandList;
> 					while (AuxCand)
> 					{
> 						if (AuxCand->cells) putptn(OUTFILE,AuxCand->lab,AuxCand->ptn,0,options.linelength,n);
> 						AuxCand = AuxCand->next;
> 					}
> 				}
> 				if (options.getcanon)
> 				{
> 					for (i=0; i<n; i++)
> 						perm[i] = NextCandList->lab[i];
> 					updatecan(g, canong, perm, 0, m, n);
> 					cvalid = TRUE;
> 				}
> 				EXIT; /* end APnauty */
> 				
> 				case 'f':   /* read initial partition */
> 				if (minus)
> 				{
> 					pvalid = FALSE;
> 					minus = FALSE;
> 				}
> 				else
> 				{
> 					readptn(INFILE,lab,ptn,&numcells,prompt,n);
> 					pvalid = TRUE;
> 				}
> 				ind0 = 0;
> 				if (ptn[0])
> 				{
> 					NClasses = 1;
> 					ActClasses[1] = 0;
> 				}
> 				for (i = 0; i<n; i++)
> 				{
> 					if (ptn[i] == 0) 
> 					{
> 						ind0 = i+1;
> 						if ((ind0<n) && (ptn[ind0])) ActClasses[++NClasses] = ind0;
> 					}
> 				}
> 				
> 				break;
> 				
> 				case 'F':   /* read initial partition + creaviste */
> 				if (minus)
> 				{
> 					pvalid = FALSE;
> 					minus = FALSE;
> 				}
> 				else
> 				{
> 					readptn(INFILE,lab,ptn,&numcells,prompt,n);
> 					pvalid = TRUE;
> 				}
> 				
> 				if (!pvalid)
> 					unitptn(lab,ptn,&numcells,n);
> 				cellstarts(ptn,0,active,m,n);
> 				refine(g,lab,ptn,0,&numcells,perm,active,&refcode,m,n);
> 				if (numcells > 1) pvalid = TRUE;
> 				
> 				ind0 = 0;
> 				if (ptn[0])
> 				{
> 					NClasses = 1;
> 					ActClasses[1] = 0;
> 				}
> 				for (i = 0; i<n; i++)
> 				{
> 					if (ptn[i] == 0) 
> 					{
> 						ind0 = i+1;
> 						if ((ind0<n) && (ptn[ind0])) ActClasses[++NClasses] = ind0;
> 					}
> 				}
> 				break;
> 				
> 				case 't':   /* type graph */
> 				minus = FALSE;
> 				if (!gvalid)
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 				else
> 					if ((d = getc(INFILE))  == 't')
> 					{
> 						options.linelength = 0;
> 						putcolgraph(OUTFILE,g,options.linelength,m,n,lab,ptn);
> 					}
> 					else
> 						putgraph(OUTFILE,g,options.linelength,m,n);
> 				break;
> 				
> 				case 'T':   /* type graph preceded by n, $ and g commands */
> 				minus = FALSE;
> 				if (!gvalid)
> 					fprintf(ERRFILE,"g is not defined\n\n");
> 				else
> 				{
> 					fprintf(OUTFILE,"n = %d $ = %d g\n",n,labelorg);
> 					putgraph(OUTFILE,g,options.linelength,m,n);
> 					fprintf(OUTFILE,"$$\n");
> 				}
> 				break;
> 				
> 				case 'u':   /* call user procs */
> 				if (minus)
> 				{
> 					umask = 0;
> 					minus = FALSE;
> 				}
> 				else
> 				{
> 					umask = getint(INFILE);
> 					if (umask < 0)
> 						umask = ~0;
> 				}
> 				if (umask & U_NODE)  options.usernodeproc = NODEPROC;
> 				else                 options.usernodeproc = NULL;
> 				if (umask & U_AUTOM) options.userautomproc = AUTOMPROC;
> 				else                 options.userautomproc = NULL;
> 				if (umask & U_LEVEL) options.userlevelproc = LEVELPROC;
> 				else                 options.userlevelproc = NULL;
> 				if (umask & U_TCELL) options.usertcellproc = TCELLPROC;
> 				else                 options.usertcellproc = NULL;
> 				if (umask & U_REF)   options.userrefproc = REFPROC;
> 				else                 options.userrefproc = NULL;
> 				break;
> 				
> 				case 'o':   /* type orbits */
> 				minus = FALSE;
> 				if (ovalid)
> 					putorbits(OUTFILE,orbits,options.linelength,n);
> 				else
> 					fprintf(ERRFILE,"orbits are not defined\n\n");
> 				break;
> 				
> 				case 'b':   /* type canonlab and canong */
> 				minus = FALSE;
> 				if (cvalid)
> 					putcanon(OUTFILE,lab,canong,options.linelength,m,n);
> 				else
> 					fprintf(ERRFILE,"h is not defined\n\n");
> 				break;
> 				
> 				case 'z':   /* type hashcode for canong */
> 				minus = FALSE;
> 				if (cvalid)
> 				{
> 					zseed = n;
> 					for (i = 0, gp = canong; i < n; ++i, gp +=  m)   
> 						zseed = sethash(gp,n,zseed,321);
> 					fprintf(OUTFILE,"[%7lx",zseed);
> 					
> 					for (i = 0, gp = canong; i < n; ++i, gp +=  m) 
> 						zseed = sethash(gp,n,zseed,3109);
> 					fprintf(OUTFILE," %7lx",zseed);
> 					
> 					for (i = 0, gp = canong; i < n; ++i, gp +=  m) 
> 						zseed = sethash(gp,n,zseed,4317); 
> 					fprintf(OUTFILE," %7lx]\n",zseed);
> 				}
> 				else
> 					fprintf(ERRFILE,"h is not defined\n\n");
> 				break;
> 				
> 				case 'c':   /* set getcanon option */
> 				options.getcanon = !minus;
> 				minus = FALSE;
> 				fprintf(PROMPTFILE,"Traces version Apr, 2008 (%s). Dreadnaut version %s.\n",(options.getcanon ? "Canonical" : "Aut Group"),NAUTYVERSION);
> 				break;
> 				
> 				case 'w':   /* read size of workspace */
> 				minus = FALSE;
> 				worksize = getint(INFILE);
> #if !MAXN
> 				DYNALLOC1(setword,workspace,workspace_sz,worksize,"dreadnaut");
> #else
> 				if (worksize > 2*MAXM*WORKSIZE)
> 				{
> 					fprintf(ERRFILE,
> 							"too big - setting worksize = %d\n\n", 2*MAXM*WORKSIZE);
> 					worksize = 2*MAXM*WORKSIZE;
> 				}
> #endif
> 				break;
> 				
> 				case 'l':   /* read linelength for output */
> 				options.linelength = getint(INFILE);
> 				minus = FALSE;
> 				break;
> 				
> 				case 'y':   /* set tc_level field of options */
> 				options.tc_level = getint(INFILE);
> 				minus = FALSE;
> 				break;
> 				
> 				case 'M':   /* set multiplicity */
> 				multiplicity = getint(INFILE);
> 				if (multiplicity <=  0) multiplicity = 1;
> 				minus = FALSE;
> 				break;
> 				
> 				case 'k':   /* set invarlev fields of options */
> 				options.mininvarlevel = getint(INFILE);
> 				options.maxinvarlevel = getint(INFILE);
> 				minus = FALSE;
> 				break;
> 				
> 				case 'K':   /* set invararg field of options */
> 				options.invararg = getint(INFILE);
> 				minus = FALSE;
> 				break;
> 				
> 				case '*':   /* set invarproc field of options */
> 				minus = FALSE;
> 				d = getint(INFILE);
> 				if (d >=  -1 && d <=  NUMINVARS-2)
> 				{
> 					options.invarproc = invarproc[d+1].entrypoint;
> 					invarprocname = invarproc[d+1].name;
> 					if (options.invarproc !=  NULL)
> 					{
> 						options.mininvarlevel = 0;
> 						options.maxinvarlevel = 1;
> 						if (options.invarproc  == indsets ||
> 							options.invarproc  == cliques ||
> 							options.invarproc  == cellind ||
> 							options.invarproc  == cellcliq)
> 							options.invararg = 3;
> 						else
> 							options.invararg = 0;
> 					}
> 				}
> 				else
> 					fprintf(ERRFILE,"no such vertex-invariant\n\n");
> 				break;
> 				
> 				case 'a':   /* set writeautoms option */
> 				options_writeautoms = !minus;
> 				minus = FALSE;
> 				break;
> 				
> 				case 'm':   /* set writemarkers option */
> 				options_writemarkers = !minus;
> 				minus = FALSE;
> 				break;
> 				
> 				case 'p':   /* set cartesian option */
> 				options.cartesian = !minus;
> 				minus = FALSE;
> 				break;
> 				
> 				case 'd':   /* set digraph option */
> 				if (options.digraph && minus)
> 					gvalid = FALSE;
> 				options.digraph = !minus;
> 				minus = FALSE;
> 				break;
> 				
> 				case '$':   /* set label origin */
> 				if ((d = getc(INFILE))  == '$')
> 					labelorg = oldorg;
> 				else
> 				{
> 					ungetc((char)d,INFILE);
> 					oldorg = labelorg;
> 					i = getint(INFILE);
> 					if (i < 0)
> 						fprintf(ERRFILE,"labelorg must be >=  0\n\n");
> 					else
> 						labelorg = i;
> 				}
> 				break;
> 				
> 				case '?':   /* type options, etc. */
> 				minus = FALSE;
> 				fprintf(OUTFILE,"m = %d n = %d labelorg = %d",m,n,labelorg);
> 				if (!gvalid)
> 					fprintf(OUTFILE," g = undef");
> 				else
> 				{
> 					li = 0;
> 					for (i = 0, gp = g; i < n; ++i, gp +=  m)
> 						li +=  setsize(gp,m);
> 					if (options.digraph)
> 						fprintf(OUTFILE," arcs = %ld",li);
> 					else
> 						fprintf(OUTFILE," edges = %ld",li/2);
> 				}
> 				fprintf(OUTFILE," options = (%cc%ca%cm%cp%cd",
> 						PM(options.getcanon),PM(options_writeautoms),
> 						PM(options_writemarkers),PM(options.cartesian),
> 						PM(options.digraph));
> 				if (umask & 31)
> 					fprintf(OUTFILE," u = %d",umask&31);
> 				if (options.tc_level > 0)
> 					fprintf(OUTFILE," y = %d",options.tc_level);
> 				if (options.mininvarlevel !=  0 || options.maxinvarlevel !=  0)
> 					fprintf(OUTFILE," k = (%d,%d)",
> 							options.mininvarlevel,options.maxinvarlevel);
> 				if (options.invararg > 0)
> 					fprintf(OUTFILE," K = %d",options.invararg);
> 				if (multiplicity > 1) fprintf(OUTFILE," M = %d",multiplicity);
> 				fprintf(OUTFILE,")\n");
> 				fprintf(OUTFILE,"linelen = %d worksize = %d input_depth = %d",
> 						options.linelength,worksize,curfile);
> 				if (options.invarproc !=  NULL)
> 					fprintf(OUTFILE," invarproc = %s",invarprocname);
> 				if (pvalid)
> 					fprintf(OUTFILE,"; %d cell%s",SS(numcells,"","s"));
> 				else
> 					fprintf(OUTFILE,"; 1 cell");
> 				fprintf(OUTFILE,"\n");
> 				if (OUTFILE !=  PROMPTFILE)
> 					fprintf(PROMPTFILE,"m = %d n = %d depth = %d labelorg = %d\n",
> 							m,n,curfile,labelorg);
> 				break;
> 				
> 				case '&':   /* list the partition and possibly the quotient */
> 				if ((d = getc(INFILE))  == '&')
> 					doquot = TRUE;
> 				else
> 				{
> 					ungetc((char)d,INFILE);
> 					doquot = FALSE;
> 				}
> 				minus = FALSE;
> 				if (pvalid)
> 					putptn(OUTFILE,lab,ptn,0,options.linelength,n);
> 				else
> 					fprintf(OUTFILE,"unit partition\n");
> 				if (doquot)
> 				{
> 					if (!pvalid) unitptn(lab,ptn,&numcells,n);
> 					putquotient(OUTFILE,g,lab,ptn,0,options.linelength,m,n);
> 				}
> 				break;
> 				
> 				case 'h':   /* type help information */
> 				case 'H':
> 				minus = FALSE;
> 				help(PROMPTFILE,c  == 'H');
> 				break;
> 				
> 				default:    /* illegal command */
> 				fprintf(ERRFILE,"'%c' is illegal - type 'h' for help\n\n",c);
> 				flushline(INFILE);
> 				if (prompt) fprintf(PROMPTFILE,"> ");
> 				break;
> 				
> 		}  /* end of switch */
> 	
1063,1066c2095,2098
< *                                                                            *
< *  help(f,i) writes help information to file f (i = 0,1).                    *
< *                                                                            *
< *****************************************************************************/
---
>  *                                                                            *
>  *  help(f,i) writes help information to file f (i = 0,1).                    *
>  *                                                                            *
>  *****************************************************************************/
1072,1113c2104,2145
< 
< if (i == 0)
< {
< H("+- a : write automs        v : write degrees    *=# : select invariant:")
< H("   b : write canong      w=# : set worksize")
< H("+- c : canonise            x : run nauty         -1 = user-defined")
< H("+- d : digraph or loops  y=# : set tc_level       0 = none")
< H("   e : edit graph          z : write hashcode     1 = twopaths")
< H("-f, f=#, f=[...] : set colours                    2 = adjtriang(K=0,1)")
< H("   g : read graph        $=# : set origin         3 = triples")
< H(" h,H : help               $$ : restore origin     4 = quadruples")
< H("   i : refine              ? : type options       5 = celltrips")
< H("   I : refine using invar  _ : compl  __ : conv   6 = cellquads")
< H("   j : relabel randomly    % : Mathon doubling    7 = cellquins")
< H("k=# # : set invar levels   & : type colouring     8 = distances(K)")
< H(" K=# : set invar param    && : + quotient matrix  9 = indsets(K)")
< H(" l=# : set line length   >ff : write to file     10 = cliques(K)")
< H("+- m : write markers    >>ff : append to file    11 = cellcliq(K)")
< H(" n=# : set order          -> : revert to stdout  12 = cellind(K)")
< H("   o : write orbits      <ff : read from file    13 = adjacencies")
< H("+- p : set autom format    @ : save canong       14 = cellfano")
< H("   q : quit                # : canong = savedg?  15 = cellfano2")
< H(" r,R : relabel/subgraph   ## : + write mapping")
< H(" s=# : random g (p=1/#)  \"...\" : copy comment")
< H(" t,T : type graph          ! : ignore line      Type H for more..")
< }
< 
< if (i == 1)
< {
< H("Commands for g and e : ")
< H("   There is always a \"current vertex\" v, initially first vertex.")
< H("   # : add edge v=#       ; : increment v (exit if over limit)")
< H("  -# : delete edge v=#   #: : set v := #")
< H("   ? : list nbhs of v     . : exit")
< H("Syntax for f :  f=[2 3|4:9|10]  (rest in extra cell at right)")
< H("               -f same as f=[], f=# same as f=[#]")
< H("Syntax for r :  r 2:4 1 5;    (rest appended in order)")
< H("Syntax for R :  R 2:4 1 5;   or  -R 0 3 6:10;")
< H("Arguments for u : 1=node,2=autom,4=level,8=tcell,16=ref (add them)")
< H("Accurate times for easy graphs: M=# selects number of times to run.")
< }
< 
---
> 	
> 	if (i  == 0)
> 	{
> 		H("+- a : write automs        v : write degrees    * = # : select invariant:")
> 		H("   b : write canong      w = # : set worksize")
> 		H("+- c : canonise            x : run nauty         -1 = user-defined")
> 		H("+- d : digraph or loops  y = # : set tc_level       0 = none")
> 		H("   e : edit graph          z : write hashcode     1 = twopaths")
> 		H("-f, f = #, f = [...] : set colours                    2 = adjtriang(K = 0,1)")
> 		H("   g : read graph        $ = # : set origin         3 = triples")
> 		H(" h,H : help               $$ : restore origin     4 = quadruples")
> 		H("   i : refine              ? : type options       5 = celltrips")
> 		H("   I : refine using invar  _ : compl  __ : conv   6 = cellquads")
> 		H("   j : relabel randomly    % : Mathon doubling    7 = cellquins")
> 		H("k = # # : set invar levels   & : type colouring     8 = distances(K)")
> 		H(" K = # : set invar param    && : + quotient matrix  9 = indsets(K)")
> 		H(" l = # : set line length   >ff : write to file     10 = cliques(K)")
> 		H("+- m : write markers    >>ff : append to file    11 = cellcliq(K)")
> 		H(" n = # : set order          -> : revert to stdout  12 = cellind(K)")
> 		H("   o : write orbits      <ff : read from file    13 = adjacencies")
> 		H("+- p : set autom format    @ : save canong       14 = cellfano")
> 		H("   q : quit                # : canong = savedg?  15 = cellfano2")
> 		H(" r,R : relabel/subgraph   ## : + write mapping")
> 		H(" s = # : random g (p = 1/#)  \"...\" : copy comment")
> 		H(" t,T : type graph          ! : ignore line      Type H for more..")
> 	}
> 	
> 	if (i  == 1)
> 	{
> 		H("Commands for g and e : ")
> 		H("   There is always a \"current vertex\" v, initially first vertex.")
> 		H("   # : add edge v = #       ; : increment v (exit if over limit)")
> 		H("  -# : delete edge v = #   #: : set v : =  #")
> 		H("   ? : list nbhs of v     . : exit")
> 		H("Syntax for f :  f = [2 3|4:9|10]  (rest in extra cell at right)")
> 		H("               -f same as f = [], f = # same as f = [#]")
> 		H("Syntax for r :  r 2:4 1 5;    (rest appended in order)")
> 		H("Syntax for R :  R 2:4 1 5;   or  -R 0 3 6:10;")
> 		H("Arguments for u : 1 = node,2 = autom,4 = level,8 = tcell,16 = ref (add them)")
> 		H("Accurate times for easy graphs: M = # selects number of times to run.")
> 	}
> 	
1117,1121c2149,2153
< *                                                                            *
< *  usernode(g,lab,ptn,level,numcells,tc,code,m,n) is a simple version of the *
< *  procedure named by options.usernodeproc.                                  *
< *                                                                            *
< *****************************************************************************/
---
>  *                                                                            *
>  *  usernode(g,lab,ptn,level,numcells,tc,code,m,n) is a simple version of the *
>  *  procedure named by options.usernodeproc.                                  *
>  *                                                                            *
>  *****************************************************************************/
1127,1137c2159,2172
<         register int i;
< 
<         for (i = 0; i < level; ++i) PUTC('.',OUTFILE);
<         if (numcells == n)
<             fprintf(OUTFILE,"(n/%d)\n",code);
<         else if (tc < 0)
<             fprintf(OUTFILE,"(%d/%d)\n",numcells,code);
<         else
<             fprintf(OUTFILE,"(%d/%d/%d)\n",numcells,code,tc);
<         if (firstpath) putptn(OUTFILE,lab,ptn,level,options.linelength,n);
<         if (numcells == n) firstpath = FALSE;
---
> 	register int i;
> 	
> 	for (i = 0; i < level; ++i) PUTC('.',OUTFILE);
> 	if (numcells  == n)
> 	{
> 		fprintf(OUTFILE,"(n/%d)\n",code);
> 		putptn(OUTFILE,lab,ptn,level,options.linelength,n);
> 	}
> 	else if (tc < 0)
> 		fprintf(OUTFILE,"(%d/%d)\n",numcells,code);
> 	else
> 		fprintf(OUTFILE,"(%d/%d/%d)\n",numcells,code,tc);
> 	if (firstpath) putptn(OUTFILE,lab,ptn,level,options.linelength,n);
> 	if (numcells  == n) firstpath = FALSE;
1141,1145c2176,2180
< *                                                                            *
< *  userautom(count,perm,orbits,numorbits,stabvertex,n) is a simple           *
< *  version of the procedure named by options.userautomproc.                  *
< *                                                                            *
< *****************************************************************************/
---
>  *                                                                            *
>  *  userautom(count,perm,orbits,numorbits,stabvertex,n) is a simple           *
>  *  version of the procedure named by options.userautomproc.                  *
>  *                                                                            *
>  *****************************************************************************/
1151,1154c2186,2189
<         fprintf(OUTFILE,
<              "**userautomproc:  count=%d stabvertex=%d numorbits=%d\n",
<              count,stabvertex+labelorg,numorbits);
<         putorbits(OUTFILE,orbits,options.linelength,n);
---
> 	fprintf(OUTFILE,
> 			"**userautomproc:  count = %d stabvertex = %d numorbits = %d\n",
> 			count,stabvertex+labelorg,numorbits);
> 	putorbits(OUTFILE,orbits,options.linelength,n);
1158,1162c2193,2197
< *                                                                            *
< *  userlevel(lab,ptn,level,orbits,stats,tv,index,tcellsize,numcells,cc,n)    *
< *  is a simple version of the procedure named by options.userlevelproc.      *
< *                                                                            *
< *****************************************************************************/
---
>  *                                                                            *
>  *  userlevel(lab,ptn,level,orbits,stats,tv,index,tcellsize,numcells,cc,n)    *
>  *  is a simple version of the procedure named by options.userlevelproc.      *
>  *                                                                            *
>  *****************************************************************************/
1168,1169c2203,2204
<       fprintf(OUTFILE,
<             "**userlevelproc:  level=%d tv=%d index=%d tcellsize=%d cc=%d\n",
---
> 	fprintf(OUTFILE,
>             "**userlevelproc:  level = %d tv = %d index = %d tcellsize = %d cc = %d\n",
1171c2206
<       fprintf(OUTFILE,"    nodes=%ld cells=%d orbits=%d generators=%d\n",
---
> 	fprintf(OUTFILE,"    nodes = %ld cells = %d orbits = %d generators = %d\n",
1173a2209,3067
> 
> /*****************************************************************************
>  *                                                                            *
>  *  Procedure per raffinamento                                                *
>  *                                                                            *
>  *****************************************************************************/
> void Graph2List(graph gra[MAXM*1L*MAXN], int n, int m, int *List[MAXN])
> {
> 	register int iq,jq;
> 	
> 	for (iq = 0; iq < n; iq++) List[iq][0] = 0;
> 	for (iq = 0; iq < n; iq++) 
> 	{
> 		List[iq][0] = 0;
> 		for (jq = -1; (jq = nextelement(GRAPHROW(gra,iq,m),m,jq)) >=  0;)
> 		{
> 			(List[iq][0])++;
> 			List[iq][List[iq][0]] = jq;
> 		}
> 	}
> }
> 
> void IsStronglyReg(graph gra[MAXM*1L*MAXN], int n, int m)
> {
> 	register int iq,jq,adj,nonadj,auxadj,auxnonadj,i;
> 	
> 	adj = -1;
> 	nonadj = -1;
> 	
> 	for (iq = 0; iq < n; iq++)
> 		for (jq = iq+1; jq < n; jq++) 
> 		{
> 			auxadj = 0;
> 			auxnonadj = 0;
> 
> 			if (ISELEMENT(GRAPHROW(gra,iq,m),jq))
> 			{
> 				for(i=0; i<n; i++)
> 					if ((ISELEMENT(GRAPHROW(gra,iq,m),i)) && (ISELEMENT(GRAPHROW(gra,jq,m),i))) auxadj++;
> 				if (adj == -1) 
> 				{
> 				//fprintf(OUTFILE,"Adj(%d,%d) = %d\n",iq,jq,auxadj);
> 				adj = auxadj; 
> 				}
> 				else 
> 					if (adj != auxadj) 
> 					{
> 						//fprintf(OUTFILE,"Adj(%d,%d) = %d\n",iq,jq,auxadj);
> 						return;
> 					}
> 			}
> 			else
> 			{
> 				for(i=0; i<n; i++)
> 					if ((ISELEMENT(GRAPHROW(gra,iq,m),i)) && (ISELEMENT(GRAPHROW(gra,jq,m),i))) auxnonadj++;
> 				if (nonadj == -1) 
> 				{
> 				nonadj = auxnonadj; 
> 				//fprintf(OUTFILE,"NonAdj(%d,%d) = %d\n",iq,jq,auxnonadj);
> 				}
> 				else 
> 					if (nonadj != auxnonadj) 
> 					{
> 						//fprintf(OUTFILE,"NonAdj(%d,%d) = %d\n",iq,jq,auxnonadj);
> 						return;
> 					}
> 			}
> 		}
> 	iq = 0;
> 	for (jq = -1; (jq = nextelement(GRAPHROW(gra,0,m),m,jq)) >=  0;) iq++;
> 	if (nonadj == -1) nonadj = 0;
> 	fprintf(OUTFILE,"Strongly Regular (%d,%d,%d,%d)\n",n,iq,adj,nonadj);
> 	return;
> }
> 
> void PrintList(int *List[MAXN], int n)
> {
> 	register int iq,jq;
> 	
> 	for (iq = 0; iq < n; iq++)
> 		if (List[iq][0]>0)
> 		{
> 			fprintf(OUTFILE,"%3d: ",iq+labelorg);
> 			for (jq = 1; jq <=  List[iq][0]; jq++)
> 				fprintf(OUTFILE,"%d ",List[iq][jq]+labelorg);
> 			fprintf(OUTFILE,"\n");
> 		}
> }
> 
> void swap(int *i, int *j)
> {
> 	int k;
> 	k = *i; *i = *j; *j = k;
> 	return;
> }
> 
> void CopyVect(int *from, int *to, int n)
> {
> 	int i;
> 	for (i = 0; i<n; i++)
> 		to[i] = from[i];
> 	return;
> }
> 
> int CfrVect(int *a, int *b, int st, int c)
> {
> 	int i;
> 	if (a[0] < b[0]) return(-1);
> 	if (a[0] > b[0]) return(1);
> 	
> 	for (i = st+1; i<=c; i++)
> 	{
> 		//fprintf(OUTFILE,"(%d,%d,%d)\n",i,a[i],b[i]);
> 		if (a[i] < b[i]) return(-1);
> 		if (a[i] > b[i]) return(1);
> 	}
> 	return(0);
> }
> int CfrVectPlus(int *a, int *b, int st, int c, int n)
> {
> 	int i;
> 	if (a[0] < b[0]) return(-1);
> 	if (a[0] > b[0]) return(1);
> 	if (a[n] < b[n]) return(-1);
> 	if (a[n] > b[n]) return(1);
> 	
> 	for (i = st+1; i<=c; i++)
> 	{
> 		//fprintf(OUTFILE,"(%d,%d,%d)\n",i,a[i],b[i]);
> 		if (a[i] < b[i]) return(-1);
> 		if (a[i] > b[i]) return(1);
> 	}
> 	return(0);
> }
> 
> void PrintVect(int *v, int z, int n, int l)
> {
> 	int i;
> 	for (i = z; i<n; i++)
> 		fprintf(OUTFILE," %d",v[i]+l);
> 	fprintf(OUTFILE,"\n");
> 	return;
> }
> 
> void PrintVectD(long *v, int z, int n)
> {
> 	int i;
> 	for (i = z; i<n; i++)
> 		fprintf(OUTFILE,"%d; ",v[i]);
> 	fprintf(OUTFILE,"\n");
> 	return;
> }
> 
> void PrintVectNoCR(int *v, int z, int n, int l) 
> {
> 	int i;
> 	for (i = z; i<n; i++)
> 		fprintf(OUTFILE," %d",v[i]+l);
> 	fprintf(OUTFILE," ");
> 	return;
> }
> 
> void Raffina(Candidate *Cand, int *ptn, int *numcells, int n, int *code)
> {
> 	int value, row, i, j, ind0, ind1, ind2;
> 	int *GL,*QS;
> 	long long longcode;
> 	//int IntCode;
> 	int *lab;
> 	
> 	lab = Cand->lab;
> 	longcode = *numcells;
> 	//IntCode = *numcells;
> 	while (NDistrib>0)
> 	{					
> 		if (*numcells == n) break;
> 		i = Distrib[NDistrib--];	
> 		ind2 = i;
> 		do
> 		{
> 			GL = GraphList[lab[i]];
> 			for (j = 1; j<= GL[0]; j++) (QuozRapp[GL[j]])++;
> 		}
> 		while (ptn[i++]);
> 		NCR = 0;
> 		for (i = 1; i <=  NClasses; i++)
> 		{
> 			ind1 = ActClasses[i];
> 			if (ptn[ind1])
> 			{
> 				ind0 = ind1;
> 				value = QuozRapp[lab[ind1]];
> 				do 
> 				{
> 					if (QuozRapp[lab[++ind1]]!= value)
> 					{
> 						ClassRapp[++NCR] = ind0;
> 						break;
> 					}
> 				}
> 				while (ptn[ind1]);
> 			}
> 			else
> 			{
> 				longcode = MASH(longcode,QuozRapp[lab[ind1]]);
> 				//IntCode = abs(IntCode*n+QuozRapp[lab[ind1]]);
> 			}
> 		}
> 		
> 		for (i = 1; i <= NCR; i++)
> 		{
> 			ind1 = ClassRapp[i];
> 			ind0 = ind1;
> 			do
> 			{
> 				value = lab[ind1];
> 				QS = QuozSplit[QuozRapp[value]];
> 				QS[++(QS[0])] = value;	
> 				QuozRapp[value] = 0;
> 			}
> 			while (ptn[ind1++]);
> 			ind1 = ind0-1;
> 			for (row = 0; row<n; row++)
> 			{
> 				QS = QuozSplit[row];
> 				if (QS[0]>0)
> 				{
> 					for (j = 1; j<= QS[0]; j++)
> 					{
> 						lab[++ind1] = QS[j];
> 					}
> 					QS[0] = 0;
> 					if (!ptn[ind1]) break;
> 					else 
> 					{
> 						ptn[ind1] = 0;
> 						(*numcells)++;	
> 						ind0 = ind1+1;
> 						Distrib[++NDistrib] = ind0;
> 						ActClasses[++NClasses] = ind0;
> 						
> 						if (TraceRaff) 
> 						{
> 							if (PrintTrace) fprintf(OUTFILE,"%d ",ind0);
> 							if (TraceCfr)
> 								if (FirstTrace) TraceList[TraceCount++] = ind0;
> 								else
> 								{
> 									if (ind0 > TraceList[TraceCount])
> 									{
> 										*code = -1;
> 										for (j=row; j<n; j++)
> 											QuozSplit[j][0] = 0;
> 										if (PrintTrace) 
> 											fprintf(OUTFILE," exit (R)\n ");
> 										return;
> 									}
> 									if (ind0 < TraceList[TraceCount])
> 									{
> 										TraceList[TraceCount++] = ind0;
> 										FirstTrace = TRUE;
> 										AuxCand = NextCandList;
> 										do AuxCand = FreeCandidate(AuxCand,n); while (AuxCand != NextCand);
> 										AuxCand->prev = NULL;
> 										NextCandList = AuxCand;
> 									}
> 									else TraceCount++;
> 								}
> 						}
> 						longcode = MASH(longcode,ind0);
> 						//IntCode = abs(IntCode*n+ind0);
> 					}
> 				}
> 			}
> 		}
> 	}
> 	*code = CLEANUP(longcode);	
> 	return;
> 	//*code = IntCode;
> }
> 
> int MultiRaffina(graph *g, Candidate *Cand,int *act_ptn,int m, int n, int verbose,
> 				 int *orbits, optionblk *options, statsblk *stats)
> {                               
> 	int i,j = 0;
> 	int orb = 0;
> 	int i0 = 0;
> 	int i1 = 0;
> 	int i2 = 0;
> 	int i3 = 0;
> 	int i4 = 0;
> 	int i5 = 0;
> 	int split = 0;
> 	const int i_code = n+1, i_cell = n+2, i_perm = n+3, i_flag = n+5, i_where = n+6, i_split = n+7;
> 	int NCells = 0;
> 	int N_pos = 0;
> 	char chartemp[10];
> 	
> 	int *MRLab,*SP,*QR;	
> 	static set prossime[MAXM];
> 	int *act_lab;
> 	multirefs++;
> 	act_lab = Cand->lab;
> 	if (!IdGroup)
> 	{
> 		if (printime) auxtime -= CPUTIME;
> 		if (AuxGrLe!=NULL)
> 			AuxGrLe = (PermGroup *)copyOfPermGroup2(GrLe1,AuxGrLe);
> 		else  
> 			AuxGrLe = (PermGroup *)copyOfPermGroup(GrLe1);
> 		argc = 3;
> 		sprintf(argv[1],"GruppoSGS");
> 		sprintf(argv[2],"%d",IndivElts[0]+1);
> 		for (i=1; i<IndivCount; i++)
> 		{
> 			sprintf(chartemp,",%d",IndivElts[i]+1);
> 			strcat(argv[2],chartemp);
> 		}
> 		Orblist2(argc,argv,APAuxSgrOrb,AuxGrLe);
> 		if (printime) auxtime += CPUTIME;
> 	}
> 	tuttitentativi++;
> 	if (Trace) 
> 	{
> 		if (PrintTrace) 
> 		{
> 			fprintf(OUTFILE,"((");
> 			PrintVectNoCR(IndivElts,0,IndivCount,labelorg);
> 			fprintf(OUTFILE,")) ");
> 		}
> 		fprintf(OUTFILE,"%5d %5d %5d)  ",tentativi,tuttitentativi,Residual);
> 		for (ind6 = 0; ind6 <=  Iteration; ind6++)
> 			fprintf(OUTFILE,"%3d ",IndivElts[ind6]+labelorg);
> 		fprintf(OUTFILE,"\r");
> 	}
> 	TraceCount = 0;
> 	NCells = act_lab[n];
> 	do
> 	{	
> 		split = FALSE;
> 		if ((act_lab[n] != n) && (NCells < n ))
> 		{
> 			cellstarts(act_ptn,0,prossime,m,n);
> 			ordina(act_lab,act_ptn,n);
> 			for (i0 = -1; (i0 = nextelement(prossime,m,i0)) >= 0;)
> 				if (act_ptn[i0])
> 				{	
> 					for (i1 = 0; i1 < n; i1++)
> 						MR_ptn[i1] = act_ptn[i1];
> 					
> 					MR_ptn[i0] = 0;
> 					//if (PrintTrace) fprintf(OUTFILE,"{%d}",i0);
> 					for (i3 = i0;; i3++) 
> 					{
> 						MRLab = MR_lab[i3]; 						
> 						orb = APAuxSgrOrb[act_lab[i3]];
> 						if (orb != act_lab[i3])
> 						{
> 							MRLab[i_flag] = 0;
> 							MRLab[i_where] = where[orb];
> 						}
> 						else 
> 						{	
> 							MRLab[i_where] = i3;
> 							where[act_lab[i3]] = i3;
> 							for (i1 = 0; i1 < n; i1++)
> 								MRLab[i1] = act_lab[i1];
> 							i4 = MRLab[i0];
> 							MRLab[i0] = MRLab[i3];
> 							MRLab[i3] = i4;	
> 							
> 							MRLab[n] = act_lab[n]+1;
> 							MRLab[i_code] = 0;
> 							MRLab[i_cell] = i0;
> 							MRLab[i_perm] = MRLab[i0];
> 							MRLab[i_flag] = 1;
> 							
> 							NDistribMR = 1;
> 							DistribMR[1] = i0;
> 							NClassesMR = 1;
> 							ActClassesMR[1] = 0;
> 							QR = QuozRapp2D[i3];
> 							for (i = 0; i<n; i++)
> 							{
> 								QR[i] = 0;
> 								if ((MR_ptn[i] == 0) && (i+1<n)) ActClassesMR[++NClassesMR] = i+1;
> 							}
> 						}					
> 						if (act_ptn[i3] == 0) break;
> 					}
> 					MR_ptn[n] = act_lab[n]+1;
> 					while ((NDistribMR > 0) && (!split) && (NCells<n)) 
> 					{
> 						split = RaffinaPerMult(n,m,i0,i3);
> 						
> 						if (split == -1) 
> 							NCells = n;
> 						if (split == 1) 
> 						{
> 							for (i = i0; i <= i3; i++) 
> 							{
> 								SP = SplitPositions[MR_lab[MR_lab[i][i_where]][i_split]];
> 								SP[++SP[0]] = act_lab[i];
> 							}
> 							i5 = i0;
> 							for (i=0; i<=PrtInd; i++)
> 							{
> 								SP = SplitPositions[PartClass[i]];
> 								for (i2=1; i2<=SP[0]; i2++)
> 									act_lab[i5++] = SP[i2];
> 								if (act_ptn[i5-1])
> 								{
> 									act_ptn[i5-1] = 0;
> 									act_lab[n]++;
> 									
> 									if (Trace) 
> 									{
> 										if (PrintTrace) 
> 											fprintf(OUTFILE,"[%d] ",i5);
> 										if (TraceCfr)
> 											if (FirstTrace) TraceList[TraceCount++] = i5;
> 											else
> 											{
> 												if (i5 > TraceList[TraceCount])
> 												{
> 													if (PrintTrace) 
> 														fprintf(OUTFILE," exit (MR1), cells: %d\n",Cand->lab[n]);
> 													for (j = i0; j <= i3; j++) 
> 														SplitPositions[j][0] = 0;
> 													return (-2);
> 												}
> 												if (i5 < TraceList[TraceCount])
> 												{
> 													TraceList[TraceCount++] = i5;
> 													FirstTrace = TRUE;
> 													AuxCand = NextCandList;
> 													do AuxCand = FreeCandidate(AuxCand,n); while (AuxCand != NextCand);
> 													AuxCand->prev = NULL;
> 													NextCandList = AuxCand;
> 												}
> 												else TraceCount++;
> 											}
> 									}
> 								}
> 								SP[0] = 0;
> 							}
> 							NDistrib = 1;
> 							Distrib[1] = i0;
> 							NClasses = 1;
> 							ActClasses[1] = 0;
> 							for (i = 0; i<n; i++)
> 							{
> 								QuozRapp[i] = 0;
> 								if ((act_ptn[i] == 0) && (i+1<n)) ActClasses[++NClasses] = i+1;
> 							}
> 							if (Trace) 
> 								TraceRaff = TRUE;
> 							Raffina(Cand,act_ptn,&act_lab[n],n,&act_lab[i_code]);
> 							if (Trace) 
> 							{
> 								TraceRaff = FALSE;
> 								if (PrintTrace) fprintf(OUTFILE,"(%d) ",act_lab[n]);
> 							}
> 							if (act_lab[n] == n)
> 							{
> 								NCells = n;
> 								act_lab[n] = n;
> 								N_pos = -1;
> 							}
> 							if (act_lab[i_code] == -1) 
> 								return (-2);
> 						}
> 						else
> 						{
> 							if (NCells < MR_ptn[n]) 
> 							{
> 								NCells = MR_ptn[n];
> 								N_pos = i0;
> 								act_lab[i_code] = SplitPositions[i0][n];
> 							}
> 							if (NCells == n)
> 							{
> 								CopyVect(MR_lab[PrtInd],act_lab,n);
> 								CopyVect(MR_ptn,act_ptn,n);
> 								act_lab[n] = n;
> 								act_lab[i_code] = SplitPositions[PrtInd][n];
> 								N_pos = -1;
> 								if (Trace) 
> 									if (PrintTrace) fprintf(OUTFILE,"<%d> ",PrtInd);
> 							}
> 						}
> 					}
> 				}
> 		}
> 	}
> 	while (split==TRUE);
> 	if (TraceCount > TraceLen) TraceLen = TraceCount;
> 	if (Trace) 
> 	{
> 		if ((TraceCount < TraceLen) && (!FirstTrace)) 
> 			return (-2);
> 		if (TraceCount > TraceLen) TraceLen = TraceCount;
> 		if (PrintTrace) fprintf(OUTFILE,"\n");
> 		FirstTrace = FALSE;
> 	}
> 	return(N_pos);
> }
> 
> 
> int RaffinaPerMult(int n, int m, int inizio, int fine)
> {
> 	int value, row, i, j, k, ind0, ind1, numcells, i3;
> 	int *GL,*QS,*QR,*SP,*SP1;
> 	int *MRLab;
> 	static set SplitClass[MAXN];
> 	int PART = 0;
> 	int Part1 = 0;
> 	int Start = 0;
> 	const int i_flag = n+5, i_split = n+7;
> 	//long long longcode;
> 	int IntCode;
> 	
> 	k = DistribMR[NDistribMR];
> 	for (i3 = inizio; i3 <= fine; i3++) 
> 	{
> 		MRLab = MR_lab[i3];
> 		if (MRLab[i_flag] && (MRLab[n] != n))
> 		{
> 			QR = QuozRapp2D[i3];
> 			i = k;
> 			do
> 			{
> 				GL = GraphList[MRLab[i]];
> 				ind0 = GL[0];
> 				for (j = 1; j<= ind0; j++) 
> 					(QR[GL[j]])++;
> 			}
> 			while (MR_ptn[i++]);
> 		}
> 	}
> 	NDistribMR--;
> 	EMPTYSET(SplitClass,m);
> 	for (i3 = inizio; i3 <= fine; i3++) 
> 		if (MR_lab[i3][i_flag])
> 		{
> 			SP = SplitPositions[i3];
> 			//longcode = numcells;
> 			IntCode = numcells;
> 			MRLab = MR_lab[i3];
> 			QR = QuozRapp2D[i3];
> 			for (i = 1,ind1 = ActClassesMR[1]; i <=  NClassesMR; i++,ind1 = ActClassesMR[i])
> 			{
> 				if ((MR_ptn[ind1]) && (!ISELEMENT(SplitClass,ind1)))
> 				{
> 					ind0 = ind1;
> 					value = QR[MRLab[ind1]];
> 					do 
> 					{
> 						if (QR[MRLab[++ind0]]!= value)
> 						{
> 							ADDELEMENT(SplitClass,ind1);
> 							break;
> 						}
> 					}
> 					while (MR_ptn[ind0]);
> 				}
> 				else
> 					if (!MR_ptn[ind1]) 
> 					{
> 						//longcode = MASH(longcode,QR[MRLab[ind1]]);
> 						IntCode = abs(IntCode*n+QR[MRLab[ind1]]);
> 					}
> 			}
> 			//SP[n]=CLEANUP(longcode);
> 			SP[n] = IntCode;
> 		}
> 	PrtInd = -1;
> 	Start = 0;
> 	for (ind1 = -1; (ind1 = nextelement(SplitClass,m,ind1)) >=  0;)
> 		if (!PART)
> 		{
> 			Start = SplitPositions[inizio][0];
> 			for (i3 = inizio; i3 <= fine; i3++) 
> 				if (MR_lab[i3][i_flag])
> 				{
> 					ind0 = ind1;
> 					MRLab = MR_lab[i3];
> 					QR = QuozRapp2D[i3];
> 					do
> 					{
> 						value = MRLab[ind0];
> 						QS = QuozSplit[QR[value]];
> 						QS[++(QS[0])] = value;	
> 					}
> 					while (MR_ptn[ind0++]);					
> 					ind0 = ind1;
> 					SP = SplitPositions[i3];
> 					
> 					for (row = 0; row<n; row++)  					  
> 					{
> 						QS = QuozSplit[row];
> 						if (QS[0]>0)
> 						{
> 							for (j = 1; j<= QS[0]; j++)
> 								MRLab[ind0++] = QS[j];
> 							QS[0] = 0;
> 							if (!MR_ptn[ind0-1]) 
> 								break;
> 							else
> 								SP[++SP[0]] = ind0;
> 						}
> 					}
> 					if (PrtInd == -1)
> 					{
> 						PartClass[++PrtInd] = i3;
> 						MRLab[i_split] = i3;
> 					}
> 					else
> 					{
> 						k=0;
> 						do
> 						{
> 							SP1 = SplitPositions[PartClass[k]];
> 							Part1 = CfrVectPlus(SP1,SP,Start,SP1[0],n);
> 							switch (Part1) 
> 							{
> 								case -1:
> 									break;
> 								case 0:
> 									MRLab[i_split] = MR_lab[PartClass[k]][i_split];
> 									break;
> 								case 1:
> 									PrtInd++;
> 									for (j=PrtInd; j>=k; j--)
> 										PartClass[j] = PartClass[j-1];   
> 									PartClass[k] = i3;
> 									MRLab[i_split] = i3;
> 									break;
> 							}
> 							k++;
> 						}
> 						while ((k<=PrtInd) && (Part1 == -1));
> 					}
> 					if (Part1 == -1)
> 					{
> 						PartClass[++PrtInd] = i3;
> 						MRLab[i_split] = i3;
> 					}
> 					if (PrtInd > 0) PART = 1;
> 				} 		   
> 		}
> 	if (PART) 
> 	{	
> 		for (i3 = inizio; i3 <= fine; i3++) 
> 			SplitPositions[i3][0] = 0;
> 		return(1);
> 	}
> 	else
> 	{	
> 		SP1 = SplitPositions[inizio];
> 		for (i3 = 1; i3 <= SP1[0]; i3++) 
> 		{
> 			MR_ptn[SP1[i3]-1] = 0;
> 			MR_ptn[n]++;
> 			DistribMR[++NDistribMR] = SP1[i3];
> 			if (MR_ptn[SP1[i3]]) ActClassesMR[++NClassesMR] = SP1[i3];
> 		}
> 		for (i3 = inizio; i3 <= fine; i3++) 
> 		{
> 			SplitPositions[i3][0] = 0;
> 		}
> 		if (MR_ptn[n] == n)
> 		{
> 			k = -1;
> 			for (i3 = inizio; i3 <= fine; i3++) 
> 			{
> 				if (MR_lab[i3][i_flag])
> 				{
> 					if (k == -1) k=i3;
> 					else
> 					{
> 						for (i = 0; i < n; i++)
> 							permuta[MR_lab[k][i]] = MR_lab[i3][i];
> 						if (isautom(g,permuta,options.digraph,m,n))
> 						{
> 							CostruisciPermPerRSS(n,MR_lab[k],MR_lab[i3]);
> 							
> 							if ((IdGroup) || (!isElementOf(LePerm,GrLe1)))
> 							{	
> 								//strcat(striso,"▧");
> 								strcat(striso,"▯");
> 								newSize = TRUE;
> 								IdGroup = 0;
> 								GensSofar1[GrLeGens] = (int *)malloc(n*sizeof(int));
> 								for (i = 0; i < n; i++)
> 									GensSofar1[GrLeGens][i] = LePerm->image[i+1];
> 								GrLeGens++;
> 								if (printime) auxtime -= CPUTIME;
> 								groupFile = fopen( groupName,"w");
> 								fprintf( groupFile, "LIBRARY %s;\n", groupName);
> 								fprintf( groupFile, "%s: Permutation group(%d);\n", groupName,n);
> 								fprintf( groupFile, "%s.generators:\n", groupName);
> 								for (igen = 0; igen < GrLeGens; igen++)
> 								{
> 									fprintf( groupFile, "a%d = /%d",igen,GensSofar1[igen][0]);
> 									for (ind9 = 1; ind9 < n; ind9++)
> 										fprintf( groupFile, ",%d",GensSofar1[igen][ind9]);
> 									if (igen < GrLeGens-1) fprintf( groupFile, "/,\n");
> 								}
> 								fprintf( groupFile, "/;\nFINISH;");
> 								fclose( groupFile);
> 								
> 								argc = 3;
> 								sprintf(argv[1],"%s",groupName);
> 								sprintf(argv[2],"GruppoSGS");
> 								
> 								GrLe1 = (PermGroup *)Generate(argc,argv);
> 								if (printime) auxtime += CPUTIME;	
> 								stats.numorbits = orbjoin(GroupOrbits,NewGenerator,n);
> 								
> 								if (!IdGroup)
> 								{
> 									if (printime) auxtime -= CPUTIME;
> 									if (AuxGrLe!=NULL)
> 										AuxGrLe = (PermGroup *)copyOfPermGroup2(GrLe1,AuxGrLe);
> 									else  
> 										AuxGrLe = (PermGroup *)copyOfPermGroup(GrLe1);
> 									if (Iteration)
> 									{
> 										argc = 3;
> 										sprintf(argv[1],"GruppoSGS");
> 										sprintf(argv[2],"%d",CurrCand->lab[IndivPos[0]]+1);
> 										for (i=1; i<Iteration; i++)
> 										{
> 											sprintf(chartemp,",%d",CurrCand->lab[IndivPos[i]]+1);
> 											strcat(argv[2],chartemp);
> 										}
> 									}
> 									else
> 									{
> 										argc = 2;
> 										sprintf(argv[1],"GruppoSGS");
> 									}
> 									Orblist2(argc,argv,orbits,AuxGrLe);
> 									if (printime) auxtime += CPUTIME;
> 								}
> 							}
> 						}
> 					}
> 				}
> 			}
> 			PrtInd = k;
> 			return(-1);
> 		}
> 		return(0);			   
> 	}
> }
> 
> void ScriviGrLe(PermGroup *PG)
> {
> 	int i;
> 	informGroup(PG);
> 	printf( "Base:               ");
> 	for ( i = 1 ; i <= PG->baseSize ; ++i )
> 		printf( " %5u", PG->base[i]);
> 	printf(   "\nBasic orbit lengths:");
> 	for ( i = 1 ; i <= PG->baseSize ; ++i )
> 		printf( " %5u", PG->basicOrbLen[i]);
> 	printf( "\n");
> 	
> 	/* Write declaration for group. */
> 	fprintf( OUTFILE, "%s:  Permutation group (%u);", PG->name, PG->degree);
> 	
> 	/* Write the base. */
> 	//	if ( PG->base ) {
> 	//		fprintf( OUTFILE, "\n%s.base:  seq(", PG->name);
> 	//		for ( i = 1 ; i < PG->baseSize ; ++i )
> 	//			fprintf( OUTFILE,  "%u,", PG->base[i]);
> 	//		if ( PG->baseSize > 0 )
> 	//			fprintf( OUTFILE, "%u", PG->base[PG->baseSize]);
> 	//		fprintf( OUTFILE, ");");
> 	//	}
> 	/* Write out the strong generators, or generators if the base is not
> 	 known. */
> 	if ( PG->base )
> 		fprintf( OUTFILE, "\n%s.strong generators:", PG->name);
> 	else
> 		fprintf( OUTFILE, "\n%s.generators:", PG->name);
> 	
> 	/*	for ( gen = PG->generator ; gen ; gen = gen->next )
> 	 if ( gen->name[0] != '*' && 
> 	 (gen->level <= PG->baseSize) ) {
> 	 fprintf( OUTFILE, "\n  ");
> 	 if ( !PG->base && gen->name[0] != '\0' ) {
> 	 fprintf( OUTFILE, "%s = ", gen->name);
> 	 }
> 	 for ( i = 1 ; i <= gen->degree-1 ; ++i ) 
> 	 fprintf( OUTFILE, "%u,", gen->image[i] );
> 	 fprintf( OUTFILE, "%u", gen->image[gen->degree] );
> 	 
> 	 
> 	 if ( gen->next )
> 	 fprintf( OUTFILE, "%c", ',');
> 	 else
> 	 fprintf( OUTFILE, "%s", ";");
> 	 }
> 	 */
> 	/* Write "finish". */
> 	fprintf( OUTFILE, "\n----------\n");
> 	
> }
> 
> void CostruisciPermPerRSS(int n, int *p, int *q)
> {
> 	int i;
> 	
> 	//	for ( i = 1 ; i <= n+1 ; ++i )
> 	//		LePerm->image[i] = i;
> 	
> 	for ( i = 1 ; i <= n ; ++i )
> 		LePerm->image[p[i-1]+1] = q[i-1]+1;
> 	LePerm->image[n+1] = n+1;
> 	for ( i = 0 ; i < n ; ++i )
> 		NewGenerator[i] = LePerm->image[i+1]-1;
> }
> 
> struct Candidate *NewCandidate(int n)
> {
> 	struct Candidate *Cand;
> 	if ( ( Cand = (struct Candidate *)malloc(sizeof(struct Candidate)) )  == NULL )
> 	{
> 		fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 		exit(1);
> 	}
> 	if ( ( Cand->lab = (int *)malloc((n+10)*sizeof(int)) )  == NULL )
> 	{
> 		fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 		exit(1);
> 	}
> 	if ( ( Cand->ptn = (int *)malloc(n*sizeof(int)) )  == NULL )
> 	{
> 		fprintf(OUTFILE,"\nError, memory not allocated.\n");
> 		exit(1);
> 	}
> 	Cand->n_pos = -1;
> 	Cand->next = NULL;
> 	Cand->prev = NULL;
> 	return (Cand);
> }
> 
> struct Candidate *FreeCandidate(struct Candidate *Cand, int n)
> {
> 	struct Candidate *AuxCand;
> 	AuxCand = Cand->next;
> 	free(Cand->lab);
> 	free(Cand->ptn);
> 	free(Cand);
> 	return (AuxCand);
> }

