DOT – Graphviz

Graphviz is Open Source, CPL licensed, cross-platform software to generate and manipulate graphs. Graph visualization is a nice way of representing information as diagrams of abstract graphs and networks. Many important applications in software engineering, database and web design, networking, etc.

We had used one of these tools called the DOT Language or also DOTTY for generating a graph image from given code like structure.

Image of a Graph generated using DOT

Image of a Graph generated using DOT

was the image generated using the code as given below. Many a times a problem is faced wherein, one needs to show an output in the form of a graph, and drawing graphs on command line interface, can get extremely complicated.

digraph robdd{
node [shape = circle];
n4 -> n2 [label = “0” style=”dotted”];
n4 -> n3  [label = “1”];
n4 [label = “c”];
n2 -> n0 [label = “0” style=”dotted”];
n2 -> n1  [label = “1”];
n2 [label = “a”];
n3 -> n0 [label = “0” style=”dotted”];
n3 -> n1  [label = “1”];
n3 [label = “b”];
n0 [label = “0”];
n1 [label = “1”];
}

The layout engines in Graphviz are put down here and detailed user guides can be obtained for each at their documentation page

  • dot – Hierarchical drawing of directed graphs
  • neato – Force layout of undirected graphs
  • twopi – Radial layout
  • circo – Circular layout
  • fdp – Force layout of undirected graphs

Though our usage is restricted to the DOT language whose guide can be found here. The good point is that only that executable can be included (dot.exe) in your project, and it alone is sufficient to generate graphs.

Good luck with Graphs!

1 thought on “DOT – Graphviz

Leave a comment