DOT Language
   HOME

TheInfoList



OR:

DOT is a
graph Graph may refer to: Mathematics *Graph (discrete mathematics), a structure made of vertices and edges **Graph theory, the study of such graphs and their properties *Graph (topology), a topological space resembling a graph in the sense of discre ...
description language. DOT graphs are typically
file File or filing may refer to: Mechanical tools and processes * File (tool), a tool used to ''remove'' fine amounts of material from a workpiece **Filing (metalworking), a material removal process in manufacturing ** Nail file, a tool used to gent ...
s with the
filename extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically d ...
''gv'' or ''dot''. The extension ''gv'' is preferred, to avoid confusion with the extension ''dot'' used by versions of
Microsoft Word Microsoft Word is a word processing software developed by Microsoft. It was first released on October 25, 1983, under the name ''Multi-Tool Word'' for Xenix systems. Subsequent versions were later written for several other platforms includin ...
before 2007. 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 with noninteractive image viewer. Most programs are part of the
Graphviz Graphviz (short for ''Graph Visualization Software'') is a package of open-source tools initiated by AT&T Labs Research for drawing graphs specified in DOT language scripts having the file name extension "gv". It also provides libraries for sof ...
package or use it internally.


Syntax


Graph types


Undirected graphs

At its simplest, DOT can be used to describe an
undirected graph In discrete mathematics, and more specifically in graph theory, a graph is a structure amounting to a set of objects in which some pairs of the objects are in some sense "related". The objects correspond to mathematical abstractions called '' v ...
. An undirected graph shows simple relations between objects, such as friendship between people. The ''graph'' keyword is used to begin a new graph, and nodes are described within curly braces. A double-hyphen (--) is used to show relations between the nodes. // The graph name and the semicolons are optional graph graphname


Directed graphs

Similar to undirected graphs, DOT can describe
directed graphs Director may refer to: Literature * ''Director'' (magazine), a British magazine * ''The Director'' (novel), a 1971 novel by Henry Denker * ''The Director'' (play), a 2000 play by Nancy Hasty Music * Director (band), an Irish rock band * ''D ...
, such as
flowchart A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task. The flowchart shows the steps as boxes of va ...
s and dependency
tree In botany, a tree is a perennial plant with an elongated stem, or trunk, usually supporting branches and leaves. In some usages, the definition of a tree may be narrower, including only woody plants with secondary growth, plants that are ...
s. The syntax is the same as for undirected graphs, except the ''digraph'' keyword is used to begin the graph, and an arrow (->) is used to show relationships between nodes. digraph graphname


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 ([]) 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. graph graphname HTML-like labels are only available on versions of
Graphviz Graphviz (short for ''Graph Visualization Software'') is a package of open-source tools initiated by AT&T Labs Research for drawing graphs specified in DOT language scripts having the file name extension "gv". It also provides libraries for sof ...
that are newer than mid-November 2003, in particular, they are not considered as part of release 1.10.


Comments

