Graphs, Haskell,

A crazy idea about graph visualisation

I’m currently at, and this morning I went to a talk by Adam Harvey entitled Visualising Scientific Data with HTML5.

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).

So, how crazy am I?


8 thoughts on “A crazy idea about graph visualisation

    • Ivan Miljenovic says:

      OK, so the next question is: should I have intermediary datatypes or go directly between the DotRepr types and JSON?

  1. After hearing about JIT infovis, I was wondering about a haskell tool/library to convert graphs to json too for infovis as an alternative to svg rendering.

    • Ivan Miljenovic says:

      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!

  2. gb says:

    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 🙂

    • Ivan Miljenovic says:

      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…

  3. Bernd says:

    Hi Ivan,

    are there any news about this “converter”?
    I would be highly interested, as I am currently using graphViz but am not totally satisfied with its output. :-/


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s