| name | dot-syntax |
| description | Use when writing or reading DOT/Graphviz code and needing quick syntax reference — node declarations, edge syntax, attributes, subgraphs, HTML labels, and common gotchas |
DOT Syntax Quick Reference
Overview
Fast lookup for DOT graph description language syntax. Covers the constructs you'll use 90% of the time.
Core principle: DOT describes structure (what connects to what). Layout engines handle positioning. You never specify coordinates.
Graph Declaration
digraph name { } // directed graph (use ->)
graph name { } // undirected graph (use --)
strict digraph name { } // no multi-edges allowed
Nodes
my_node // implicit creation
my_node [label="Display Name" shape=box] // explicit with attributes
my_node [label="Line 1\nLine 2"] // multiline label
"node with spaces" // quoted ID for special chars
ID rules: [a-zA-Z_][a-zA-Z_0-9]* unquoted. Use quotes for spaces/special chars.
Edges
A -> B // directed edge
A -> B [label="calls"] // labeled edge
A -> B -> C // chain
A -> {B C D} // fan-out (A connects to B, C, and D)
A -> B [style=dashed color=red] // styled edge
Attributes
// Defaults (apply to all subsequent nodes/edges)
node [shape=box style="rounded,filled" fillcolor="#E8F0FE" fontname="Helvetica"]
edge [color="#666666" fontsize=10]
graph [rankdir=TB nodesep=0.5]
// Per-element (override defaults)
my_node [shape=diamond fillcolor="#FFF9C4"]
A -> B [color=blue penwidth=2]
Shapes Quick Table