#define HELPTEXT \ " Take the converse digraphs of a file of directed graphs.\n\
\n\
The output file has a header ifand only if the input file does.\n\
Undirected graphs are passed through without change, while\n\
directed graphs are written in digraph6 format.\n\
\n\
-a Also output the original graph (before the converse)\n\
-c Output only self-converse digraphs\n\
\n\
-q Suppress auxiliary information.\n"
staticvoid
conv(graph *g, int m, int n) /* Replace g by its converse */
{ int i,j;
graph *gi,*gj;
for (i = 0, gi = g; i < n; ++i, gi += m) for (j = i+1, gj = gi+m; j < n; ++j, gj += m) if ((ISELEMENT(gi,j)!=0) + (ISELEMENT(gj,i)!=0) == 1)
{
FLIPELEMENT(gi,j);
FLIPELEMENT(gj,i);
}
}
if (codetype&HAS_HEADER)
{ if (outcode == SPARSE6) writeline(outfile,SPARSE6_HEADER); elseif (outcode == DIGRAPH6) writeline(outfile,DIGRAPH6_HEADER); else writeline(outfile,GRAPH6_HEADER);
}
gtools_check(WORDSIZE,1,1,NAUTYVERSIONID);
nin = nout = 0;
t = CPUTIME; while (TRUE)
{ if ((g = readgg(infile,NULL,0,&m,&n,&digraph)) == NULL) break;
++nin;
if (!digraph)
{
writelast(outfile);
++nout;
} elseif (self)
{ if (isselfconverse(g,m,n))
{
writelast(outfile);
++nout;
}
} else
{ if (also)
{
writed6(outfile,g,m,n);
++nout;
}
conv(g,m,n);
writed6(outfile,g,m,n);
++nout;
}
FREES(g);
}
t = CPUTIME - t;
if (!quiet)
{ if (self)
fprintf(stderr,">Z " COUNTER_FMT " digraphs read from %s; " COUNTER_FMT " self-converse written to %s in %3.2f sec.\n",
nin,infilename,nout,outfilename,t); else
fprintf(stderr,">Z " COUNTER_FMT " graphs converted from %s to %s in %3.2f sec.\n",
nin,infilename,outfilename,t);
}
exit(0);
}
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
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.