#define HELPTEXT \ " Take the complements of a file of graphs.\n\
\n\
The output file has a header ifand only if the input file does.\n\
The output format is defined by the header or first graph.\n\
\n\
-r Only complement if the complement has fewer directed edges.\n\
-R Only complement if the complement has fewer directed edges\n\ or has the same number of directed edges and is canonically\n\
less than the original.\n\
-a Also output the input graph (before the complement).\n\
-L Complement the loops too. By default, preserve them.\n\
-l Canonically label outputs.\n\
-q Suppress auxiliary information.\n"
staticvoid compl(graph *g, int m, int n, graph *h, boolean comploops) /* h := complement of g */
{ int i,j;
setword *gi,*hi; #if MAXN
set all[MAXM]; #else
DYNALLSTAT(set,all,all_sz);
DYNALLOC1(set,all,all_sz,m,"complg"); #endif
EMPTYSET(all,m); for (i = 0; i < n; ++i) ADDELEMENT(all,i);
gi = (setword*) g;
hi = (setword*) h;
for (i = 0; i < n; ++i)
{ for (j = 0; j < m; ++j) hi[j] = gi[j] ^ all[j]; if (!comploops) FLIPELEMENT(hi,i);
gi += m;
hi += m;
}
}
if (codetype&HAS_HEADER)
{ if (outcode == SPARSE6) writeline(outfile,SPARSE6_HEADER); elseif (outcode == DIGRAPH6) writeline(outfile,DIGRAPH6_HEADER); else writeline(outfile,GRAPH6_HEADER);
}
nauty_check(WORDSIZE,1,1,NAUTYVERSIONID);
nin = 0;
t = CPUTIME; while (TRUE)
{ if ((g = readgg(infile,NULL,0,&m,&n,&digraph)) == NULL) break;
++nin; #if !MAXN
DYNALLOC2(graph,gc,gc_sz,n,m,"complg"); #endif
if (restricted || Restricted)
{
ned = loops = 0;
gwords = m * (size_t)n;
nn = n * (size_t)(n-1); for (ii = 0; ii < gwords; ++ii) ned += POPCOUNT(g[ii]); for (ii = 0; ii < n; ++ii) if (ISELEMENT(g+m*ii,ii)) ++loops; if (Lswitch)
{
loopsc = n - loops;
nedc = nn + n - (ned-loops)/2;
} else
{
loopsc = loops;
nedc = nn - (ned-3*loops)/2;
}
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 ist noch experimentell.