LinuxCommandLibrary

graphviz

TLDR

Render DOT file to PNG

$ dot -Tpng [graph.dot] -o [graph.png]
copy
Render to SVG
$ dot -Tsvg [graph.dot] -o [graph.svg]
copy
Use different layout engine
$ neato -Tpng [graph.dot] -o [graph.png]
copy
Render to PDF
$ dot -Tpdf [graph.dot] -o [graph.pdf]
copy
Circular layout
$ circo -Tpng [graph.dot] -o [graph.png]
copy

SYNOPSIS

dot [options] [files]

DESCRIPTION

Graphviz is a graph visualization toolkit. It reads graph descriptions in DOT language and renders them as images. Multiple layout algorithms handle different graph types.

PARAMETERS

-T format

Output format: png, svg, pdf, ps, jpg.
-o file
Output file.
-K engine
Layout engine: dot, neato, fdp, sfdp, circo, twopi.
-G name=value
Set graph attribute.
-N name=value
Set node attribute.
-E name=value
Set edge attribute.

LAYOUT ENGINES

$ dot    - Hierarchical (directed graphs)
neato  - Spring model (undirected)
fdp    - Force-directed
sfdp   - Scalable force-directed
circo  - Circular layout
twopi  - Radial layout
copy

DOT LANGUAGE

$ digraph G {
    A -> B;
    B -> C;
    A -> C;
    A [shape=box];
    B [color=red];
}
copy

CAVEATS

Large graphs may be slow to render. Layout quality varies by algorithm choice. Complex styling requires learning DOT attributes. Text rendering may vary by output format.

HISTORY

Graphviz was developed at AT&T Labs Research, with initial work by Stephen North, Emden Gansner, and others in the 1990s. It was open-sourced and became the standard for programmatic graph visualization.

SEE ALSO

dot(1), neato(1), mermaid(1)

Copied to clipboard