/* This program demonstrates how known automorphisms can be given to Traces. We compute the automorphism group of the circulant graph of order n with i is adjacent to j iff j-i is a square mod n. We need that -1 is a square so that the graph is undirected, which means that the prime factors of n must be congruent to 1 mod 4. (This is the Paley graph in the event that p is a prime.)
*/
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 processing one graph, but it doesn't hurt. 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 any extra automorphims it found, in a circular list
pointed to by gens. See schreier.txt for documentation. */
} else break;
}
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.