1 /* listg.c version 2.3; B D McKay, Sep 2018 */
2
3 #define USAGE \
4 "listg [-fp#:#l#o#Ftq] [-a|-A|-c|-d|-e|-H|-M|-W|-L|-s|-b|-G|-y|-Yxxx]" \
5 " [infile [outfile]]"
6
7 #define HELPTEXT \
8 " Write graphs in human-readable format.\n\
9 \n\
10 -f : assume inputs have same size (only used from a file\n\
11 and only if -p is given)\n\
12 -p#, -p#:#, -p#-# : only display one graph or a sequence of\n\
13 graphs. The first graph is number 1. A second number\n\
14 which is empty or zero means infinity.\n\
15 This option won't work for incremental input.\n\
16 -a : write as adjacency matrix, not as list of adjacencies\n\
17 -A : same as -a with a space between entries\n\
18 -l# : specify screen width limit (default 78, 0 means no limit)\n\
19 This is not currently implemented with -a or -A.\n\
20 -o# : specify number of first vertex (default is 0).\n\
21 -d : write output to satisfy dreadnaut \n\
22 -c : write ascii form with minimal line-breaks\n\
23 -e : write a list of edges, preceded by the order and the\n\
24 number of edges\n\
25 -H : write in HCP operations research format\n\
26 -M : write in Magma format\n\
27 -W : write matrix in Maple format\n\
28 -L : (only with -M or -W) write Laplacian rather than adjacency matrix\n\
29 -b : write in Bliss format\n\
30 -G : write in GRAPE format\n\
31 -y : write in dot file format\n\
32 -Yxxx : extra dotty commands for dot files (arg continues to end of param)\n\
33 -t : write upper triangle only (affects -a, -A, -d and default)\n\
34 -s : write only the numbers of vertices and edges\n\
35 -F : write a form-feed after each graph except the last\n\
36 -q : suppress auxiliary output\n\
37 \n\
38 -a, -A, -c, -d, -M, -W, -H and -e are incompatible.\n"
39
40 #define MAPLE_MATRIX 1 /* 1 for Matrix(..), 0 for array(..) */
41
42 /*************************************************************************
43
44 June 26, 2007 : Fix error in putve() reported by Evan Heidtmann
45 March 3, 2013 : Allow incremental input
46 June 18, 2015 : Add digraph code
47
48 *************************************************************************/
49
50 #include "gtools.h"
51 #define LABELORG 0 /* number of first vertex (any integer >= 0) */
52 #define LINELEN CONSOLWIDTH /* max characters per line (0 = no limit) */
53
54 static FILE *infile,*outfile;
55 static unsigned long nin;
56 extern int labelorg;
57
58 /*****************************************************************************
59 * putsetx(f,set1,curlenp,linelength,m,compress,start) writes the set *
60 * set1 to file f using at most linelength characters per line (excluding *
61 * '\n'). Set elements less than or equal to start are ignored. *
62 * *curlenp is the number of characters on the line so far; it is updated. *
63 * A range j1,j1+1,...,j2 for j2-j1>=2 is written as "j1:j2" if compress *
64 * is nonzero (eg. TRUE); otherwise each element is written separately. *
65 * No final '\n' is written. labelorg is used. *
66 * *
67 * FUNCTIONS CALLED: nextelement(),itos() *
68 * *
69 *****************************************************************************/
70
71 static void
putsetx(FILE * f,set * set1,int * curlenp,int linelength,int m,boolean compress,int start)72 putsetx(FILE *f, set *set1, int *curlenp, int linelength, int m,
73 boolean compress, int start)
74 {
75 int slen,j1,j2;
76 char s[40];
77 boolean first;
78
79 first = TRUE;
80 j1 = start;
81 while ((j1 = nextelement(set1,m,j1)) >= 0)
82 {
83 j2 = j1;
84 if (compress)
85 {
86 while (nextelement(set1,m,j2) == j2 + 1)
87 ++j2;
88 if (j2 == j1+1)
89 j2 = j1;
90 }
91 slen = itos(j1 + labelorg,s);
92 if (j2 >= j1 + 2)
93 {
94 s[slen] = ':';
95 slen += 1 + itos(j2 + labelorg,&s[slen+1]);
96 }
97
98 if (*curlenp + slen + 1 >= linelength && linelength > 0)
99 {
100 fprintf(f,"\n ");
101 *curlenp = 1;
102 }
103 if (first)
104 {
105 fprintf(f,"%s",s);
106 *curlenp += slen;
107 first = FALSE;
108 }
109 else
110 {
111 fprintf(f," %s",s);
112 *curlenp += slen + 1;
113 }
114 j1 = j2;
115 }
116 }
117
118 /*****************************************************************************
119 * *
120 * STOLEN FROM naututil.c *
121 * putgraphx(f,g,linelength,m,n) writes a list of the edges of g to f *
122 * using at most linelength characters per line (excluding '\n'). *
123 * If triang, only write the upper triangle. *
124 * labelorg is used. *
125 * *
126 *****************************************************************************/
127
128 static void
putgraphx(FILE * f,graph * g,int linelength,boolean triang,int m,int n)129 putgraphx(FILE *f, graph *g, int linelength, boolean triang, int m, int n)
130 {
131 int i,curlen;
132 set *pg;
133
134 for (i = 0, pg = g; i < n; ++i, pg += m)
135 {
136 fprintf(f,"%3d : ",i + labelorg);
137 curlen = 7;
138 putsetx(f,pg,&curlen,linelength,m,FALSE,triang ? i-1 : -1);
139 fprintf(f,";\n");
140 }
141 }
142
143 /***************************************************************************/
144
145 static void
putedges(FILE * f,graph * g,boolean ptn,int linelength,boolean digraph,int m,int n)146 putedges(FILE *f, graph *g, boolean ptn, int linelength,
147 boolean digraph, int m, int n)
148 /* Write list of edges, preceded by the numbers of vertices and
149 edges and optionally by "1" if "ptn" is TRUE. Use labelorg */
150 {
151 int i,j,curlen,ne;
152 char s[20];
153 set *pg;
154
155 ne = 0;
156 for (i = 0, pg = g; i < n; ++i, pg += m)
157 {
158 for (j = (digraph?-1:i-1); (j = nextelement(pg,m,j)) >= 0;)
159 ++ne;
160 }
161
162 if (ptn) fprintf(f,"%d %d 1\n",n,ne);
163 else fprintf(f,"%d %d\n",n,ne);
164
165 curlen = 0;
166 for (i = 0, pg = g; i < n; ++i, pg += m)
167 {
168 for (j = (digraph ? -1 : i-1); (j = nextelement(pg,m,j)) >= 0;)
169 {
170 if (curlen > 0 && curlen > linelength - 10 && linelength > 0)
171 {
172 fprintf(f,"\n");
173 curlen = 0;
174 }
175 if (curlen > 0)
176 {
177 fprintf(f," ");
178 curlen += 2;
179 }
180 curlen += itos(i+labelorg,s);
181 fprintf(f,"%s",s);
182 fprintf(f," ");
183 curlen += 1 + itos(j+labelorg,s);
184 fprintf(f,"%s",s);
185 }
186 }
187 fprintf(f,"\n");
188 }
189
190 /***************************************************************************/
191
192 static void
putHCP(FILE * f,graph * g,int m,int n)193 putHCP(FILE *f, graph *g, int m, int n)
194 /* Write list of edges in HCP format. labelorg is ignored */
195 {
196 int i,j;
197 set *pg;
198
199 fprintf(f,"NAME : G%lu\n",nin);
200 fprintf(f,"TYPE : HCP\n");
201 fprintf(f,"DIMENSION : %d\n",n);
202 fprintf(f,"EDGE_DATA_FORMAT : EDGE_LIST\n");
203 fprintf(f,"EDGE_DATA_SECTION\n");
204
205 for (i = 0, pg = g; i < n; ++i, pg += m)
206 {
207 for (j = -1; (j = nextelement(pg,m,j)) >= 0;)
208 fprintf(f,"%d %d\n",i+1,j+1);
209 }
210 fprintf(f,"-1\nEOF\n");
211 }
212
213 /***************************************************************************/
214
215 static void
putcgraph(FILE * f,graph * g,int linelength,boolean digraph,int m,int n)216 putcgraph(FILE *f, graph *g, int linelength, boolean digraph, int m, int n)
217 /* write compressed form, using labelorg */
218 {
219 int i,curlen,j0;
220 int semicolons;
221 char s[20];
222 set *pg;
223
224 curlen = itos(n,s)+2;
225 fprintf(f,";n%s%s",s,(digraph?"dg":"g"));
226
227 semicolons = 0;
228 for (i = 0, pg = g; i < n; ++i, pg += m)
229 {
230 j0 = digraph ? -1: i-1;
231 if (nextelement(pg,m,j0) >= 0)
232 {
233 while (semicolons > 0)
234 {
235 if (curlen >= linelength-1 && linelength > 0)
236 {
237 fprintf(f,"\n ");
238 curlen = 1;
239 }
240 fprintf(f,";");
241 ++curlen;
242 --semicolons;
243 }
244 putsetx(f,pg,&curlen,linelength,m,FALSE,j0);
245 semicolons = 1;
246 }
247 else
248 ++semicolons;
249 }
250 fprintf(f,".\n");
251 }
252
253 /**************************************************************************/
254
255 static void
putve(FILE * f,unsigned long id,graph * g,boolean digraph,int m,int n)256 putve(FILE *f, unsigned long id, graph *g, boolean digraph, int m, int n)
257 /* Write the numbers of vertices and edges */
258 {
259 unsigned long ne;
260 setword x,*pg;
261
262 ne = 0;
263 for (pg = g + m*(size_t)n; --pg >= g;)
264 if ((x = *pg) != 0) ne += POPCOUNT(x);
265
266 fprintf(f,"Graph %lu has %d vertices and %lu edges.\n",id,n,
267 (digraph?ne:ne/2));
268 }
269
270 /**************************************************************************/
271
272 static void
putGRAPE(FILE * f,graph * g,int m,int n)273 putGRAPE(FILE *f, graph *g, int m, int n)
274 /* Write the graph in GRAPE format */
275 {
276 int i,j;
277 setword *pg;
278 boolean first;
279
280 fprintf(f,
281 "rec( isGraph:=true, order:=%d, group:=Group([],()),\n",n);
282 fprintf(f,
283 " representatives := Immutable([1..%d]),\n",n);
284 fprintf(f," adjacencies := [\n");
285
286 for (i = 0, pg = g; i < n; ++i, pg += m)
287 {
288 first = TRUE;
289 fprintf(f," [");
290 for (j = nextelement(pg,m,-1); j >= 0; j = nextelement(pg,m,j))
291 {
292 if (!first) fprintf(f,",");
293 fprintf(f,"%d",j+1);
294 first = FALSE;
295 }
296 if (i < n-1) fprintf(f,"],\n");
297 else fprintf(f,"]],\n");
298 }
299
300 fprintf(f," schreierVector := Immutable([-1,-2..-%d]) )",n);
301 }
302
303 /**************************************************************************/
304
305 static void
putdotty(FILE * f,graph * g,unsigned long id,char * extras,int m,int n)306 putdotty(FILE *f, graph *g, unsigned long id, char *extras, int m, int n)
307 /* Write the graph in dotty format */
308 {
309 int i,j;
310 setword *pg;
311
312 fprintf(f,"graph G%lu {\n",id);
313 if (extras) fprintf(f,"%s\n",extras);
314
315 for (i = 0, pg = g; i < n; ++i, pg += m)
316 {
317 for (j = nextelement(pg,m,i); j >= 0; j = nextelement(pg,m,j))
318 {
319 fprintf(f,"%d--%d;\n",labelorg+i,labelorg+j);
320 }
321 }
322
323 fprintf(f,"}\n");
324 }
325
326 /**************************************************************************/
327
328 static void
putbliss(FILE * f,unsigned long id,boolean qswitch,graph * g,int m,int n)329 putbliss(FILE *f, unsigned long id, boolean qswitch, graph *g, int m, int n)
330 /* Write the graph in Bliss format, according to
331 * http://www.tcs.hut.fi/Software/bliss/fileformat.shtml */
332 {
333 unsigned long ne;
334 setword x,*pg;
335 int i,j;
336
337 ne = 0;
338 for (pg = g + m*(size_t)n; --pg >= g;)
339 if ((x = *pg) != 0) ne += POPCOUNT(x);
340 ne /= 2;
341
342 if (!qswitch) fprintf(f,"c Graph %lu\n",id);
343 else fprintf(f,"\n");
344 fprintf(f,"p edge %d %lu\n",n,ne);
345
346 for (i = 0, pg = g; i < n; ++i, pg += m)
347 for (j = nextelement(pg,m,i); j >= 0; j = nextelement(pg,m,j))
348 fprintf(f,"e %d %d\n",i+1,j+1);
349 }
350
351 /**************************************************************************/
352
353 static void
putam(FILE * f,graph * g,int linelength,boolean space,boolean triang,int m,int n)354 putam(FILE *f, graph *g, int linelength, boolean space,
355 boolean triang, int m, int n)
356 /* write adjacency matrix */
357 {
358 set *gi;
359 int i,j;
360 boolean first;
361
362 for (i = 0, gi = (set*)g; i < n - (triang!=0); ++i, gi += m)
363 {
364 first = TRUE;
365 for (j = triang ? i+1 : 0; j < n; ++j)
366 {
367 if (!first && space) putc(' ',f);
368 else first = FALSE;
369 if (ISELEMENT(gi,j)) putc('1',f);
370 else putc('0',f);
371 }
372 putc('\n',f);
373 }
374 }
375
376 /**************************************************************************/
377
378 static void
putMagma(FILE * outfile,graph * g,int linelength,boolean digraph,int m,int n,long index)379 putMagma(FILE *outfile, graph *g, int linelength, boolean digraph,
380 int m, int n, long index)
381 {
382 int i,j,j0;
383 set *gi;
384 boolean first;
385
386 fprintf(outfile,"g%ld := %s<%d|[\n",
387 index,(digraph?"Digraph":"Graph"),n);
388
389 for (i = 0, gi = (set*)g; i < n; ++i, gi += m)
390 {
391 fprintf(outfile,"{");
392 first = TRUE;
393 j0 = digraph ? -1 : i;
394 for (j = j0; (j = nextelement(gi,m,j)) >= 0; )
395 {
396 if (!first) fprintf(outfile,",");
397 first = FALSE;
398 fprintf(outfile,"%d",j+1);
399 }
400 fprintf(outfile,"}");
401 if (i != n-1) fprintf(outfile,",\n");
402 }
403 fprintf(outfile,"]>;\n");
404 }
405
406 /**************************************************************************/
407
408 static void
putMaple(FILE * outfile,graph * g,int linelength,int m,int n,long index)409 putMaple(FILE *outfile, graph *g, int linelength, int m, int n, long index)
410 {
411 int i,j;
412 set *gi;
413 boolean first;
414
415 #if MAPLE_MATRIX
416 fprintf(outfile,"f%ld := Matrix(%d,%d,[\n",index,n,n);
417 #else
418 fprintf(outfile,"f%ld := array(1..%d,1..%d,[\n",index,n,n);
419 #endif
420
421 for (i = 0, gi = (set*)g; i < n; ++i, gi += m)
422 {
423 fprintf(outfile,"[");
424 first = TRUE;
425 for (j = 0; j < n; ++j)
426 {
427 if (!first) fprintf(outfile,",");
428 first = FALSE;
429 fprintf(outfile,"%d",(ISELEMENT(gi,j)?1:0));
430 }
431 fprintf(outfile,"]");
432 if (i != n-1) fprintf(outfile,",\n");
433 }
434 fprintf(outfile,"]);\n");
435 }
436
437 /**************************************************************************/
438
439 static void
putLaplacianMagma(FILE * outfile,graph * g,int linelength,int m,int n,long index)440 putLaplacianMagma(FILE *outfile, graph *g, int linelength,
441 int m, int n, long index)
442 {
443 int i,j,j0,d;
444 set *gi;
445
446 fprintf(outfile,"g%ld := Matrix(%d,[\n",index,n);
447
448 for (i = 0, gi = (set*)g; i < n; ++i, gi += m)
449 {
450 d = 0;
451 for (j = 0; j < m; ++j) d += POPCOUNT(gi[j]);
452
453 for (j = 0; j < n; ++j)
454 {
455 if (j == i)
456 if (ISELEMENT(gi,j)) fprintf(outfile,"%d",d-1);
457 else fprintf(outfile,"%d",d);
458 else
459 if (ISELEMENT(gi,j)) fprintf(outfile,"%d",-1);
460 else fprintf(outfile,"%d",0);
461 if (j < n-1) fprintf(outfile,",");
462 }
463 if (i < n-1) fprintf(outfile,",\n");
464 else fprintf(outfile,"]);\n");
465 }
466 }
467
468 /**************************************************************************/
469
470 static void
putLaplacianMaple(FILE * outfile,graph * g,int linelength,int m,int n,long index)471 putLaplacianMaple(FILE *outfile, graph *g, int linelength,
472 int m, int n, long index)
473 {
474 int i,j,d;
475 set *gi;
476 boolean first;
477
478 #if MAPLE_MATRIX
479 fprintf(outfile,"f%ld := Matrix(%d,%d,[\n",index,n,n);
480 #else
481 fprintf(outfile,"f%ld := array(1..%d,1..%d,[\n",index,n,n);
482 #endif
483
484 for (i = 0, gi = (set*)g; i < n; ++i, gi += m)
485 {
486 d = 0;
487 for (j = 0; j < m; ++j) d += POPCOUNT(gi[j]);
488
489 fprintf(outfile,"[");
490 first = TRUE;
491 for (j = 0; j < n; ++j)
492 {
493 if (!first) fprintf(outfile,",");
494 first = FALSE;
495 if (j == i)
496 if (ISELEMENT(gi,j)) fprintf(outfile,"%d",d-1);
497 else fprintf(outfile,"%d",d);
498 else
499 if (ISELEMENT(gi,j)) fprintf(outfile,"%d",-1);
500 else fprintf(outfile,"%d",0);
501 }
502 fprintf(outfile,"]");
503 if (i != n-1) fprintf(outfile,",\n");
504 }
505 fprintf(outfile,"]);\n");
506 }
507
508 /**************************************************************************/
509 /**************************************************************************/
510
511 int
main(int argc,char * argv[])512 main(int argc, char *argv[])
513 {
514 graph *g,*gprev;
515 int m,n,codetype;
516 int argnum,j,nprev,mprev;
517 char *arg,sw;
518 boolean badargs,first,digraph;
519 unsigned long maxin;
520 long pval1,pval2;
521 boolean fswitch,pswitch,cswitch,dswitch;
522 boolean aswitch,lswitch,oswitch,Fswitch;
523 boolean Aswitch,eswitch,tswitch,qswitch;
524 boolean sswitch,Mswitch,Wswitch,Lswitch,Eswitch;
525 boolean bswitch,Gswitch,yswitch,Yswitch,Hswitch;
526 int linelength;
527 char *infilename,*outfilename,*yarg;
528
529 HELP; PUTVERSION;
530
531 fswitch = pswitch = cswitch = dswitch = FALSE;
532 aswitch = lswitch = oswitch = Fswitch = FALSE;
533 Aswitch = eswitch = tswitch = qswitch = FALSE;
534 sswitch = Mswitch = Wswitch = Lswitch = Eswitch = FALSE;
535 bswitch = Gswitch = yswitch = Yswitch = Hswitch = FALSE;
536 infilename = outfilename = NULL;
537 linelength = LINELEN;
538 labelorg = 0;
539
540 argnum = 0;
541 badargs = FALSE;
542 for (j = 1; !badargs && j < argc; ++j)
543 {
544 arg = argv[j];
545 if (arg[0] == '-' && arg[1] != '\0')
546 {
547 ++arg;
548 while (*arg != '\0')
549 {
550 sw = *arg++;
551 SWBOOLEAN('a',aswitch)
552 else SWBOOLEAN('A',Aswitch)
553 else SWBOOLEAN('c',cswitch)
554 else SWBOOLEAN('d',dswitch)
555 else SWBOOLEAN('e',eswitch)
556 else SWBOOLEAN('H',Hswitch)
557 else SWBOOLEAN('E',Eswitch)
558 else SWBOOLEAN('f',fswitch)
559 else SWBOOLEAN('F',Fswitch)
560 else SWBOOLEAN('t',tswitch)
561 else SWBOOLEAN('b',bswitch)
562 else SWBOOLEAN('G',Gswitch)
563 else SWBOOLEAN('q',qswitch)
564 else SWBOOLEAN('M',Mswitch)
565 else SWBOOLEAN('W',Wswitch)
566 else SWBOOLEAN('L',Lswitch)
567 else SWBOOLEAN('s',sswitch)
568 else SWBOOLEAN('y',yswitch)
569 else SWRANGE('p',":-",pswitch,pval1,pval2,"listg -p")
570 else SWINT('l',lswitch,linelength,"listg -l")
571 else SWINT('o',oswitch,labelorg,"listg -o")
572 else if (sw == 'Y')
573 {
574 Yswitch = TRUE;
575 yarg = arg;
576 break;
577 }
578 else badargs = TRUE;
579 }
580 }
581 else
582 {
583 ++argnum;
584 if (argnum == 1) infilename = arg;
585 else if (argnum == 2) outfilename = arg;
586 else badargs = TRUE;
587 }
588 }
589
590 if (Yswitch) yswitch = TRUE;
591
592 if (labelorg < 0) gt_abort(">E listg: negative origin forbidden.\n");
593
594 if ((aswitch!=0) + (Aswitch!=0) + (eswitch!=0) + (Mswitch!=0) +
595 (Wswitch!=0) + (sswitch!=0) + (dswitch!=0) + (cswitch!=0) +
596 (Eswitch!=0) + (bswitch!=0) + (Gswitch!=0) + (yswitch!=0) +
597 (Hswitch!=0) > 1)
598 gt_abort(">E listg: -aAbMWeEHcdsGy are incompatible\n");
599
600 if (Lswitch && !Mswitch && !Wswitch)
601 gt_abort(">E listg: -L is only allowed with -M or -W\n");
602
603 if (badargs)
604 {
605 fprintf(stderr,">E Usage: %s\n",USAGE);
606 fprintf(stderr," Try listg -help for more detailed help.\n");
607 exit(1);
608 }
609
610 if (!pswitch || pval1 < 1) pval1 = 1;
611
612 if (infilename && infilename[0] == '-') infilename = NULL;
613 infile = opengraphfile(infilename,&codetype,fswitch,
614 pswitch ? pval1 : 1);
615 if (!infile) exit(1);
616 if (!infilename) infilename = "stdin";
617
618 if (!outfilename || outfilename[0] == '-')
619 {
620 outfilename = "stdout";
621 outfile = stdout;
622 }
623 else if ((outfile = fopen(outfilename,"w")) == NULL)
624 {
625 fprintf(stderr,"Can't open output file %s\n",outfilename);
626 gt_abort(NULL);
627 }
628
629 nin = 0;
630 if (!pswitch || pval2 == NOLIMIT)
631 maxin = NOLIMIT;
632 else if (pval1 < 1) maxin = pval2;
633 else maxin = pval2 - pval1 + 1;
634 first = TRUE;
635 gprev = NULL;
636 nprev = mprev = 1;
637
638 while (nin < maxin || maxin == NOLIMIT)
639 {
640 if ((g = readgg_inc(infile,NULL,0,&m,&n,
641 gprev,mprev,nprev,&digraph)) == NULL) break;
642 ++nin;
643
644 if (Gswitch)
645 {
646 if (first) fprintf(outfile,"graphs := [\n");
647 else fprintf(outfile,",\n");
648 }
649
650 first = FALSE;
651
652 if (Fswitch && nin > 1) fprintf(outfile,"\f");
653
654 if (cswitch)
655 putcgraph(outfile,g,linelength,digraph,m,n);
656 else if (dswitch)
657 {
658 if (qswitch)
659 fprintf(outfile,"%d\n",n);
660 else
661 {
662 fprintf(outfile,"\n!Graph %lu.\n",pval1+nin-1);
663 fprintf(outfile,"n=%d $=%d %sg\n",
664 n,labelorg,(digraph?"d":""));
665 }
666 putgraphx(outfile,g,linelength,tswitch,m,n);
667 if (!qswitch) fprintf(outfile,"$$\n");
668 }
669 else if (Mswitch)
670 {
671 if (Lswitch)
672 putLaplacianMagma(outfile,g,linelength,m,n,pval1+nin-1);
673 else
674 putMagma(outfile,g,linelength,digraph,m,n,pval1+nin-1);
675 }
676 else if (Wswitch)
677 {
678 if (Lswitch)
679 putLaplacianMaple(outfile,g,linelength,m,n,pval1+nin-1);
680 else
681 putMaple(outfile,g,linelength,m,n,pval1+nin-1);
682 }
683 else if (sswitch)
684 putve(outfile,pval1+nin-1,g,digraph,m,n);
685 else if (bswitch)
686 putbliss(outfile,pval1+nin-1,qswitch,g,m,n);
687 else if (Gswitch)
688 putGRAPE(outfile,g,m,n);
689 else if (yswitch)
690 putdotty(outfile,g,pval1+nin-1,(Yswitch?yarg:NULL),m,n);
691 else if (Hswitch)
692 putHCP(outfile,g,m,n);
693 else
694 {
695 if (qswitch)
696 {
697 if (!eswitch && !Eswitch) fprintf(outfile,"%d\n",n);
698 }
699 else fprintf(outfile,"\nGraph %lu, order %d.\n",
700 pval1+nin-1,n);
701 if (aswitch|Aswitch)
702 putam(outfile,g,linelength,Aswitch,tswitch,m,n);
703 else if (eswitch || Eswitch)
704 putedges(outfile,g,Eswitch,linelength,digraph,m,n);
705 else
706 putgraphx(outfile,g,linelength,tswitch,m,n);
707 }
708 if (gprev) FREES(gprev);
709 gprev = g;
710 nprev = n;
711 mprev = m;
712
713 if (ferror(outfile)) gt_abort(">E listg output error\n");
714 }
715
716 if (Gswitch && !first) fprintf(outfile,"\n];\n");
717
718 exit(0);
719 }
720