Recently I’ve come to know a fairly unique piece of software called GraphViz. Its short for Graph Visualization Software and according to the page on Wikipeida it was initialy released back in 1991. What caught my attention in particular about GraphViz is the succient way it allows you to produce elaborate graphs by scripting lines of the DOT language. You can then use a small assortment of readily made graphing tools to transform your DOT files into full images. All of this got me thinking… why did I put up with overly complex GUI tools with bells and whistles when a rather basic DOT file can accomplish the same task?
Everthing Old Is New
I admit between all of the folks talking about how “Makefiles” are the new automation tool of choice and what I dub the “text editor renaissance” which has been brought on by the likes of Sublime, Atom and Visual Studio Code as opposed to the early 2000s when IDEs were all the rage its great to see a return to fundamental tools that are programmable/quick n dirty and highly customizable. Anyhow, back to the main topic; GraphViz in addition to being able to turn lines of DOT into pretty graphs as shown in the “example” also has several language bindings.
DOT Is Easy To Pick Up
A modified version of “Cluster” http://graphviz.org/Gallery/directed/cluster.html
|
|
GraphViz Includes A C Library
I was browsing the GraphViz website in search of documentation regarding language bindings for C/C++ when I discovered that I already had the necessary libraries installed on my machine when I first downloaded brew install graphviz
.
To make things short I wanted to see if I could compile and run the simple.c
file mentioned in the official docs.
|
|
On MacOS you can compile with the following command…
|
|
With that completed we can pass a dot file as an input and get a plain
formatted output.
|
|
The output…
|
|
Thats about it for now; I’ll be investigating more later.