385 lines
16 KiB
Diff
385 lines
16 KiB
Diff
Description: format usages and helps
|
|
Attempt to format usages and helps of the invited
|
|
programs wrt to the original gtools.
|
|
Origin: debian
|
|
Author: Jerome Benoit <calculus@rezozer.net>
|
|
Last-Update: 2016-03-19
|
|
|
|
--- a/watercluster2.c
|
|
+++ b/watercluster2.c
|
|
@@ -1,53 +1,65 @@
|
|
// cc -O4 -o water2 -DWORDSIZE=32 -DMAXN=WORDSIZE nauty.c naugraph.c nautil.c gtools.c schreier.c naurng.c watercluster2.c
|
|
|
|
-/*
|
|
-Reads graphs in g6 code or multicode (optional) from stdin and directs them
|
|
-
|
|
-options:
|
|
-
|
|
-ix means: the indegree of every vertex may be at most x.
|
|
-
|
|
-oy means: the outdegree of every vertex may be at most y.
|
|
-
|
|
- S means: allow that for every pair of vertices x,y at most one of the edges x-->y
|
|
- and y-->x may be present. By default both of them may be present in the same graph.
|
|
-
|
|
-
|
|
- T means: Output directed graphs in T-code. This is a simple ASCII output format. Every line
|
|
- contains one graph. First the number of vertices, then the number of
|
|
- directed edges and then the list of directed edges with the start first
|
|
- and the end then. E.g.: 3 2 0 1 2 1 means 3 vertices, 2 directed edges:
|
|
- 0-->1 and 2-->1
|
|
-
|
|
- B means: Output the directed graphs in a binary code. Every item of the code is an unsigned
|
|
- char. The first unsigned char is the number nv of vertices. The vertices are numbered 1..nv
|
|
- Then the list of vertices x for which there is a directed edge 1->x follow. This list is
|
|
- ended by a 0. Then the list of outgoing neighbours of 2 follows -- again ended with a 0, etc.
|
|
- The code is complete with the 0 ending the list of outgoing neighbours of nv.
|
|
-
|
|
- Z means: Output the directed graphs in digraph6 code. See formats.txt for a complete definition.
|
|
-
|
|
- C means: Do really construct all the directed graphs in memory, but don't output them. This is not
|
|
- a big difference in case of restricted in- and outdegrees, because all that is done extra is that
|
|
- edges are directed instead of just keeping track of in- and out-degrees. This option is intended only
|
|
- for testing purposes to test also routines that are normally not used when counting. Things that would
|
|
- speed up the counting also in some cases of restricted in- and out-degrees -- like multiplying the
|
|
- possibilities of assigning directions to edges that can be assigned directions independent
|
|
- of each other (depending on the degrees of the endvertices and overlaps) -- are not included.
|
|
- In case of not restrictive bounds on the in- and out-degree it not really constructing the graphs
|
|
- can be considerably faster. In cases of restricted in- and out-degrees the only difference is that
|
|
- the graph isn't modified...
|
|
- The fact that in case of no output the graph is not modified is mainly to save time for the one
|
|
- case of waterclusters, where large numbers were determined. If large numbers (without output)
|
|
- for other cases shall be determined, one should think about adding the multiplication routines.
|
|
-
|
|
- m read multicode
|
|
-
|
|
-This program uses different labelling routines -- all based on the ideas of
|
|
+#define GTOOL_USAGEHELP_COMPATIBILITY
|
|
|
|
-G. Brinkmann, Generating water clusters and other directed graphs,
|
|
-Journal of Mathematical Chemistry 46, 1112--1121 (2009)
|
|
+#define USAGE "watercluster2 [ix] [oy] [S] [T] [B] [Z] [C] [m]"
|
|
|
|
+#define HELPTEXT \
|
|
+" Reads graphs in g6 code or multicode (optional) from stdin and directs them\n\
|
|
+\n\
|
|
+ ix: the indegree of every vertex may be at most x.\n\
|
|
+ The default maximum indegree is unlimited.\n\
|
|
+\n\
|
|
+ oy: the outdegree of every vertex may be at most y.\n\
|
|
+ The default maximum outdegree is unlimited.\n\
|
|
+\n\
|
|
+ S : allow that for every pair of vertices x,y at most one of the edges x-->y\n\
|
|
+ and y-->x may be present. By default both of them may be present in the\n\
|
|
+ same graph.\n\
|
|
+\n\
|
|
+ T : Output directed graphs in T-code. This is a simple ASCII output format.\n\
|
|
+ Every line contains one graph. First the number of vertices, then the\n\
|
|
+ number of directed edges and then the list of directed edges with the\n\
|
|
+ start first and the end then. E.g.: 3 2 0 1 2 1 means 3 vertices, 2\n\
|
|
+ directed edges:\n\
|
|
+ 0-->1 and 2-->1\n\
|
|
+\n\
|
|
+ B : Output the directed graphs in a binary code. Every item of the code is an\n\
|
|
+ unsigned char. The first unsigned char is the number nv of vertices. The\n\
|
|
+ vertices are numbered 1..nv. Then the list of vertices x for which there\n\
|
|
+ is a directed edge 1->x follow. This list is ended by a 0. Then the list\n\
|
|
+ of outgoing neighbours of 2 follows -- again ended with a 0, etc.\n\
|
|
+ The code is complete with the 0 ending the list of outgoing neighbours of\n\
|
|
+ nv.\n\
|
|
+\n\
|
|
+ Z : Output the directed graphs in digraph6 code. See formats.txt for a\n\
|
|
+ complete definition.\n\
|
|
+\n\
|
|
+ C : Do really construct all the directed graphs in memory, but don't output\n\
|
|
+ them. This is not a big difference in case of restricted in- and\n\
|
|
+ outdegrees, because all that is done extra is that edges are directed\n\
|
|
+ instead of just keeping track of in- and out-degrees. This option is\n\
|
|
+ intended only for testing purposes to test also routines that are normally\n\
|
|
+ not used when counting. Things that would speed up the counting also in\n\
|
|
+ some cases of restricted in- and out-degrees -- like multiplying the\n\
|
|
+ possibilities of assigning directions to edges that can be assigned\n\
|
|
+ directions independent of each other (depending on the degrees of the\n\
|
|
+ endvertices and overlaps) -- are not included.\n\
|
|
+ In case of not restrictive bounds on the in- and out-degree it not really\n\
|
|
+ constructing the graphs can be considerably faster. In cases of restricted\n\
|
|
+ in- and out-degrees the only difference is that the graph isn't modified.\n\
|
|
+ The fact that in case of no output the graph is not modified is mainly to\n\
|
|
+ save time for the one case of waterclusters, where large numbers were\n\
|
|
+ determined. If large numbers (without output) for other cases shall be\n\
|
|
+ determined, one should think about adding the multiplication routines.\n\
|
|
+\n\
|
|
+ m : read multicode instead of g6 code\n\
|
|
+\n\
|
|
+This program uses different labelling routines -- all based on the ideas of\n\
|
|
+\n\
|
|
+G. Brinkmann, Generating water clusters and other directed graphs,\m\
|
|
+Journal of Mathematical Chemistry 46, 1112--1121 (2009)\n"
|
|
+/*
|
|
October 10, 2011: corrected error caused by overflow of 32bit int used as hashvalue.
|
|
|
|
Sep, 2012: PROCESS feature added by BDM.
|
|
@@ -71,7 +83,7 @@ Oct, 2017: digraph6 output added by BDM.
|
|
*
|
|
* If SUMMARY is defined, it must expand as the name of a procedure
|
|
* with prototype void SUMMARY(void). It is called at the end after
|
|
- * the normal summary.
|
|
+ * the normal summary.
|
|
*/
|
|
|
|
//#include<stdio.h>
|
|
@@ -526,7 +538,7 @@ while (nuller<knotenzahl-1)
|
|
return 1;
|
|
}
|
|
|
|
-
|
|
+#ifndef GTOOL_USAGEHELP_COMPATIBILITY
|
|
void usage(char name[])
|
|
{
|
|
|
|
@@ -546,6 +558,7 @@ void usage(char name[])
|
|
exit(1);
|
|
|
|
}
|
|
+#endif
|
|
|
|
/**********DECODE_TO_NAUTY****************************************************/
|
|
|
|
@@ -4041,6 +4054,15 @@ int main(int argc, char *argv[])
|
|
int multicode=0, g6code=1;
|
|
long long int last=0LL;
|
|
|
|
+#ifdef GTOOL_USAGEHELP_COMPATIBILITY
|
|
+ if (argc > 1 && (strcmp(argv[1],"-help") == 0
|
|
+ || (strcmp(argv[1],"--help") == 0)))
|
|
+ {
|
|
+ printf("Usage: %s\n\n%s",USAGE,HELPTEXT);
|
|
+ exit(0);
|
|
+ }
|
|
+#endif
|
|
+
|
|
if (sizeof(long long int)<8)
|
|
{
|
|
fprintf(stderr,">E long long too short; This may cause problems with the hashing function for large degree -- exit().\n");
|
|
@@ -4059,7 +4081,15 @@ int main(int argc, char *argv[])
|
|
else if (argv[i][0]=='Z') direct_output=4; /* BDM */
|
|
else if (argv[i][0]=='S') double_allowed=0;
|
|
else if (argv[i][0]=='m') { g6code=0; multicode=1; }
|
|
- else usage(argv[0]);
|
|
+ else {
|
|
+#ifdef GTOOL_USAGEHELP_COMPATIBILITY
|
|
+ fprintf(stderr, ">E Usage: %s\n", USAGE);
|
|
+ fprintf(stderr, "Use watercluster2 -help to see a list of the options.\n");
|
|
+ exit(1);
|
|
+#else
|
|
+ usage(argv[0]);
|
|
+#endif
|
|
+ }
|
|
}
|
|
|
|
#ifdef PROCESS
|
|
--- a/genbg.c
|
|
+++ b/genbg.c
|
|
@@ -3,8 +3,7 @@
|
|
/* TODO: consider colour swaps */
|
|
|
|
#define USAGE \
|
|
-"genbg [-c -ugs -vq -lzF] [-Z#] [-D#] [-A] [-d#|-d#:#] [-D#|-D#:#] n1 n2 \n\
|
|
- [mine[:maxe]] [res/mod] [file]"
|
|
+"genbg [-c -ugs -vq -lzF] [-Z#] [-D#] [-A] [-d#|-d#:#] [-D#|-D#:#] n1 n2 [mine[:maxe]] [res/mod] [file]"
|
|
|
|
#define HELPTEXT \
|
|
" Find all bicoloured graphs of a specified class.\n\
|
|
--- a/geng.c
|
|
+++ b/geng.c
|
|
@@ -6,8 +6,7 @@
|
|
/* geng.c version 3.1; B D McKay, Jan 2019. */
|
|
|
|
#define USAGE \
|
|
-"geng [-cCmtfbd#D#] [-uygsnh] [-lvq] \n\
|
|
- [-x#X#] n [mine[:maxe]] [res/mod] [file]"
|
|
+"geng [-cCmtfbd#D#] [-uygsnh] [-lvq] [-x#X#] n [mine[:maxe]] [res/mod] [file]"
|
|
|
|
#define HELPTEXT \
|
|
" Generate all graphs of a specified class.\n\
|
|
--- a/genrang.c
|
|
+++ b/genrang.c
|
|
@@ -2,8 +2,7 @@
|
|
/* TODO: Check allocs for no edges */
|
|
|
|
#define USAGE \
|
|
-"genrang [-P#|-P#/#|-e#|-r#|-R#|-d#] [-l#] [-m#] [-t] [-T] [-a] \n" \
|
|
-" [-s|-g|-z] [-S#] [-q] n|n1,n2 num [outfile]"
|
|
+"genrang [-P#|-P#/#|-e#|-r#|-R#|-d#] [-l#] [-m#] [-t] [-T] [-a] [-s|-g|-z] [-S#] [-q] n|n1,n2 num [outfile]"
|
|
|
|
#define HELPTEXT \
|
|
" Generate random graphs.\n\
|
|
--- a/genspecialg.c
|
|
+++ b/genspecialg.c
|
|
@@ -1,13 +1,12 @@
|
|
/* genspecialg.c version 1.3; B D McKay, Mar 19, 2018 */
|
|
|
|
-#define USAGE "genspecialg [-s|-g|-z|-d|-v] [-q]\n\
|
|
- [-p#|-c#|-e#|-k#|-b#,#[,#]|-Q#|-f#|-J#,#\n\
|
|
- |-P#,#|C#,#...|G#,#...|T#,#...]* [outfile]"
|
|
+#define USAGE "genspecialg [-s|-g|-z|-d|-v] [-q] [-p#|-c#|-e#|-k#|-b#,#[,#]|-Q#|-f#|-J#,#|-P#,#|C#,#...|G#,#...|T#,#...]* [outfile]"
|
|
|
|
#define HELPTEXT \
|
|
" Generate special graphs.\n\
|
|
- # : size parameter called n in the descriptions\n\
|
|
\n\
|
|
+Options:\n\
|
|
+General Options:\n\
|
|
-s : Write in sparse6 format (default)\n\
|
|
-g : Write in graph6 format\n\
|
|
-z : Make digraph versions and write in digraph6 format\n\
|
|
@@ -15,7 +14,10 @@
|
|
-v : For each graph, report the size to stderr\n\
|
|
-q : Suppress summary\n\
|
|
\n\
|
|
- If defined, the digraph version is shown in parentheses:\n\
|
|
+Special Options:\n\
|
|
+ If defined, the digraph version is shown in parentheses;\n\
|
|
+ # size parameter called n in the descriptions.\n\
|
|
+\n\
|
|
-p# : path (directed path) on n vertices.\n\
|
|
-c# : cycle (directed cycle) on n vertices.\n\
|
|
-e# : empty graph (digraph with loops only) on n vertices.\n\
|
|
@@ -26,9 +28,9 @@
|
|
-P#,# : generalized Petersen graph; usual one is -P5,2\n\
|
|
-Q# : hypercube on 2^n vertices and degree n.\n\
|
|
-J#,# : Johnson graph J(n,k), args are n and k.\n\
|
|
- -C#,#... : circulant (di)graph.\n\
|
|
- -T#,#... : theta (di)graph Theta(#,#,...), give path lengths.\n\
|
|
- -G#,#... : (directed) grid, use negative values for open directions\n\
|
|
+ -C#[,#] : circulant (di)graph.\n\
|
|
+ -T#[,#] : theta (di)graph Theta(#,#,...), give path lengths.\n\
|
|
+ -G#[,#] : (directed) grid, use negative values for open directions\n\
|
|
\n\
|
|
Any number of graphs can be generated at once.\n"
|
|
|
|
--- a/cubhamg.c
|
|
+++ b/cubhamg.c
|
|
@@ -1,54 +1,53 @@
|
|
-/* cubhamg.c : pick those inputs that are nonhamiltonian and
|
|
- have max degree <= 3.
|
|
-
|
|
- Usage:
|
|
-cubhamg [-#] [-v|-V] [-n#-#|-y#-#|-i|-I|-o|-x|-e|-E] [-b|-t] [infile [outfile]]
|
|
-
|
|
- infile is the name of the input file in graph6/sparse6 format
|
|
- outfile is the name of the output file in the same format
|
|
-
|
|
- stdin and stdout are the defaults for infile and outfile
|
|
-
|
|
- The output file will have a header >>graph6<< or >>sparse6<<
|
|
- if and only if the input file does.
|
|
-
|
|
- Optional switches:
|
|
+/* cubhamg.c : pick those inputs that are nonhamiltonian and have max degree <= 3. */
|
|
|
|
- -# A parameter useful for tuning (default 100)
|
|
- -v Report nonhamiltonian graphs and noncubic graphs
|
|
- -V .. in addition give a cycle for the hamiltonian ones
|
|
- -n#-# If the two numbers are v and i, then the i-th edge
|
|
- out of vertex v is required to be not in the cycle.
|
|
- It must be that i=1..3 and v=0..n-1.
|
|
- -y#-# If the two numbers are v and i, then the i-th edge
|
|
- out of vertex v is required to be in the cycle.
|
|
- It must be that i=1..3 and v=0..n-1.
|
|
- You can use any number of -n/-y switches to force
|
|
- edges. Out of range first arguments are ignored.
|
|
- If -y and -n give same edge, -y wins.
|
|
- -i Test + property: for each edge e, there is a hamiltonian
|
|
- cycle using e.
|
|
- -I Test ++ property: for each pair of edges e,e', there is
|
|
- a hamiltonian cycle which uses both e and e'.
|
|
- -o Test - property: for each edge e, there is a hamiltonian
|
|
- cycle avoiding e.
|
|
- -x Test +- property: for each pair of edges e,e', there is
|
|
- a hamiltonian cycle which uses e but avoids e'.
|
|
- -e Test 3/4 property: for each edge e, at least 3 of the 4
|
|
- paths of length 3 passing through e lie on hamiltonian cycles.
|
|
- -E Test 3/4+ property: for each edge e failing the 3/4 property,
|
|
- all three ways of joining e to the rest of the graph are
|
|
- hamiltonian avoiding e.
|
|
- -T# Specify a timeout, being a limit on how many search tree
|
|
- nodes are made. If the timeout occurs, the graph is
|
|
- written to the output as if it is nonhamiltonian.
|
|
- -R# Specify the number of repeat attempts for each stage.
|
|
- -F Analyze covering paths from 2 or 4 vertices of degree 2.
|
|
+#define USAGE "cubhamg [-#] [-v|-V] [-n#-#|-y#-#|-i|-I|-o|-x|-e|-E] [-b|-t] [infile [outfile]]"
|
|
|
|
- -b Require biconnectivity
|
|
- -t Require triconnectivity (note: quadratic algorithm)
|
|
+#define HELPTEXT \
|
|
+" Pick those inputs that are nonhamiltonian and have max degree <= 3.\n\
|
|
+\n\
|
|
+ infile is the name of the input file in graph6/sparse6 format (default: stdin)\n\
|
|
+\n\
|
|
+ outfile is the name of the output file in the same format (default: stdout)\n\
|
|
+\n\
|
|
+ The output file will have a header >>graph6<< or >>sparse6<< if the input file does.\n\
|
|
+\n\
|
|
+Options:\n\
|
|
+ -# A parameter useful for tuning (default 100)\n\
|
|
+ -v Report nonhamiltonian graphs and noncubic graphs\n\
|
|
+ -V .. in addition give a cycle for the hamiltonian ones\n\
|
|
+ -n#-# If the two numbers are v and i, then the i-th edge\n\
|
|
+ out of vertex v is required to be not in the cycle.\n\
|
|
+ It must be that i=1..3 and v=0..n-1.\n\
|
|
+ -y#-# If the two numbers are v and i, then the i-th edge\n\
|
|
+ out of vertex v is required to be in the cycle.\n\
|
|
+ It must be that i=1..3 and v=0..n-1.\n\
|
|
+ You can use any number of -n/-y switches to force\n\
|
|
+ edges. Out of range first arguments are ignored.\n\
|
|
+ If -y and -n give same edge, -y wins.\n\
|
|
+ -i Test + property: for each edge e, there is a hamiltonian cycle using e.\n\
|
|
+ -I Test ++ property: for each pair of edges e,e', there is\n\
|
|
+ a hamiltonian cycle which uses both e and e'.\n\
|
|
+ -o Test - property: for each edge e, there is a hamiltonian cycle avoiding e.\n\
|
|
+ -x Test +- property: for each pair of edges e,e', there is\n\
|
|
+ a hamiltonian cycle which uses e but avoids e'.\n\
|
|
+ -e Test 3/4 property: for each edge e, at least 3 of the 4\n\
|
|
+ paths of length 3 passing through e lie on hamiltonian cycles.\n\
|
|
+ -E Test 3/4+ property: for each edge e failing the 3/4 property,\n\
|
|
+ all three ways of joining e to the rest of the graph are\n\
|
|
+ hamiltonian avoiding e.\n\
|
|
+ -T# Specify a timeout, being a limit on how many search tree\n\
|
|
+ nodes are made. If the timeout occurs, the graph is\n\
|
|
+ written to the output as if it is nonhamiltonian.\n\
|
|
+ -R# Specify the number of repeat attempts for each stage.\n\
|
|
+ -F Analyze covering paths from 2 or 4 vertices of degree 2.\n\
|
|
+\n\
|
|
+ -b Require biconnectivity\n\
|
|
+ -t Require triconnectivity (note: quadratic algorithm)\n\
|
|
+\n\
|
|
+Comments:\n\
|
|
+ -y, -n, -#, -R and -T are ignored for -i, -I, -x, -o, -e, -E, -F\n"
|
|
|
|
- -y, -n, -#, -R and -T are ignored for -i, -I, -x, -o, -e, -E, -F
|
|
+/**************************************************************************
|
|
|
|
B. D. McKay, Nov 1995 + Aug 1996 + Feb 2002 + Jul 2008 + Nov 2015
|
|
|
|
@@ -1611,6 +1610,8 @@ main(int argc, char *argv[])
|
|
char *arg;
|
|
int codetype;
|
|
|
|
+ HELP;
|
|
+
|
|
infilename = outfilename = NULL;
|
|
badargs = FALSE;
|
|
e34plus = e34 = in = out = inin = inout = FALSE;
|
|
@@ -1729,8 +1730,8 @@ main(int argc, char *argv[])
|
|
|
|
if (badargs)
|
|
{
|
|
- fprintf(stderr,
|
|
- ">E Usage: cubhamg [-#] [-v | -V] [-n#-#] [-y#-#] [infile [outfile]]\n");
|
|
+ fprintf(stderr, ">E Usage: " USAGE "\n" );
|
|
+ GETHELP;
|
|
exit(1);
|
|
}
|
|
|