A crazy idea about graph visualisation

Now, one of the packages I maintain is graphviz which suffices at what it does: use Graphviz to visualise graphs using static images. Despite its various problems, I keep using Graphviz because – unlike most of the flashier graph visualisation programs that I’ve found – it doesn’t require a fancy GUI just to convert a pre-existing graph into an image (admittedly, others may have library versions, but most seem to be written in Java and Python, which do not seem as useful in terms of writing Haskell bindings). However, one thing that Graphviz cannot do is let you dynamically visualise graphs, which is especially useful for extremely large graphs (e.g. call graphs).

One of the visualisation toolkits that Adam talked about was the JavaScript InfoVis Toolkit, which seemed quite nice in how you can dynamically interact with the graphs. The graphs are represented using JSON, and the format looks relatively straightforward.

So here’s my possibly crazy idea: does it make sense to create a companion library for graphviz to convert its DotRepr values into JIT-compatible JSON, possibly with some extensions to assist with the visualisation? We already have various libraries for interacting with JavaScript and JSON on HackageDB, so it may be possible to abstract most of the pain of visualising and interacting with graphs on the web into our preferred language. I’m not quite sure how to deal with incompatible/differing attribute values for Dot vs JIT’s JSON, but is this type of avenue worth considering? Such a conversion library would save having to doubly-convert graphs (in case you want static image versions of the visualisations as well).

Well, I’ve mentally started working out how to do this. The biggest barrier at the moment is that I’m currently in the middle of porting graphviz from String to Text, and so I can’t really start playing with it until that’s done. But from some experimentation I’ve done it seems dot, neato, etc. ignore any extra Attributes you might want to add to the DotRepr values for JIT attributes that don’t have corresponding Dot ones!

InfoVis is really awesome. I’ve been meaning to find some time/excuse to play with it. Some tool support from Haskell would be pretty nifty. I’d start by thinking about what you’d want to generate InfoVis input from Haskell in general, and then figure out how to tie the DotRepr stuff in as a client to that API. That way, whatever you produce will have more general value as well. If you’re going to be producing javascript and not just json, then I’d also consider taking a look at my pet project, JMacro :-)

Well, I’m only planning on supporting the graph outputs of JIT, not all of them (since that’s all I care about) ;-)

I’m not sure how far to take it: should it ust be Dot JSON, or help generate the actual JavaScript for it as well? If the latter, it might even be feasible to use the webkit bindings to open a window to instantly play with a graph…

Welcome!

Greetings and salutations be upon thee to my little corner of what we like to charmingly call "the internet". This is where I put forth cunning arguments and repartee on such topics as Haskell, Gentoo, university... just don't ask me if I have a social life :s