Learn DOT Language

DOT is a simple language for describing graphs and diagrams. Master it to create professional visualizations manually or understand AI-generated code.

IT
Ideas2Graph
Ideas2Graph Team Profile

Practical guide to the DOT language with examples and best practices — maintained and reviewed by the Ideas2Graph team.

For the official DOT reference and Graphviz documentation, see DOT language reference and Graphviz documentation.

Quick Start

Basic Structure

Every DOT file has a simple structure:

  • graph - for undirected graphs (connections have no direction)
  • digraph - for directed graphs (connections have arrows)
  • Nodes are defined simply by their names
  • Use -- for undirected edges, -> for directed

Common Attributes

Node Attributes:

  • shape - box, circle, diamond, ellipse
  • style - filled, rounded, dashed
  • fillcolor - background color
  • label - text to display

Graph Attributes:

  • rankdir - TB (top-bottom), LR (left-right)
  • bgcolor - background color
  • label - graph title

Examples

Simple Graph

A basic undirected graph with three nodes

graph {
  A -- B
  B -- C
  C -- A
}

Directed Graph (Digraph)

Shows direction of flow with arrows

digraph {
  Start -> Process
  Process -> Decision
  Decision -> End
}

Styled Nodes

Customize node appearance with colors and shapes

digraph {
  node [style=filled]
  A [fillcolor=lightblue, shape=box]
  B [fillcolor=lightgreen, shape=circle]
  C [fillcolor=pink, shape=diamond]
  A -> B -> C
}

Flowchart Example

A simple decision-making flowchart

digraph {
  rankdir=TB
  node [shape=box, style=filled, fillcolor=lightblue]
  
  Start [shape=ellipse, fillcolor=lightgreen]
  End [shape=ellipse, fillcolor=pink]
  Decision [shape=diamond, fillcolor=lightyellow]
  
  Start -> "Check Status"
  "Check Status" -> Decision
  Decision -> "Process A" [label="Yes"]
  Decision -> "Process B" [label="No"]
  "Process A" -> End
  "Process B" -> End
}

Hierarchical Structure

Organizational chart or tree structure

digraph {
  rankdir=TB
  node [shape=box, style="rounded,filled", fillcolor=lightblue]
  
  CEO [fillcolor=gold]
  CTO [fillcolor=lightgreen]
  CFO [fillcolor=lightgreen]
  
  CEO -> CTO
  CEO -> CFO
  CTO -> "Dev Team"
  CTO -> "QA Team"
  CFO -> "Finance"
}

Subgraphs & Clusters

Group related nodes together

digraph {
  subgraph cluster_0 {
    label="Frontend"
    style=filled
    fillcolor=lightblue
    A -> B
  }
  
  subgraph cluster_1 {
    label="Backend"
    style=filled
    fillcolor=lightgreen
    C -> D
  }
  
  B -> C [label="API"]
}

Additional Resources

© 2026 Ideas2Graph. All rights reserved.