← 返回命令列表

Linux command

twopi 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Generate a radial layout

twopi -Tpng -o [output.png] [input.dot]

Render to SVG format

twopi -Tsvg -o [output.svg] [input.dot]

Specify a root node

twopi -Groot=[node_name] -Tpng -o [output.png] [input.dot]

Set the radial distance

twopi -Granksep=[1.5] -Tpng -o [output.png] [input.dot]

Eliminate node overlaps

twopi -Goverlap=false -Tpng -o [output.png] [input.dot]

Process from stdin

cat [graph.dot] | twopi -Tpng > [output.png]

说明

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 randomly picks one of the nodes furthest from a leaf node (a node of degree 1). If no leaf nodes exist, an arbitrary node is chosen. The spacing between rings is controlled by ranksep (default 0.75 inches). Node overlaps can be resolved using the overlap attribute: false uses Voronoi diagrams, scale uniformly scales up the layout, and true (the default) does no repositioning. Input must be in DOT graph language format. twopi is part of the Graphviz suite alongside dot, neato, circo, fdp, and sfdp.

参数

-T _format_
Output format: png, svg, pdf, ps, jpg, gif, and many others.
-o _file_
Output file name. If omitted, output goes to stdout.
-G_name_=_value_
Set graph attribute. Common attributes: root, ranksep, overlap.
-N_name_=_value_
Set default node attribute.
-E_name_=_value_
Set default edge attribute.
-K _layout_
Specify layout engine (default: twopi).
-V
Print version information.
-s _scale_
Set input scale to _scale_. If omitted, a default value of 72 is used.
-?
Print usage information.

FAQ

What is the twopi command used for?

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 randomly picks one of the nodes furthest from a leaf node (a node of degree 1). If no leaf nodes exist, an arbitrary node is chosen. The spacing between rings is controlled by ranksep (default 0.75 inches). Node overlaps can be resolved using the overlap attribute: false uses Voronoi diagrams, scale uniformly scales up the layout, and true (the default) does no repositioning. Input must be in DOT graph language format. twopi is part of the Graphviz suite alongside dot, neato, circo, fdp, and sfdp.

How do I run a basic twopi example?

Run `twopi -Tpng -o [output.png] [input.dot]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -T _format_ do in twopi?

Output format: png, svg, pdf, ps, jpg, gif, and many others.