54static char *
Usage =
"Usage: %s [-dv?] [options]\n\
56 -C<x,y> : cylinder \n\
57 -g[f]<h,w> : grid (folded if f is used)\n\
58 -G[f]<h,w> : partial grid (folded if f is used)\n\
61 -b<x,y> : complete bipartite\n\
63 -i<n> : generate <n> random\n\
64 -m<x> : triangular mesh\n\
65 -M<x,y> : x by y Moebius strip\n\
66 -n<prefix> : use <prefix> in node names (\"\")\n\
67 -N<name> : use <name> for the graph (\"\")\n\
68 -o<outfile> : put output in <outfile> (stdout)\n\
70 -r<x>,<n> : random graph\n\
71 -R<n> : random rooted tree on <n> vertices\n\
73 -S<x> : 2D sierpinski\n\
74 -S<x>,<d> : <d>D sierpinski (<d> = 2,3)\n\
75 -t<x> : binary tree \n\
76 -t<x>,<n> : n-ary tree \n\
78 -T<x,y,t1,t2> : twisted torus \n\
80 -d : directed graph\n\
86 fprintf(v ? stderr : stdout,
Usage,
cmd);
91 fprintf(stderr,
"in flag -%c\n", (
char)opt);
101 static const unsigned MIN = 1;
103 const unsigned long d = strtoul(
s, e, 10);
104 if (
s == *e || d > UINT_MAX) {
105 fprintf(stderr,
"ill-formed integer \"%s\" ",
s);
109 fprintf(stderr,
"integer \"%s\" less than %d",
s,
MIN);
148 fprintf(stderr,
"ill-formed int pair \"%s\" ",
s);
175 fprintf(stderr,
"ill-formed int pair \"%s\" ",
s);
245static char *
optList =
":i:M:m:n:N:c:C:dg:G:h:k:b:B:o:p:r:R:s:S:X:t:T:vw:";
254 while ((c = getopt(argc, argv,
optList)) != -1) {
337 fprintf(stderr,
"%uD Sierpinski not implemented - use 2 or 3 ",
373 fprintf(stderr,
"Unrecognized flag \"-%c\" - ignored\n",
377 fprintf(stderr,
"Unexpected error\n");
387 fprintf(stderr,
"Graph type not set\n");
396static void dirfn(
unsigned t,
unsigned h) {
419int main(
int argc,
char *argv[])
487 for (
unsigned i = 1; i <=
opts.
cnt; i++) {
static NORETURN void graphviz_exit(int status)
void makeTriMesh(unsigned sz, edgefn ef)
void makeHypercube(unsigned dim, edgefn ef)
void makeCircle(unsigned n, edgefn ef)
void makeTree(unsigned depth, unsigned nary, edgefn ef)
void makeWheel(unsigned n, edgefn ef)
void makeSquareGrid(unsigned dim1, unsigned dim2, int connect_corners, int partial, edgefn ef)
void makeBinaryTree(unsigned depth, edgefn ef)
void makeComplete(unsigned n, edgefn ef)
void makeMobius(unsigned w, unsigned h, edgefn ef)
treegen_t * makeTreeGen(unsigned N)
void makeCompleteB(unsigned dim1, unsigned dim2, edgefn ef)
void makeBall(unsigned w, unsigned h, edgefn ef)
void makePath(unsigned n, edgefn ef)
void makeTetrix(unsigned depth, edgefn ef)
void makeCylinder(unsigned dim1, unsigned dim2, edgefn ef)
void makeStar(unsigned n, edgefn ef)
void freeTreeGen(treegen_t *tg)
void makeTorus(unsigned dim1, unsigned dim2, edgefn ef)
void makeTwistedTorus(unsigned dim1, unsigned dim2, unsigned t1, unsigned t2, edgefn ef)
void makeRandomTree(treegen_t *tg, edgefn ef)
void makeRandom(unsigned h, unsigned w, edgefn ef)
void makeSierpinski(unsigned depth, edgefn ef)
static int setTwoTwoOpt(char *s, opts_t *opts, unsigned dflt)
static void dirfn(unsigned t, unsigned h)
static int setOne(char *s, opts_t *opts)
static int setTwoOpt(char *s, opts_t *opts, unsigned dflt)
static GraphType init(int argc, char *argv[], opts_t *opts)
static unsigned readPos(char *s, char **e)
static int readOne(char *s, unsigned *ip)
static int setTwo(char *s, opts_t *opts)
static void errexit(int opt)
static void closeOpen(void)
static char * setFold(char *s, opts_t *opts)
static void undirfn(unsigned t, unsigned h)
static const char * usage
static FILE * openFile(const char *argv0, const char *name, const char *mode)
void(* edgefn)(Agraph_t *, Agedge_t *, glCompColor)