Graphviz / DOT in Markdown
Mastering the DOT language to generate mathematically perfect network and graph layouts natively in Markdown.
Graphviz is one of the oldest and most powerful graph visualization software programs available. It uses the DOT language to describe structural information as diagrams of abstract graphs and networks.
Because it focuses heavily on layout algorithms, Graphviz is perfect when you have hundreds of nodes and want an algorithm to organize them with minimal overlapping lines.
In your markdown editor, use the language identifier dot or graphviz.
The dot Layout Algorithm
The standard dot algorithm creates directed graphs (digraphs). It is heavily used in software engineering to visualize function call stacks and data structures.
Basic Syntax
To create a graph, start with digraph G { and define the relationships using ->.
|
|
|
Clusters and Subgraphs
You can group nodes together using clusters. A cluster’s ID must start with the word cluster.
|
|
|
Styling and Attributes
Graphviz is heavily configurable via attributes. You can apply attributes to specific nodes or global defaults.
Shapes
Common shapes include box, polygon, ellipse, oval, circle, record, and cylinder.
The record Shape
The record shape is iconic in Graphviz; it allows you to split a node into horizontal or vertical sections, making it ideal for rendering database schemas. Use a pipe | to separate fields.
|
|
|
Generating Graphs
Graphviz shines when generated dynamically by scripts. If your application needs to output a dependency graph, having your script spit out DOT language syntax and pasting it into MarkdownToPrettyPDF is a foolproof workflow to generate immediate, scalable vector graphics.