Getting Started Working with DOT files in GraphViz

ObjGraph, which is used for graphing objects in Python to find memory leaks (among other things) utilizes GraphViz, and in my case, on OS X 10.6.8, the graphic files were not being generated (as of this writing they’re still not), so got into calling GraphViz directly in the troubleshooting process.

Once GraphViz is installed in your system (is have it installed in a Virtual Environment, and I think I had installed it using homebrew (brew install graphviz)), check out this awesome tutorial and/or make a file (potentially using the vim editor, but bash would be another option) with a .dot extension like this:

graph1.dot


graph { a -- b; b -- c; a -- c; d -- c; e -- c; e -- a; }

Then in the command line call it with:

dot -Tpng graph1.dot > output.png

It should create a .png file within the same directory that looks like:

GraphViz Outpt File
GraphViz Outpt File

There’s also a PDF version of the GraphViz “Dot Guide”.

Now – Off to StackOverflow to look for an answer as to why ObjGraph isn’t doing this…

Solved it – actually GraphViz was installed on the system, but NOT in the virtualEnv.

Use command-line ‘pip freeze’ to check which modules/packages are installed.

Enjoy.