my-server
← Wiki Redirected from DOT language

DOT (graph description language)

DOT is a graph description language, developed as a part of the Graphviz project. DOT graphs are typically stored as files with the <code>.gv</code> or <code>.dot</code> filename extension — <code>.gv</code> is preferred, to avoid confusion with the <code>.dot</code> extension used by versions of Microsoft Word before 2007. <code>dot</code> is also the name of the main program to process DOT files in the Graphviz package.

Various programs can process DOT files. Some, such as dot, neato, twopi, circo, fdp, and sfdp, can read a DOT file and render it in graphical form. Others, such as gvpr, gc, acyclic, ccomps, sccmap, and tred, read DOT files and perform calculations on the represented graph. Finally, others, such as lefty, dotty, and grappa, provide an interactive interface. The GVedit tool combines a text editor and a non-interactive viewer. Most programs are part of the Graphviz package or use it internally.

DOT is historically an acronym for "DAG of tomorrow", as the successor to a DAG format and a dag program which handled only directed acyclic graphs.

Syntax

Graph types

Undirected graphs

At its simplest, DOT can be used to describe an undirected graph. An undirected graph shows simple relations between objects, such as reciprocal friendship between people. The <code>graph</code> keyword is used to begin a new graph, and nodes are described within curly braces. A double-hyphen (<code>--</code>) is used to show relations between the nodes.

Directed graphs

Similar to undirected graphs, DOT can describe directed graphs, such as flowcharts and dependency trees. The syntax is the same as for undirected graphs, except the <code>digraph</code> keyword is used to begin the graph, and an arrow (->) is used to show relationships between nodes.

Attributes

Various attributes can be applied to graphs, nodes and edges in DOT files. These attributes can control aspects such as color, shape, and line styles. For nodes and edges, one or more attribute–value pairs are placed in square brackets <code>[]</code> after a statement and before the semicolon (which is optional). Graph attributes are specified as direct attribute–value pairs under the graph element, where multiple attributes are separated by a comma or using multiple sets of square brackets, while node attributes are placed after a statement containing only the name of the node, but not the relations between the dots.

HTML-like labels are supported, although initially Graphviz did not handle them.

Comments

DOT supports C and C++ style single line and multiple line comments. In addition, it ignores lines with a number sign symbol <code>#</code> as their first character, like many interpreted languages.

Layout programs

] The DOT language defines a graph, but does not provide facilities for rendering the graph. There are several programs that can be used to render, view, and manipulate graphs in the DOT language:

General

  • Graphviz – a collection of CLI utilities and libraries to manipulate and render graphs into different formats like SVG, PDF, PNG etc.
  • <code>dot</code> – CLI tool for conversion between and other formats

JavaScript

  • Canviza JavaScript library for rendering DOT files
  • d3-graphviza JavaScript library based on Viz.js and D3.js that renders DOT graphs and supports animated transitions between graphs and interactive graph manipulation
  • Vis.jsa JavaScript library that accept DOT as input for network graphs.
  • Viz.js – a JavaScript port of Graphviz that provides a simple wrapper for using it in the browser.
  • hpcc-js/wasm Graphviza fast WASM library for Graphviz similar to Viz.js

Java

  • Gephian interactive visualization and exploration platform for all kinds of networks and complex systems, dynamic and hierarchical graphs
  • Grappaa partial port of Graphviz to Java
  • graphviz-javaan open source partial port of Graphviz to Java available from github.com
  • ZGRViewera DOT viewer

Other

Notes

See also

External links