Graphviz is amazing, I've never found a better or easier to use tool for generating graphs and data visualisation. The dot language is very easy to learn and the documentation is very good indeed. If you are doing any form of visualisation its worth taking a look at.
In the past I've used it for visualising compiler ASTs and data structures. (Which reminds me Jim Idle posted a nice ANTLR to dot conversion sample).
At the moment I'm working on a couple of data structures. Visualising them while developing the structures helps a great deal with spotting obvious errors and checking that things look as expected (yes I have unit tests too :). However it was a little inconvenient to have to keep writing the dot out to disk and generating the images manually.
Luckily Visual Studio supports visualisers and they are easy to write too. So I've just created a dot visualiser. My classes now have a ToDot() method which return a string. Whenever I want to visualise them I simply add a watch and select the dot visualiser. It could not be easier.
Download
VS 2008 Source code
VS 2008 Binaries
Installing the binaries
- Copy the binaries to your visualisers directory (%USERPROFILE%\Documents\Visual Studio 2008\Visualizers)
- Edit the config file and set the path to dot.exe
Disclaimer
I’ve not made much effort to make this visualiser robust. It helps me during debugging, that’s all.
Update: Thanks Riaan for spotting an horribly embarrassing bug in the code :).
There is a certain air of Miguel about your post. But I like it.
ReplyDelete