nauty_kill_request = 1;
129 for(
intj = 0; j < permlen; ++j)
131 if( (
int) p[j] != j )
191 "symmetry computation terminated early, because number of cells %d in Nauty exceeds limit of %d\n",
194 "for running full symmetry detection, increase value of parameter propagating/symmetry/nautymaxncells\n");
200 "symmetry computation terminated early, because number of" 203 "for running full symmetry detection, increase value of" 204 " parameter propagating/symmetry/nautymaxnnodes\n");
210nauty_kill_request = 1;
236nauty_kill_request = 1;
252 for(j = 0; j < permlen; ++j)
254 if( (
int) p[j] != j )
305assert(symgraph !=
NULL);
315 if( first < 0 && second < 0 )
321 if( first < 0 || second < 0 )
327 if( first >= 0 && second >= 0 )
335 else if( first >= 0 )
365 int** colorstostore,
366 int* ncolorstostore,
382assert( SG !=
NULL|| determinesize );
383assert( internodeid !=
NULL);
384assert( *internodeid >= 0 );
385assert( degrees !=
NULL);
386assert( maxdegrees !=
NULL);
387assert( *maxdegrees > 0 );
389assert( nedges !=
NULL);
390assert( neighbors !=
NULL);
391assert( colors !=
NULL);
392assert( naddednodes !=
NULL);
393assert( naddededges !=
NULL);
394assert( commonnodeidx <= *internodeid );
403curcolor = colors[0];
405 for(e = 1; e < nneighbors; ++e)
408 if( colors[e] != curcolor )
414(*degrees)[*internodeid] = 1;
415++(*degrees)[commonnodeidx];
416(*colorstostore)[*internodeid] = curcolor;
418 for(f = curstart; f < e; ++f)
420assert( neighbors[f] <= *internodeid );
421++(*degrees)[*internodeid];
422++(*degrees)[neighbors[f]];
427SG->e[edgestartpos[commonnodeidx]++] = *internodeid;
428SG->e[edgestartpos[*internodeid]++] = commonnodeidx;
430 for(f = curstart; f < e; ++f)
432SG->e[edgestartpos[neighbors[f]]++] = *internodeid;
433SG->e[edgestartpos[*internodeid]++] = neighbors[f];
437*naddededges += e - curstart + 1;
440curcolor = colors[e];
451(*degrees)[*internodeid] = 1;
452++(*degrees)[commonnodeidx];
453(*colorstostore)[*internodeid] = curcolor;
455 for(f = curstart; f < nneighbors; ++f)
457assert( neighbors[f] <= *internodeid );
458++(*degrees)[*internodeid];
459++(*degrees)[neighbors[f]];
464SG->e[edgestartpos[commonnodeidx]++] = *internodeid;
465SG->e[edgestartpos[*internodeid]++] = commonnodeidx;
467 for(f = curstart; f < nneighbors; ++f)
469SG->e[edgestartpos[*internodeid]++] = neighbors[f];
470SG->e[edgestartpos[neighbors[f]]++] = *internodeid;
474*naddededges += nneighbors - curstart + 1;
499 int* groupfirsts =
NULL;
500 int* groupseconds =
NULL;
501 int* groupcolors =
NULL;
503 intedgebegincnt = 0;
515assert( symgraph !=
NULL);
516assert( SG !=
NULL|| determinesize );
518assert( nedges !=
NULL);
519assert( degrees !=
NULL);
520assert( maxdegrees !=
NULL);
521assert( colors !=
NULL);
522assert( ncolors !=
NULL);
523assert( success !=
NULL);
533nvarnodestoadd = nsymvars;
537nvarnodestoadd = 2 * nsymvars;
553 for(j = 0; j < *
nnodes; ++j)
560 for(j = 0; j < nvarnodestoadd; ++j)
570 for(j = 0; j < *
nnodes; ++j)
572SG->d[j] = (*degrees)[j];
573SG->v[j] = (size_t) (
unsigned) edgebegincnt;
574pos[j] = edgebegincnt;
575edgebegincnt += (*degrees)[j];
599first += nvarnodestoadd;
601second = -second - 1;
603second += nvarnodestoadd;
615groupfirsts[ngroupedges] = first;
616groupseconds[ngroupedges] = second;
620groupfirsts[ngroupedges] = second;
621groupseconds[ngroupedges] = first;
628assert(0 <= first && first < *
nnodes);
629assert(0 <= second && second < *
nnodes);
639++(*degrees)[second];
640(*degrees)[internodeid] = 2;
648assert( internodeid < *
nnodes);
651SG->e[pos[first]++] = internodeid;
652SG->e[pos[internodeid]++] = first;
653SG->e[pos[second]++] = internodeid;
654SG->e[pos[internodeid]++] = second;
656assert( first == *
nnodes- 1 || pos[first] <= (
int) SG->v[first+1] );
657assert( second == *
nnodes- 1 || pos[second] <= (
int) SG->v[second+1] );
658assert( internodeid == *
nnodes- 1 || pos[internodeid] <= (
int) SG->v[internodeid+1] );
668++(*degrees)[second];
674SG->e[pos[first]++] = second;
675SG->e[pos[second]++] = first;
677assert( first == *
nnodes- 1 || pos[first] <= (
int) SG->v[first+1] );
678assert( second == *
nnodes- 1 || pos[second] <= (
int) SG->v[second+1] );
685 if( ngroupedges > 0 )
694firstnodeidx = groupfirsts[0];
696 for(j = 1; j < ngroupedges; ++j)
699 if( groupfirsts[j] != firstnodeidx )
702degrees, maxdegrees, colors, ncolors,
nnodes, nedges, firstnodeidx, &groupseconds[firstidx],
703&groupcolors[firstidx], j - firstidx, &naddednodes, &naddededges) );
706firstnodeidx = groupfirsts[j];
711*nedges += naddededges;
718degrees, maxdegrees, colors, ncolors,
nnodes, nedges, firstnodeidx, &groupseconds[firstidx],
719&groupcolors[firstidx], ngroupedges - firstidx, &naddednodes, &naddededges) );
724*nedges += naddededges;
738 for(j = 0; j < nvarnodestoadd; ++j)
744 for(j = 0; j < nsymvars; ++j)
746SG->e[pos[j]++] = j + nsymvars;
747SG->e[pos[j + nsymvars]++] = j;
749assert( pos[j] <= (
int) SG->v[j+1] );
750assert( j + nsymvars == *
nnodes- 1 || pos[j+nsymvars] <= (
int) SG->v[j+nsymvars+1] );
794 int* nnodesfromgraph1,
802 int* nvarused1 =
NULL;
803 int* nvarused2 =
NULL;
804 int* varlabel =
NULL;
805 int* groupfirsts =
NULL;
806 int* groupseconds =
NULL;
807 int* groupcolors =
NULL;
810 intedgebegincnt = 0;
826assert( graph1 !=
NULL);
827assert( graph2 !=
NULL);
828assert( SG !=
NULL|| determinesize );
830assert( nedges !=
NULL);
831assert( degrees !=
NULL);
832assert( maxdegrees !=
NULL);
833assert( colors !=
NULL);
834assert( ncolors !=
NULL);
835assert( nusedvars !=
NULL);
836assert( ! determinesize || nnodesfromgraph1 !=
NULL);
837assert( success !=
NULL);
860nvarnodestoadd = nsymvars;
864nvarnodestoadd = 2 * nsymvars;
872 for(e = 0; e < nsymedges; ++e)
877nvarused1[-first - 1] += 1;
879nvarused1[-second - 1] += 1;
884nvarused2[-first - 1] += 1;
886nvarused2[-second - 1] += 1;
889 for(j = 0; j < nvarnodestoadd; ++j)
892 if( nvarused1[j] != nvarused2[j] )
903varlabel[j] = nusdvars++;
924 for(j = 0; j < *
nnodes; ++j)
926SG->d[j] = (*degrees)[j];
927SG->v[j] = (size_t) (
unsigned) edgebegincnt;
928pos[j] = edgebegincnt;
929edgebegincnt += (*degrees)[j];
943 for(i = 0; i < 2; ++i)
946symgraph = i == 0 ? graph1 : graph2;
953 for(j = 0; j < nvarnodestoadd; ++j)
955 if( varlabel[j] >= 0 )
958(*degrees)[nodeshift + varlabel[j]] = 0;
969(*degrees)[nodeshift + nusdvars + j] = 0;
978 for(j = 0; j < nvarnodestoadd; ++j)
980 if( varlabel[j] >= 0 )
987internodeid = nodeshift + curnnodes;
988 for(e = 0; e < nsymedges; ++e)
995first = varlabel[-first - 1];
997first = nusdvars + first;
999second = varlabel[-second - 1];
1001second = nusdvars + second;
1011groupfirsts[ngroupedges] = nodeshift + first;
1012groupseconds[ngroupedges] = nodeshift + second;
1016groupfirsts[ngroupedges] = nodeshift + second;
1017groupseconds[ngroupedges] = nodeshift + first;
1024assert(0 <= first && first < *
nnodes);
1025assert(0 <= second && second < *
nnodes);
1030 if( determinesize )
1035++(*degrees)[nodeshift + first];
1036++(*degrees)[nodeshift + second];
1037(*degrees)[internodeid] = 2;
1040(*colors)[internodeid] = nusdvars + color;
1047assert( internodeid < *
nnodes);
1049SG->e[pos[internodeid]++] = nodeshift + first;
1050SG->e[pos[internodeid]++] = nodeshift + second;
1051SG->e[pos[nodeshift + first]++] = internodeid;
1052SG->e[pos[nodeshift + second]++] = internodeid;
1054assert( internodeid == *
nnodes- 1
1055|| pos[internodeid] <= (
int) SG->v[internodeid+1] );
1056assert( nodeshift + first == *
nnodes- 1
1057|| pos[nodeshift + first] <= (
int) SG->v[nodeshift+first+1] );
1058assert( nodeshift + second == *
nnodes- 1 ||
1059pos[nodeshift + second] <= (
int) SG->v[nodeshift+second+1] );
1066 if( determinesize )
1068++(*degrees)[nodeshift + first];
1069++(*degrees)[nodeshift + second];
1074SG->e[pos[nodeshift + first]++] = nodeshift + second;
1075SG->e[pos[nodeshift + second]++] = nodeshift + first;
1077assert( nodeshift+first == *
nnodes- 1 || pos[nodeshift+first] <= (
int) SG->v[nodeshift+first+1] );
1078assert( nodeshift+second == *
nnodes- 1 || pos[nodeshift+second] <= (
int) SG->v[nodeshift+second+1] );
1085 if( ngroupedges > 0 )
1094firstnodeidx = groupfirsts[0];
1096 for(j = 1; j < ngroupedges; ++j)
1099 if( groupfirsts[j] != firstnodeidx )
1102degrees, maxdegrees, colors, ncolors,
nnodes, nedges, firstnodeidx,
1103&groupseconds[firstidx], &groupcolors[firstidx], j - firstidx, &naddednodes, &naddededges) );
1106firstnodeidx = groupfirsts[j];
1108 if( determinesize )
1111*nedges += naddededges;
1113curnnodes += naddednodes;
1119degrees, maxdegrees, colors, ncolors,
nnodes, nedges, firstnodeidx,
1120&groupseconds[firstidx], &groupcolors[firstidx], ngroupedges - firstidx, &naddednodes, &naddededges) );
1122 if( determinesize )
1125*nedges += naddededges;
1127curnnodes += naddednodes;
1133 if( determinesize )
1135 for(j = 0; j < nusdvars; ++j)
1136++(*degrees)[nodeshift + j];
1137(*nedges) += nusdvars / 2;
1141 for(j = 0; j < nusdvars/2; ++j)
1143SG->e[pos[nodeshift+j]++] = nodeshift + j + nusdvars/2;
1144SG->e[pos[nodeshift + j + nusdvars/2]++] = nodeshift + j;
1146assert( pos[nodeshift+j] <= (
int) SG->v[nodeshift+j+1] );
1147assert( nodeshift+j+nusdvars/2 == *
nnodes- 1
1148|| pos[nodeshift+j+nusdvars/2] <= (
int) SG->v[nodeshift+j+nusdvars/2+1] );
1152nodeshift = curnnodes;
1155 if( determinesize && i == 0 )
1156*nnodesfromgraph1 = *
nnodes;
1160 if( determinesize )
1166 for(j = 0; j < *
nnodes- 1; ++j)
1169(*nedges) += *
nnodes- 1;
1170(*colors)[*
nnodes- 1] = 8;
1174 for(j = 0; j < *
nnodes- 1; ++j)
1176SG->e[pos[j]++] = *
nnodes- 1;
1177SG->e[pos[*
nnodes-1]++] = j;
1191 if( determinesize )
1192*nusedvars = nusdvars;
1205static const char nautyname[] = {
'N',
'a',
'u',
't',
'y',
' ', NAUTYVERSIONID/10000 +
'0',
'.', (NAUTYVERSIONID%10000)/1000 +
'0',
'.', (NAUTYVERSIONID%1000)/10 +
'0',
'\0'};
1207static const char nautyname[] = {
'T',
'r',
'a',
'c',
'e',
's',
' ', NAUTYVERSIONID/10000 +
'0',
'.', (NAUTYVERSIONID%10000)/1000 +
'0',
'.', (NAUTYVERSIONID%1000)/10 +
'0',
'\0'};
1220 return "Computing Graph Automorphism Groups by Brendan D. McKay (https://users.cecs.anu.edu.au/~bdm/nauty/)";
1222 return "Computing Graph Automorphism Groups by Adolfo Piperno (https://pallini.di.uniroma1.it/)";
1267DEFAULTOPTIONS_SPARSEGRAPH(options);
1270 staticDEFAULTOPTIONS_TRACES(options);
1278*log10groupsize = 0;
1284options.writeautoms =
FALSE;
1286options.defaultptn =
FALSE;
1290options.writeautoms =
FALSE;
1291options.userautomproc = traceshook;
1292options.defaultptn =
FALSE;
1299°rees, &maxdegrees, &colors, &ncolors, &success) );
1304 "Stopped symmetry computation: Symmetry graph would become too large.\n");
1311SG_ALLOC(SG, (
size_t)
nnodes, 2 * (
size_t)(
unsigned) nedges,
"malloc");
1314SG.nde = (size_t) (
unsigned) (2 * nedges);
1318°rees, &maxdegrees, &colors, &ncolors, &success) );
1328 for(v = 0; v <
nnodes; ++v)
1335 for(v = 0; v <
nnodes; ++v)
1337 if( v <
nnodes-1 && colors[v] == colors[v+1] )
1359sparsenauty(&SG, lab, ptn, orbits, &options, &stats,
NULL);
1361Traces(&SG, lab, ptn, orbits, &options, &stats,
NULL);
1391*log10groupsize = log10(stats.grpsize1 * pow(10.0, (
SCIP_Real) stats.grpsize2));
1416assert( G1 !=
NULL);
1417assert( G2 !=
NULL);
1425&colors, &ncolors, &nusedvars, &nnodesfromG1, &success) );
1442DEFAULTOPTIONS_SPARSEGRAPH(options);
1445 staticDEFAULTOPTIONS_TRACES(options);
1452options.writeautoms =
FALSE;
1454options.defaultptn =
FALSE;
1457options.writeautoms =
FALSE;
1458options.userautomproc = traceshook;
1459options.defaultptn =
FALSE;
1465SG_ALLOC(SG, (
size_t)
nnodes, 2 * (
size_t)(
unsigned) nedges,
"malloc");
1468SG.nde = (size_t) (
unsigned) (2 * nedges);
1472&colors, &ncolors, &nusedvars,
NULL, &success) );
1477#ifdef SCIP_DISABLED_CODE 1482 for(v = 0; v < SG.nv; ++v)
1487 for(v = 0; v < SG.nv; ++v)
1492 for(v = 0; v < SG.nv; ++v)
1494 for(
int w= 0;
w< SG.d[v]; ++
w)
1507 for(v = 0; v <
nnodes; ++v)
1514 for(v = 0; v <
nnodes; ++v)
1516 if( v <
nnodes-1 && colors[v] == colors[v+1] )
1522#ifdef SCIP_DISABLED_CODE 1525 for(v = 0; v < SG.nv; ++v)
1546sparsenauty(&SG, lab, ptn, orbits, &options, &stats,
NULL);
1548Traces(&SG, lab, ptn, orbits, &options, &stats,
NULL);
1566 for(
inti = 0; i < nnodesfromG1; ++i)
interface for symmetry computations
static _Thread_local NAUTY_DATA data_
SCIP_Bool SYMcheckGraphsAreIdentical(SCIP *scip, SYM_SYMTYPE symtype, SYM_GRAPH *G1, SYM_GRAPH *G2)
const char * SYMsymmetryGetName(void)
static const char nautyname[]
static void nautyhook(int count, int *p, int *orbits, int numorbits, int stabvertex, int n)
const char * SYMsymmetryGetAddName(void)
SCIP_Bool SYMcanComputeSymmetry(void)
const char * SYMsymmetryGetDesc(void)
static SCIP_RETCODE createOrDetermineSizeGraphCheck(SCIP *scip, SYM_GRAPH *graph1, SYM_GRAPH *graph2, SCIP_Bool determinesize, sparsegraph *SG, int *nnodes, int *nedges, int **degrees, int *maxdegrees, int **colors, int *ncolors, int *nusedvars, int *nnodesfromgraph1, SCIP_Bool *success)
static void nautyterminationhook(graph *g, int *lab, int *ptn, int level, int numcells, int tc, int code, int m, int n)
static SCIP_RETCODE addOrDetermineEffectOfGroupedEdges(SCIP *scip, sparsegraph *SG, int *edgestartpos, SCIP_Bool determinesize, int *internodeid, int **degrees, int *maxdegrees, int **colorstostore, int *ncolorstostore, int *nnodes, int *nedges, int commonnodeidx, int *neighbors, int *colors, int nneighbors, int *naddednodes, int *naddededges)
static SCIP_RETCODE createOrDetermineSizeGraph(SCIP *scip, SYM_GRAPH *symgraph, SCIP_Bool determinesize, sparsegraph *SG, int *nnodes, int *nedges, int **degrees, int *maxdegrees, int **colors, int *ncolors, SCIP_Bool *success)
static SCIP_Bool isEdgeGroupable(SYM_GRAPH *symgraph, int edgeidx, SCIP_Bool groupbycons)
const char * SYMsymmetryGetAddDesc(void)
SCIP_RETCODE SYMcomputeSymmetryGenerators(SCIP *scip, int maxgenerators, SYM_GRAPH *symgraph, int *nperms, int *nmaxperms, int ***perms, SCIP_Real *log10groupsize, SCIP_Real *symcodetime)
Constraint handler for linear constraints in their most general form, .
constraint handler for nonlinear constraints specified by algebraic expressions
#define SCIP_CALL_ABORT(x)
private functions to work with algebraic expressions
power and signed power expression handlers
variable expression handler
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_RETCODE SCIPgetIntParam(SCIP *scip, const char *name, int *value)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPensureBlockMemoryArray(scip, ptr, arraysizeptr, minsize)
#define SCIPallocClearBufferArray(scip, ptr, num)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
void SCIPsortIntInt(int *intarray1, int *intarray2, int len)
void SCIPsortIntIntInt(int *intarray1, int *intarray2, int *intarray3, int len)
SYM_NODETYPE SCIPgetSymgraphNodeType(SYM_GRAPH *graph, int nodeidx)
int SCIPgetSymgraphEdgeFirst(SYM_GRAPH *graph, int edgeidx)
SCIP_Bool SCIPhasGraphUniqueEdgetype(SYM_GRAPH *graph)
int SCIPgetSymgraphVarnodeColor(SYM_GRAPH *graph, int nodeidx)
int SCIPgetSymgraphNEdges(SYM_GRAPH *graph)
SYM_SYMTYPE SCIPgetSymgraphSymtype(SYM_GRAPH *graph)
int SCIPgetSymgraphEdgeSecond(SYM_GRAPH *graph, int edgeidx)
int SCIPgetSymgraphNConsnodes(SYM_GRAPH *graph)
int SCIPgetSymgraphNVars(SYM_GRAPH *graph)
SCIP_Bool SCIPisSymgraphEdgeColored(SYM_GRAPH *graph, int edgeidx)
int SCIPgetSymgraphNodeColor(SYM_GRAPH *graph, int nodeidx)
int SCIPgetSymgraphEdgeColor(SYM_GRAPH *graph, int edgeidx)
int SCIPgetSymgraphNNodes(SYM_GRAPH *graph)
public methods for memory management
methods for dealing with symmetry detection graphs
enum SCIP_Retcode SCIP_RETCODE
enum SYM_Symtype SYM_SYMTYPE
enum SYM_Nodetype SYM_NODETYPE
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4