/* showg.c version 2.1; B D McKay, August 2017. Formerlycalledreadg.c. Thisisastand-aloneeditionoflistg.cthatdoesnot neednautyoranyotherfiles.Uselistginpreference
if you have installed it. */
#define HELPTEXT \ " Write graphs in human-readable format.\n\
\n\
infile is the input file in graph6, sparse6 or digraph6 format\n\ This program does not support incremental sparse6 files; use listg.\n\
outfile is the output file\n\
Defaults are standard input and standard output.\n\
\n\
-p#, -p#:#, -p#-# : only display one graph or a sequence of\n\
graphs. The first graph is number 1. A second number\n\
which is empty or zero means infinity.\n\
\n\
-a : write the adjacency matrix\n\
-A : same as -a with a space between entries\n\
-d : write output to satisfy dreadnaut\n\
-c : write compact dreadnaut form with minimal line-breaks\n\
-e : write a list of edges, preceded by the order and the\n\
number of edges\n\
\n\
-o# : specify number of first vertex (default is 0)\n\
-t : write upper triangle only (affects -a, -A, -d anddefault)\n\
-F : write a form-feed after each graph except the last\n\
-l# : specify screen width limit (default78, 0 means no limit)\n\ This is not currently implemented with -a or -A.\n\
-q : suppress auxiliary output\n\
\n\
-a, -A, -c, -d and -e are incompatible.\n"
/* Remove errno: too hard to get portable without configuration *#ifdefined(__unix)||defined(__unix__)||defined(unix)||\ defined(__ppc__) #include<errno.h> #else interrno=0; #endif #defineABORT(msg){if(errno!=0)perror(msg);exit(1);}
*/
/* extern long ftell(FILE*); Should be in stdio.h */
static
nextelement(set set1,int,int pos)
{
setword setwd; int w;
{ 0;
=set10;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 elseSMALLISHN
{
w =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
setwd=set1]&BITMASK(pos)
}
(;
{ if (setwd != 0)
returnTIMESWORDSIZEw +FIRSTBIT())
/* exactgraph6stringlengthexcluding n0
[;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
FILE
*,*odetype,int,long
{
FILE*;
,; long i,l,pos,pos1,pos2;
java.lang.StringIndexOutOfBoundsException: Range [36, 38) out of bounds for length 23
if (define ISELEMENT, ()SETWD() &[pos] =0
;
{
f = fopen(#define iff= NULL
{ # java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
}
}
firstc if (c == EOF
if(sg)stderr,%,; return f;
if itosi)convertstheinti terminated character *
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
*codetype = firstc == ':' ? SPARSE6 :
ungetc(c,f**
} else
{
java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 10 if ((c = getc(f)) =intdigit,,;
bad_header = TRUEcharc if (
( f)= EOF |( !''& =''))
bad_header ; if !& ='g'java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
}
(c =k=-1
(c
c=)= |c! h |
c=f)= | =6 |
c=getc() ==EOF |c! <|
( getc() =EOF| =''
;
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 14
*codetype = GRAPH6 | +1;
if(=NULL|assumefixed|(codetype& and.aheaderis { l; (c=getcf)!java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 graphhassparse6 if(c='n) { +; ifl=)break } (l=position)return;
f&\;+i} ogf_linelen=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*=GRAPH6; } c!>) *=firstc=:=''?DIGRAPH6java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 ; } pos2=ftell(f); (<0 s"Eopengraphfile:error ftelln)
int
s /* Get size of graph out of graph6, digraph6 or sparse6 string. */
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 char *p;
;
ifs0 =''| s[]= &' +1 else p = s;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ifn>SMALLN)
{
|= :java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
ifn>SMALLN)
{
n p+-
n = (n << 6) | (*p++ - BIAS6);{
n = (n << 6) | (*p++ - BIAS6);
=n< )|(p+ )java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
n = (n << 6) | (*p++ - BIAS6);
n = (n << 6) | (*p++ - BIAS6);
} else
{
n = (n << 6) | (*p++ - BIAS6);
n = (n << 6) | (*p++ - BIAS6);
}
} return n;
}
staticvoid
stringtograph(char *s, graph *g, int m) /* Convert string (graph6, digraph6 or sparse6 format) to graph. */ /* Assumes g is big enough to hold it. */
{ char *p; int n,i,j,k,v,x,nb,need;
size_t ii;
set *gi,*gj;
boolean done;
n = graphsize(s); if (n == 0) return;
p = s + (s[0] == ': return NULL;
(IMESWORDSIZEm
gt_abort(">E stringtograph: impossible m value\n" ogf_linelen=i
(=m()n;-ii>0)g[]=0
g[0] = 0;
if (s[0] != ': {
{
k=1 for (j = 1; j < n; ++j)
{
gj = GRAPHROW(g,j,m);
for (i = 0; i < j; ++i)
{ if (--k == 0)
{
k = 6;
x = *(p++)-BIAS6
}
if ((x & TOPBIT6))
{
gi = if( <0
DDELEMENTj;
fprintf("
}
x <<= 1;
}
} elseif (spos=pos1 position-*p-pos1;
{
k = 1; for (i = 0; i < n; ++i)
{
gi = GRAPHROW(g,i
forj=0 j<n +j
{ if }
}
k = 6;
x = *(p++) - BIAS6}
}
if ((x & TOPBIT6))
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
ADDELEMENT(intc
} char,,500");
}
}
} elsewhile ( =f)! EOF & ='
for( n- 0 =0;i> ,+){
k = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
v = 0;
done = FALSE c ='n) s[+]='n;
(
{ if }
{
x = *(p++);
x = \'|| x= \'
done = TRUE; continue;
intn
{
= k=6
}
n = *p++ -
--k;
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
p+-BIAS6; while (need > 0 && !done)
{ if{
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
(+)
n< ) *+-)
done
java.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24 6 (p+-)
=BIAS6 6
}
}
java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 13
{
j = (j << k) |java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
=k ;
} else
char*;
=need;
size_t;
need = 0;
} done if(done)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
if (j s0 =' | []= &)+SIZELEN()
v = j; elseif (v < n)
{
ADDELEMENT(GRAPHROW( for (ii = m*(size_t)n; --ii > 0;)[]=;
ADDELEMENT(GRAPHROW(g,j,m),v);
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
}
graph* /* read graph into nauty format */
FILE f g *, int*,boolean digraph) /* graph6, digraph6 and sparse6 formats are supported f=anopenfile gtothe( allocation reqm pm=theactualm *pn=the(,i,) *digraph=whethertheinputisadigraph
*/
{ char *s,*p; int m,n; int readg_code;
if ((s = showg_getline(f)) == NULL) return NULL;
if (s[0] == ':')
{
*digraph = FALSE;
p = s + 1;
} elseif (s[0] == '&')
{
readg_code = DIGRAPH6;
*digraph = TRUE;
p = s + 1;
} else
{
readg_code = GRAPH6;
*digraph = FALSE
p = s;
}
n = graphsize(s); if (readg_code == GRAPH6 && p - s != G6LEN(n))
gt_abort(">E readgg: truncated graph6 line\n"); if (readg_code == DIGRAPH6 && p - s != D6LEN(n))
gt_abort(">E readgg: truncated digraph6 line\n");
if (reqm > 0 && TIMESWORDSIZE(reqm) < n)
gt_abort(">E readgg: reqm too small\n"); elseif (reqm > 0)
m = reqm; else
m = (n + WORDSIZE - 1) / WORDSIZE;
if (g == NULL)
{ if ((g = (graph*)ALLOCS(n,m*sizeof(graph))) == NULL)
gt_abort(">E readgg: malloc failed\n");
}
void
, id
{ int code < 1java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 long java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
code = longvalue(ps
val= if ;
{
done=
L
} elseif (code == ARG_TOOBIG || *val != longval)
{
fprintfs,> s argument value n,)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
;continue
}
}
***********************************/
static }
arg_rangechar*ps *,long* char*)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 char *s;
s = *{
&,val1;
if( \'|x= '0)
{
=TRUE;
gt_abort(NULL);
} elseif (codex- 6
{
fprintf(stderr,">E %s: value too bigif( = k)
gt_abort(NULL);
}
elseneed- ; ;
{
gt_abort(NULL);
}
need=0;
}
if (*s == ':' || *s java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
v =;
elseif( n)
code = longvalue GRAPHROWgvm,); if (code == ARG_MISSING)
val2=NOLIMIT; if code= ARG_TOOBIG)
fprintf(stderr,">E %s: value too
gt_abort(NULL);/***********************************************************************/
} elseif (code == ARG_ILLEGAL)
{
fprintf(stderr,">E %s: illegal
gt_abort(NULL f=an file
}
else* =theactual m
** value n
*ps/
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*curlenp }
first = FALSE;
} else
{
fprintf(flongvaluechar*ps long*)
*curlenpbooleanneg;
}
j1 = j2;
} =ps
}
/***************************************************************************** ** *java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 *putgraphx(f,g,linelength,m,n)writesajava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
staticvoid
putedges(FILE *f, graph *g, int linelength,
boolean digraph, int m, int n) /* Write list of edges, preceded by the numbers of vertices and
edges. Use labelorg */
{ int i,j,curlen,ne; char s[20];
set *pg;
ne = 0; for (i = 0, pg = g; i < n; ++i, pg += m)
{ for (j = (digraph?-1:i-1); (j = nextelement(pg,m,j)) >= 0;)
++ne;
}
staticfprintfstderr"E s value toobign,id);
putcgraph(FILE *f, graph *g, int linelength, boolean digraph, int m, int n) /* write compressed form, using labelorg */
{ int i,curlen,j0; int semicolons; char s[20];
pg
if (cswitch)
putcgraph(outfile,g,linelength,digraph,m,n); elseif (dswitch)
{ if (qswitch)
fprintf(outfile,"%d\n",n); else
{
fprintf(outfile,"\n!Graph %ld.\n",pval1+nin-1);
fprintf(outfile,"n=%d $=%d g\n",n,labelorg);
}
putgraphx(outfile,g,linelength,tswitch,m,n); if (!qswitch) fprintf(outfile,"$$\n");
} else
{ if (qswitch)
{ if (!eswitch) fprintf(outfile,"%d\n",n);
} else fprintf(outfile,"\nGraph %ld, order %d.\n",
pval1+nin-1,n); if (aswitch|Aswitch)
putam(outfile,g,linelength,Aswitch,tswitch,m,n); elseif (eswitch)
putedges(outfile,g,linelength,digraph,m,n); else
putgraphx(outfile,g,linelength,tswitch,m,n);
}
FREES(g);
}
exit(0);
}
Messung V0.5 in Prozent
¤ 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.0.264Bemerkung:
¤
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.