LinuxCommandLibrary

dot

Visualize graphs described in DOT language

TLDR

Render a PNG image with a filename based on the input filename and output format (uppercase -O)

$ dot -T [png] -O [path/to/input.gv]
copy

Render a SVG image with the specified output filename (lowercase -o)
$ dot -T [svg] -o [path/to/image.svg] [path/to/input.gv]
copy

Render the output in PS, PDF, SVG, Fig, PNG, GIF, JPEG, JSON, or DOT format
$ dot -T [format] -O [path/to/input.gv]
copy

Render a GIF image using stdin and stdout
$ echo "[digraph {this -> that} ]" | dot -T [gif] > [path/to/image.gif]
copy

Display help
$ dot -?
copy

SYNOPSIS

dot [options] [input_file(s)]

PARAMETERS

-Tformat
    Specifies the output format. Common formats include png, svg, pdf, ps, dot, jpg, gif, etc.

-ooutfile
    Writes the generated graph to the specified output file. If omitted, output goes to standard output.

-Klayout
    Specifies the layout algorithm to use. Although dot itself defaults to 'dot', other layout engines like 'neato', 'fdp', 'sfdp', 'circo', 'twopi' can be explicitly chosen if the Graphviz suite is installed.

-Gname=value
    Sets a global graph attribute. Can be specified multiple times.

-Nname=value
    Sets a default node attribute. Can be specified multiple times.

-Ename=value
    Sets a default edge attribute. Can be specified multiple times.

-V
    Prints version information and exits.

-?
    Prints usage information and exits.

input_file(s)
    One or more input files containing graph descriptions in DOT language. If no files are specified, dot reads from standard input.

DESCRIPTION

dot is a powerful command-line tool from the open-source Graphviz suite, primarily used for laying out and rendering directed graphs. It interprets graph descriptions written in the plain-text DOT language, transforming them into high-quality graphical representations. Its strength lies in its hierarchical layout algorithm, which effectively visualizes dependencies, flowcharts, state machines, and organizational structures by arranging nodes in layers. Users define nodes, edges, and various attributes (colors, shapes, labels, sizes) within the DOT file, and dot automatically calculates optimal positions and edge routes. This automation makes it invaluable for generating visual diagrams from structured data, widely used in software engineering, bioinformatics, network visualization, and academic research. It supports a vast array of output formats, including common image types like PNG, SVG, PDF, and PostScript, allowing for diverse application integration.

CAVEATS

Performance can degrade significantly for very large or dense graphs, potentially leading to long processing times or excessive memory usage.
The layout quality heavily depends on the structure of the input graph and the judicious use of DOT language attributes.
Errors in the DOT input file can lead to parsing failures or unexpected output.

INPUT FORMAT: DOT LANGUAGE

dot expects its input in the DOT language, a simple plain-text graph description language. It allows users to define nodes, edges (directed or undirected), and attach various attributes (like color, shape, label, font, size) to control the visual representation of the graph elements and the overall layout.

OUTPUT FORMATS

dot supports a wide range of output formats, making it versatile for different applications. These include raster images (PNG, JPEG, GIF), vector graphics (SVG, PDF, PostScript, EPS), and even other graph description languages (like plain DOT itself for debugging or further processing).

HISTORY

dot is a foundational component of Graphviz (Graph Visualization Software), an open-source graph drawing software package.
Graphviz was originally developed at AT&T Labs Research by Stephen North and others.
It originated in the 1990s as a set of tools for visualizing graphs that arose in various research projects.
The DOT language and the dot layout engine became key components, enabling programmatic graph drawing and widespread adoption in various fields from software engineering to bioinformatics.

SEE ALSO

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

Copied to clipboard