LinuxCommandLibrary

twopi

TLDR

Generate a radial layout and output as PNG

$ twopi -Tpng -o [output.png] [input.dot]
copy
Render to SVG format
$ twopi -Tsvg -o [output.svg] [input.dot]
copy
Specify a root node for the center
$ twopi -Groot=[node_name] -Tpng -o [output.png] [input.dot]
copy
Set the radial distance between rings (in inches)
$ twopi -Granksep=[1.5] -Tpng -o [output.png] [input.dot]
copy
Eliminate node overlaps using Voronoi diagrams
$ twopi -Goverlap=false -Tpng -o [output.png] [input.dot]
copy
Process from stdin
$ cat [graph.dot] | twopi -Tpng > [output.png]
copy

SYNOPSIS

twopi [-Gname=value] [-Nname=value] [-Ename=value] [-Tformat] [-o outfile] [files]

DESCRIPTION

twopi is a Graphviz layout program that draws graphs using a radial layout algorithm. One node is chosen as the center and placed at the origin, with remaining nodes arranged on concentric circles at increasing distances based on their graph distance from the center.
Nodes at distance 1 from the center appear on the first ring, nodes at distance 2 on the second ring, and so forth. This layout is particularly effective for visualizing hierarchies, network topologies, and trees where relationships radiate from a central point.
The center node can be specified with the root attribute; otherwise, twopi selects a node furthest from any leaf node. The spacing between rings is controlled by ranksep (default 0.75 inches). Node overlaps can be resolved using the overlap attribute with Voronoi diagrams or scaling.
Input must be in DOT graph language format. twopi is part of the Graphviz suite alongside dot, neato, circo, fdp, and sfdp.

PARAMETERS

-T format

Output format: png, svg, pdf, ps, jpg, gif, and many others.
-o file
Output file name. If omitted, output goes to stdout.
-Gname=value
Set graph attribute. Common attributes: root, ranksep, overlap.
-Nname=value
Set default node attribute.
-Ename=value
Set default edge attribute.
-K layout
Specify layout engine (default: twopi).
-V
Print version information.
-?
Print usage information.

CAVEATS

For large graphs, radial layouts can become cluttered as outer rings contain exponentially more nodes. The automatic center selection may not always produce optimal results; manually specifying the root node often improves layout quality. Memory usage scales with graph size.

HISTORY

twopi was developed as part of Graphviz at AT&T Labs Research in the 1990s. The radial layout algorithm is based on work by Graham Wills presented at the Graph Drawing Symposium in 1997. Graphviz was open-sourced in 2000 and continues to be actively maintained.

SEE ALSO

dot(1), neato(1), circo(1), fdp(1), sfdp(1)

Copied to clipboard