LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gvgen

generates various types of graphs in DOT format

TLDR

Generate a star graph with 5 vertices
$ gvgen -s [5] > star.gv
copy
Generate a grid graph
$ gvgen -g [3],[4] > grid.gv
copy
Generate a complete graph on 6 vertices
$ gvgen -k [6] > complete.gv
copy
Generate a binary tree of height 4
$ gvgen -t [4] > tree.gv
copy
Generate a random graph with 10 vertices
$ gvgen -r [10],[0.3] > random.gv
copy
Generate a directed cycle and write to a file
$ gvgen -d -c [8] -o [cycle.gv]
copy

SYNOPSIS

gvgen [-dv?] [-c n] [-C x,y] [-g[f] x,y] [-h n] [-k n] [-b x,y] [-B x,y] [-m n] [-M x,y] [-p n] [-r x,y] [-R x] [-s n] [-S n] [-t n] [-T x,y] [-w n] [-n prefix] [-N name] [-o outfile]

DESCRIPTION

gvgen generates a variety of simple, regularly-structured abstract graphs in DOT format. It creates standard graph structures useful for testing, visualization, and algorithm demonstrations.The tool supports stars, grids, trees, complete graphs, cycles, paths, random graphs, hypercubes, bipartite graphs, cylinders, tori, Moebius strips, Sierpinski graphs, and more. Output is in Graphviz DOT format for visualization with layout engines.

PARAMETERS

-s n

Generate a star on n vertices.
-g [f]x,y
Generate an x by y grid. If f is given, the grid is folded with edges attaching opposing corner vertices.
-k n
Generate a complete graph on n vertices.
-c n
Generate a cycle with n vertices and edges.
-p n
Generate a path on n vertices.
-t n
Generate a complete binary tree of height n. Use -t h,n for an n-ary tree.
-r x,y
Generate a random graph. The x and y give the number of vertices and the density of the edges (between 0 and 1).
-R x
Generate a random rooted tree on x vertices.
-h n
Generate a hypercube of degree n (2^n vertices).
-b x,y
Generate a complete x by y bipartite graph.
-C x,y
Generate an x by y cylinder.
-B x,y
Generate an x by y ball (a cylinder with two caps).
-m n
Generate a triangular mesh with n vertices on a side.
-M x,y
Generate an x by y Moebius strip.
-T x,y
Generate an x by y torus.
-S n
Generate a Sierpinski graph of order n.
-w n
Generate a wheel graph on n vertices.
-d
Make the generated graph directed.
-n prefix
Prepend prefix to integer node names.
-N name
Use name as the name of the graph.
-o outfile
Write output to the specified file instead of stdout.
-u seed
Specify the seed for the random number generator.
-v
Verbose output.
-?
Print usage information.

CAVEATS

Part of the Graphviz package. Random graphs vary each run unless a seed is specified with -u. Large graphs may be slow to render.

HISTORY

gvgen was developed as part of the Graphviz project to provide sample graph generation for testing and demonstration.

SEE ALSO

dot(1), neato(1), sfdp(1), gvpack(1)

Copied to clipboard
Kai