Drawing graphs with dot
Table of Contents
1 Basic Graph Drawing
Draws graphs in four phases:
- Depends on graph being acyclic \(\rightarrow\) break any cycles by reversing the internal direction of certain cyclic edges.
- Assign nodes to discrete ranks or levels. In a top-to-bottom
drawing, ranks detemine
Ycoordinates. - Orders nodes within a rank to avoid crossings.
- Set
Xcoordinates of nodes to keep edges short, and route the edge splines.
1.1 Components
Language describes three kinds of objects:
- graphs
- nodes
- edges
1.2 Drawing
Main graph (outermost) can be:
- directed,
digraph - undirected,
graph
Within the main graph, a subgraph defines the subset of nodes
and edges.
digraph G {
main -> parse -> execute;
main -> init;
main -> cleanup;
execute -> make_string;
execute -> printf
init -> make_string;
main -> printf;
execute -> compare;
}
2 Reference
- http://graphviz.org/Documentation/dotguide.pdf
- Just scroll through it and see if you find some figures looking like you want, and look at the example.
- https://graphs.grevian.org/reference
- Really nice and concise resource for the basiscs