Dot supports C and C++ style single line and multiple line comments. In addition, it ignores lines with a number sign symbol (#) as their first character. // This is a single line comment. /* This is a multiple line comment. */ # Lines like this are also ignored.


A simple example

Following is an example script that describes the bonding structure of an
ethane Ethane ( , ) is an organic chemical compound with chemical formula . At standard temperature and pressure, ethane is a colorless, odorless gas. Like many hydrocarbons, ethane is isolated on an industrial scale from natural gas and as a petr ...
molecule. This is an undirected graph and contains node attributes as explained above. graph ethane


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 Graphviz (short for ''Graph Visualization Software'') is a package of open-source tools initiated by AT&T Labs Research for drawing graphs specified in DOT language scripts having the file name extension "gv". It also provides libraries for sof ...
– a collection of CLI utilities and libraries to manipulate and render graphs into different formats like Scalable Vector Graphics, SVG,
PDF Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
, PNG etc. **dot – CLI tool for conversion between and other formats


JavaScript

* Canviza
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
library for rendering DOT files * d3-graphviza
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
library based on Viz.js and
D3.js D3.js (also known as D3, short for Data-Driven Documents) is a JavaScript library for producing dynamic, interactive data visualizations in web browsers. It makes use of Scalable Vector Graphics (SVG), HTML5, and Cascading Style Sheets (CSS) sta ...
that renders DOT graphs and supports animated transitions between graphs and interactive graph manipulation * Vis.jsa
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
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

*
Gephi Gephi ( ) is an open-source network analysis and visualization software package written in Java on the NetBeans platform. History Initially developed by students of the University of Technology of Compiègne (UTC) in France, Gephi has been select ...
an interactive visualization and exploration platform for all kinds of networks and complex systems, dynamic and hierarchical graphs * Grappaa partial port of Graphviz to
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
* graphviz-javaan open source partial port of Graphviz to
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
available from github.com * ZGRViewera DOT viewer


Other

* Beluginga
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
- &
Google Cloud Platform Google Cloud Platform (GCP), offered by Google, is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search, Gmail, Google Drive, and YouTube. Alongside ...
-based viewer of DOT and Beluga extensions * dot2texa program to convert files from DOT to
PGF/TikZ PGF/Ti''k''Z is a pair of languages for producing vector graphics (e.g., technical illustrations and drawings) from a geometric/algebraic description, with standard features including the drawing of points, lines, arrows, paths, circles, ellipse ...
or PSTricks, both of which are rendered in
LaTeX Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latexes are found in nature, but synthetic latexes are common as well. In nature, latex is found as a milky fluid found in 10% of all flowering plants (angiosperms ...
*
OmniGraffle OmniGraffle is a diagramming and digital illustration application for macOS and iOS created by The Omni Group. Uses OmniGraffle is used to create graphics and visuals. The application features several design tools, along with a drag-and-drop ...
a
digital illustration Digital illustration or computer illustration is the use of digital tools to produce images under the direct manipulation of the artist, usually through a pointing device such as a tablet or a mouse. It is distinguished from computer-''generated' ...
application for
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
that can import a subset of DOT, producing an editable document (but the result cannot be exported back to DOT) *
Tulip Tulips (''Tulipa'') are a genus of spring-blooming perennial herbaceous bulbiferous geophytes (having bulbs as storage organs). The flowers are usually large, showy and brightly coloured, generally red, pink, yellow, or white (usually in warm ...
a
software framework In computer programming, a software framework is an abstraction in which software, providing generic functionality, can be selectively changed by additional user-written code, thus providing application-specific software. It provides a standard ...
in
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
that can import DOT files for analysis * VizierFXan
Apache Flex Apache Flex, formerly Adobe Flex, is a software development kit (SDK) for the development and deployment of cross-platform rich web applications based on the Adobe Flash platform. Initially developed by Macromedia and then acquired by Adobe System ...
graph rendering library in
ActionScript ActionScript is an object-oriented programming language originally developed by Macromedia Inc. (later acquired by Adobe). It is influenced by HyperTalk, the scripting language for HyperCard. It is now an implementation of ECMAScript (meaning i ...


Limitations

While the DOT format allows the user to specify layout details via positional attributes, most tools rely on automated layout algorithms. These algorithms are best efforts and sometimes produce undesirable results. For example: There are presentation problems in the image titled "An image that seems improperly rendered". The square on the right is not a perfect
square In Euclidean geometry, a square is a regular quadrilateral, which means that it has four equal sides and four equal angles (90-degree angles, π/2 radian angles, or right angles). It can also be defined as a rectangle with two equal-length adj ...
, and some labels are misaligned with their arrows (such as (g o f)'). This can be fixed with a
vector graphics editor A vector graphics editor is a computer program that allows users to compose and edit vector graphics images interactively on a computer and save them in one of many popular vector graphics formats, such as EPS, PDF, WMF, SVG, or VML. Vector ...
. In some cases, this can also be fixed by using the ''pos'' attribute to specify a position, and the ''weight'' attribute to square the graph.


See also

* lisp2dot tool to convert
Lisp programming language Lisp (historically LISP) is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation. Originally specified in 1960, Lisp is the second-oldest high-level programming language still in common us ...
-like program trees to DOT language. Designed for use with
genetic programming In artificial intelligence, genetic programming (GP) is a technique of evolving programs, starting from a population of unfit (usually random) programs, fit for a particular task by applying operations analogous to natural genetic processes to t ...
.


Notes


External links


DOT tutorial and specification
*
Drawing graphs with dot
*

*

*
Gallery of examples

Online graph visualization in SVG


{{Graph representations Mathematical software Graph description languages Graph drawing