DOT
DOT is a graph description language. There are several programs that can be used to render, view, and manipulate graphs in the DOT language, most notable of which is Graphviz <1>.
Example
The following example illustrates the basic syntax of DOT.
digraph example {
charset="UTF-8" // default charset
node [shape=box] // default node style
newrank="true" // new ranking algorithm
rankdir="LR" // rank direction: TB (default), BT, LR, RL
compound="true" // allows edges between clusters with lhead and ltail
a1 [label="A1"];
a2 [label="A2"];
subgraph cluster_b {
label="A cluster of Bs";
color=purple;
rank="same"; /* rank constraints on the nodes in a subgraph:
"same" - all nodes are placed on the same rank
"min" - all nodes are placed on the minimum rank */
b1 [label="B1", shape=diamond, color=white, style=filled, fillcolor=blue];
b2 [label="B2", shape=doubleoctagon, color=white, style=filled, fillcolor=red];
b3 [label="B3", shape=hexagon, color=white, style=filled, fillcolor=green];
b1 -> {b2 b3} [arrowhead=diamond];
}
subgraph cluster_c {
label="Some structures";
node [shape=record];
c1 [label="<f0> left|<f1> middle|<f2> right"];
c2 [label="<f0> one|<f1> two"];
c3 [label="X|{a |{b|<important> c|d}| e}| X | Y"];
c1:f1 -> c2:f0;
c1:f2 -> c3:important;
}
a1 -> b1 [arrowhead=dot, label="1?"];
a2 -> b2 [arrowhead=inv, label="2?", lhead="cluster_b"];
b2 -> c1 [arrowhead=vee, ltail="cluster_b", lhead="cluster_c"];
}
example.pngBack matter
External links
<1> Graphviz (https://graphviz.org)<2> Graphviz Visual Editor (http://magjac.com)
Response: 20 (Success), text/gemini
| Original URL | gemini://tilde.club/~filip/tech/cheatsheet/dot/dot.gmi |
|---|---|
| Status Code | 20 (Success) |
| Content-Type | text/gemini; charset=utf-8; lang=en |