Questions tagged [dot]

DOT is both a mathematical graph description language and a particular graph rendering engine (dot). As a graph description language, DOT uses a simple plain text mapping syntax to describe the relationships between nodes and edges (e.g. `nodeA -> nodeB`) , and a plain text markup syntax to add style, annotations, and constrain the rendered layout.

DOT is a plain text graph description language. It is a simple way of describing graphs that both humans and computer programs can use.

The following Example:

digraph g{

    // basic: A,B,C,D  (this is a comment)
    A -> B -> C -> D
    D -> C
    B -> D

    // node and edge markups
    nodeA [shape=diamond, color=red, style=dashed, label="Warehouse 259"]
    nodeA -> nodeB [color=blue, style=solid, label="MWF schedule, 2 ton capacity"]

}

will render to this graph:

enter image description here

DOT graphs are typically files that end with the .gv (preferred) or .dot extension.

Most uses of DOT are either by GraphViz programs or by software that uses GraphViz internally.

1075 questions
565
votes
12 answers

Graphviz: How to go from .dot to a graph?

I can't seem to figure this out. I have a .dot file, which is valid according to the syntax. How do I use graphviz to convert this into an image? (note that I'm on Windows, not linux)
Nick Heiner
  • 119,074
  • 188
  • 476
  • 699
226
votes
4 answers

GraphViz - How to connect subgraphs?

In the DOT language for GraphViz, I'm trying to represent a dependency diagram. I need to be able to have nodes inside a container and to be able to make nodes and/or containers dependent on other nodes and/or containers. I'm using subgraph to…
Winston Smith
  • 21,585
  • 10
  • 60
  • 75
220
votes
4 answers

How to add edge labels in Graphviz?

I am trying to draw a graph using Graphviz, but I need to add labels on the edges. There does not seem to be any way to that in Graphviz. Are there a way out?
user855
  • 19,048
  • 38
  • 98
  • 162
109
votes
2 answers

Graphviz, changing the size of edge

How to change the size of edge in dot (graphviz)? I would like to make some edges "bolded".
name
  • 5,095
  • 5
  • 27
  • 36
97
votes
2 answers

Dot graph language - how to make bidirectional edges automatically?

Here is a very simplified example of my Dot graph: strict digraph graphName { A->B B->A } This creates Instead I want a single edge shown between A and B but with a double arrow head. I know how to get the double arrowhead as a global…
I82Much
  • 26,901
  • 13
  • 88
  • 119
81
votes
1 answer

Graphviz subgraph doesn't get visualized

I'm trying to create a graph with two subgraphs in dot. The code is as follows: digraph G { subgraph step1 { style=filled; node [label="Compiler"] step1_Compiler; node [label="Maschine"]…
halfdan
  • 33,545
  • 8
  • 78
  • 87
72
votes
1 answer

Horizontal Trees in Graphviz

I've made a tree in the dot language, similar to the one here. Is there any way I could get the tree to expand to the right, instead of downwards (so the root node is on the left and children go along to the right).
Peter
  • 1,381
  • 2
  • 13
  • 24
70
votes
1 answer

Graphviz: Putting a Caption on a Node In Addition to a Label

In my Graphviz graph (written in DOT), I want each node to have a label, but in addition to that, I want some nodes to have a small caption denoting some other unique value for that node. For example, if this were for a history diagram, a node's…
A. Duff
  • 4,097
  • 7
  • 38
  • 69
69
votes
3 answers

How to force node position (x and y) in graphviz

I am trying to force position of nodes. I have x and y coordinates of my nodes and its also directed graph. I can use the rank=same to handle row (y coordinate), but can't figure out how I can handle column (x coordinate).
user664947
  • 691
  • 1
  • 5
  • 4
64
votes
4 answers

How do I set the resolution when converting dot files (graphviz) to images?

I tried $ dot -Tpng rel_graph.gv > rel_graph.png but the resulting image has a very low quality.
Alexandru
  • 25,070
  • 18
  • 69
  • 78
61
votes
5 answers

Newline in node label in dot (graphviz) language

Does anyone know how to put newline in the label of the node? \n is not working - instead some new nodes appear.
M T
  • 968
  • 1
  • 8
  • 24
59
votes
3 answers

How do I place nodes on the same level in DOT?

I want to render several trees simultaneously and place all root nodes and all leaf nodes on the same level. Here's an example of what I'm trying to do. Root nodes A and X are on the same level, and so are leaf nodes B, D, and Z. I unsuccessfully…
Thalecress
  • 3,231
  • 9
  • 35
  • 47
50
votes
5 answers

How to control node placement in graphviz (i.e. avoid edge crossings)

I'm using graphviz (dot) to generate the graph you can see below. The node in the lower left corner (red ellipse) causes annoyance as its edges cross several edges of the adjacent node. Is there a way to restrain node placement to a certain area?
jnns
  • 5,148
  • 4
  • 47
  • 74
50
votes
1 answer

size of node with shape=circle

i'm trying to set the size of the nodes this way: controller[shape=circle,width=.5,label="Controller",style=filled,fillcolor="#8EC13A"]; But all three nodes are with different size. How can i set fixed size?
cupakob
  • 8,411
  • 24
  • 67
  • 76
49
votes
4 answers

How to place edge labels ON edge in graphviz

By default in Graphviz, edge labels are placed just to the right of the edge. I'm looking for a way to place the labels OVER the edge, centred on the edge. (It'll still be readable because I'm changing the colour of the edge). Any ideas?
naught101
  • 18,687
  • 19
  • 90
  • 138
1
2 3
71 72