Getting Started with Directed graph via Graphviz

Creating simple directed graph using Graphviz

I recently found myself in need of making some directed graph so i have used graphviz library for this purpose. Graphviz is a simple graphing Library available in unix machines.

I will cut to the chase. If i want to generate a directed graph i will need following sample code in my file

digraph img {
    "A" -> "B"
    "C" -> "D"
    "D" -> "B"
    "C" -> "E"
} 

to make meaning of this graph i will do following

$ dot -Tsvg input.dot > output.svg

This would give me following svg

Note: Originally published on now defunct https://til.anantshri.info/post/graphviz/

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top