Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
gvgen.c File Reference

generate graphs More...

#include "config.h"
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <getopt.h>
#include "graph_generator.h"
#include "openFile.h"
#include <util/exit.h>
Include dependency graph for gvgen.c:

Go to the source code of this file.

Data Structures

struct  opts_t
 

Enumerations

enum  GraphType {
  unknown , grid , circle , complete ,
  completeb , path , tree , torus ,
  cylinder , mobius , randomg , randomt ,
  ball , sierpinski , hypercube , star ,
  wheel , trimesh
}
 

Functions

static void usage (int v)
 
static void errexit (int opt)
 
static unsigned readPos (char *s, char **e)
 
static int readOne (char *s, unsigned *ip)
 
static int setOne (char *s, opts_t *opts)
 
static int setTwo (char *s, opts_t *opts)
 
static int setTwoTwoOpt (char *s, opts_t *opts, unsigned dflt)
 
static int setTwoOpt (char *s, opts_t *opts, unsigned dflt)
 
static char * setFold (char *s, opts_t *opts)
 
static GraphType init (int argc, char *argv[], opts_t *opts)
 
static void dirfn (unsigned t, unsigned h)
 
static void undirfn (unsigned t, unsigned h)
 
static void closeOpen (void)
 
int main (int argc, char *argv[])
 

Variables

static char * cmd
 
static char * Usage
 
static 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:"
 
static opts_t opts
 

Enumeration Type Documentation

◆ GraphType

enum GraphType
Enumerator
unknown 
grid 
circle 
complete 
completeb 
path 
tree 
torus 
cylinder 
mobius 
randomg 
randomt 
ball 
sierpinski 
hypercube 
star 
wheel 
trimesh 

Definition at line 32 of file gvgen.c.

Function Documentation

◆ closeOpen()

static void closeOpen ( void  )
static

Definition at line 411 of file gvgen.c.

References opts_t::directed, opts, and opts_t::outfile.

Referenced by main().

Here is the caller graph for this function:

◆ dirfn()

static void dirfn ( unsigned  t,
unsigned  h 
)
static

Definition at line 396 of file gvgen.c.

References opts, opts_t::outfile, and opts_t::pfx.

Referenced by main().

Here is the caller graph for this function:

◆ errexit()

static void errexit ( int  opt)
static

Definition at line 90 of file gvgen.c.

References usage.

Referenced by init().

Here is the caller graph for this function:

◆ init()

static GraphType init ( int  argc,
char *  argv[],
opts_t opts 
)
static

Definition at line 247 of file gvgen.c.

References ball, circle, cmd, opts_t::cnt, complete, completeb, cylinder, opts_t::directed, errexit(), opts_t::graphSize2, graphType, grid, hypercube, opts_t::isPartial, mobius, opts_t::name, openFile(), optList, opts, opts_t::outfile, path, opts_t::pfx, randomg, randomt, readOne(), setFold(), setOne(), setTwo(), setTwoOpt(), setTwoTwoOpt(), sierpinski, star, torus, tree, trimesh, unknown, usage, opts_t::Verbose, and wheel.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

◆ readOne()

static int readOne ( char *  s,
unsigned *  ip 
)
static

Definition at line 118 of file gvgen.c.

References NULL, and readPos().

Referenced by init(), setOne(), and setTwoTwoOpt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readPos()

static unsigned readPos ( char *  s,
char **  e 
)
static

Definition at line 100 of file gvgen.c.

References MIN.

Referenced by readOne(), setTwo(), setTwoOpt(), and setTwoTwoOpt().

Here is the caller graph for this function:

◆ setFold()

static char * setFold ( char *  s,
opts_t opts 
)
static

Definition at line 231 of file gvgen.c.

References opts_t::foldVal, and opts.

Referenced by init().

Here is the caller graph for this function:

◆ setOne()

static int setOne ( char *  s,
opts_t opts 
)
static

Definition at line 130 of file gvgen.c.

References opts_t::graphSize1, opts, and readOne().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTwo()

static int setTwo ( char *  s,
opts_t opts 
)
static

Definition at line 138 of file gvgen.c.

References opts_t::graphSize1, opts_t::graphSize2, NULL, opts, and readPos().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTwoOpt()

static int setTwoOpt ( char *  s,
opts_t opts,
unsigned  dflt 
)
static

Definition at line 209 of file gvgen.c.

References opts_t::graphSize1, opts_t::graphSize2, NULL, opts, and readPos().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTwoTwoOpt()

static int setTwoTwoOpt ( char *  s,
opts_t opts,
unsigned  dflt 
)
static

Definition at line 166 of file gvgen.c.

References opts_t::graphSize1, opts_t::graphSize2, opts, opts_t::parm1, opts_t::parm2, readOne(), and readPos().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ undirfn()

static void undirfn ( unsigned  t,
unsigned  h 
)
static

Definition at line 403 of file gvgen.c.

References opts, opts_t::outfile, and opts_t::pfx.

Referenced by main().

Here is the caller graph for this function:

◆ usage()

static void usage ( int  v)
static

Definition at line 84 of file gvgen.c.

References cmd, graphviz_exit(), and Usage.

Here is the call graph for this function:

Variable Documentation

◆ cmd

char* cmd
static

Definition at line 52 of file gvgen.c.

Referenced by init(), and usage().

◆ optList

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:"
static

Definition at line 245 of file gvgen.c.

Referenced by init().

◆ opts

◆ Usage

char* Usage
static
Initial value:
= "Usage: %s [-dv?] [options]\n\
-c<n> : cycle \n\
-C<x,y> : cylinder \n\
-g[f]<h,w> : grid (folded if f is used)\n\
-G[f]<h,w> : partial grid (folded if f is used)\n\
-h<x> : hypercube \n\
-k<x> : complete \n\
-b<x,y> : complete bipartite\n\
-B<x,y> : ball\n\
-i<n> : generate <n> random\n\
-m<x> : triangular mesh\n\
-M<x,y> : x by y Moebius strip\n\
-n<prefix> : use <prefix> in node names (\"\")\n\
-N<name> : use <name> for the graph (\"\")\n\
-o<outfile> : put output in <outfile> (stdout)\n\
-p<x> : path \n\
-r<x>,<n> : random graph\n\
-R<n> : random rooted tree on <n> vertices\n\
-s<x> : star\n\
-S<x> : 2D sierpinski\n\
-S<x>,<d> : <d>D sierpinski (<d> = 2,3)\n\
-t<x> : binary tree \n\
-t<x>,<n> : n-ary tree \n\
-T<x,y> : torus \n\
-T<x,y,t1,t2> : twisted torus \n\
-w<x> : wheel\n\
-d : directed graph\n\
-v : verbose mode\n\
-? : print usage\n"

Definition at line 54 of file gvgen.c.

Referenced by usage().