/* This program demonstrates how known automorphisms can be given toTraces.Wecomputetheautomorphismgroupofthecirculant graphofordernwithiisadjacenttojiffj-iisasquare modn.Weneedthat-1isasquaresothatthegraphis undirected,whichmeansthattheprimefactorsofnmustbe congruentto1mod4.(ThisisthePaleygraphintheevent thatpisaprime.)
*/
for (i = 0; i < n; ++i) issquare[i] = FALSE; for (i = 0; i < n; ++i) issquare[(i*i)%n] = TRUE; if (!issquare[n-1])
{
printf("-1 must be a square mod n; try again\n"); continue;
}
deg = 0; for (i = 1; i < n; ++i) if (issquare[i]) ++deg;
/* Now make the graph */
SG_ALLOC(sg,n,n*deg,"malloc");
sg.nv = n; /* Number of vertices */
sg.nde = n*deg; /* Number of directed edges */
for (i = 0; i < n; ++i)
{
sg.v[i] = i*deg; /* Position of vertex i in v array */
sg.d[i] = deg; /* Degree of vertex i */
}
for (i = 0; i < n; ++i) /* Edges */
{
k = sg.v[i]; for (j = 1; j < n; ++j) if (issquare[j]) sg.e[k++] = (i + j) % n;
}
/* Add known automorphisms */
/* We wouldn't need freeschreier() if we were only processingonegraph,butitdoesn'thurt.This
is how to properly dispose of previous generators. */
freeschreier(NULL,&gens);
/* Cyclic rotation */ for (i = 0; i < n; ++i) p[i] = (i + 1) % n;
addpermutation(&gens,p,n);
/* Reflection about 0 */ for (i = 0; i < n; ++i) p[i] = (n - i) % n;
addpermutation(&gens,p,n);
/* Call Traces */
Traces(&sg,lab,ptn,orbits,&options,&stats,NULL);
printf("Automorphism group size = ");
writegroupsize(stdout,stats.grpsize1,stats.grpsize2);
printf("\n");
/* Traces left the automorphims we gave it, augmented by anyextraautomorphimsitfound,inacircularlist
pointed to by gens. See schreier.txt for documentation. */
} else break;
}
exit(0);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.