dot

Table of Contents

Overview

digraph G {
  subgraph cluster0 {
    node [style=filled,color=white];
    style=filled;
    color=lightgrey;
    a0 -> a1 -> a2 -> a3;
    label = "process #1";
  }
  subgraph cluster1 {
    node [style=filled];
    b0 -> b1 -> b2 -> b3;
    label = "process #2";
    color=blue
  }
  start -> a0;
  start -> b0;
  a1 -> b3;
  b2 -> a3;
  a3 -> a0;
  a3 -> end;
  b3 -> end;
  start [shape=Mdiamond];
  end [shape=Msquare];
}

Reference

Terminology

Topics

Language Syntax

graph :   [ strict ] (graph | digraph) [ ID ] '{' stmt_list '}'
stmt_list :   [ stmt [ ';' ] stmt_list ]
stmt  :   node_stmt
| edge_stmt
| attr_stmt
| ID '=' ID
| subgraph
attr_stmt :   (graph | node | edge) attr_list
attr_list :   '[' [ a_list ] ']' [ attr_list ]
a_list    :   ID '=' ID [ (';' | ',') ] [ a_list ]
edge_stmt :   (node_id | subgraph) edgeRHS [ attr_list ]
edgeRHS   :   edgeop (node_id | subgraph) [ edgeRHS ]
node_stmt :   node_id [ attr_list ]
node_id   :   ID [ port ]
port  :   ':' ID [ ':' compass_pt ]
| ':' compass_pt
subgraph  :   [ subgraph [ ID ] ] '{' stmt_list '}'
compass_pt    :   (n | ne | e | se | s | sw | w | nw | c | _)
ID
  • Any string of alphabetic ([a-zA-Z\200-\377]) characters, underscores (_) or digits ([0-9]), not beginning with a digit;
  • a numeral [-]?(.[0-9]+ | [0-9]+(.[0-9]*)? );
  • any double-quoted string ("...") possibly containing escaped quotes (\");
  • an HTML string (<...>).
keywords are case-independent

node, edge, graph, digraph, subgraph, and strict

edgeop
  • -- in undirected graphs(graph).
  • -> in directed graphs(digraph)
comments
  • The language supports C++-style comments
  • /* */ and //.
C prerprocessor
  • A line beginning with a # character is considered a line output from a C preprocessor
  • e.g., # 34 to indicate line 34, and discarded

Subgraphs and Clusters

A -> {B C}

is equivalent to

A -> B
A -> C
// A, B and C should all be placed on the same rank 
subgraph { 
  rank = same; A; B; C; 
} 

How-to

Links