Getting a control flow graph of import with Graphviz

I have wanted to do a graph that documents how import works at a reasonable level of granularity for a while. Last night I once again tried to find a free diagram tool for OS X but failed. Omnigraffle is extremely nice, but I don't want to have to pay for it, even at the student rate of $48.

So I settled on Graphviz. I knew of the tool before, but I didn't want to have to write the graph in a text notation; I wanted a WYSIWYG solution. But since I couldn't find something to fit my needs, I bit the bullet.

Turns out not to be so bad. The real trick is to manage your DOT file well. It can get unruly if you don't come up with your own way to keep track of where you declare your nodes and edges. After that discovering the the width attribute to make the nodes fit around their labels helped to make it much more readable.

The last trick was how to display the resulting graph easily as I iteratively created it. I was using Camino to display the SVG version as Graphviz keeps complaining it can't find various fonts and thus displays the text poorly and the PS version takes too long to open in Preview. But once the graph gained any level of complexity text labels disappeared and only reappeared when scrolled around (had the same issue under Firefox 2). Luckily Inkscape can display the SVG fine and doesn't take forever to do so.