Home > clojure > Dorothy: Graphviz from the comfort of Clojure

Dorothy: Graphviz from the comfort of Clojure

August 12th, 2011

I’ve used Graphviz quite a bit in the past. When I did, I was almost always generating dot files from code; I never wrote them by hand other than to experiment with various Graphviz features. Well, string-slinging is a pain. Generating one language from another is a pain. So, inspired by Hiccup, I threw together Dorothy over the last couple evenings. It’s a Clojure DSL for generating DOT graph representations as well as rendering them to images.

For a few hours work, the documentation is pretty thorough, so I’ll leave off with one simple example which is translated from the Entity Relationship example in the Graphviz gallery. Any feedback or criticism is welcome and encouraged.

and here it is displayed in Dorothy’s simple built-in viewer:

Entity Relationship graph

clojure ,

  1. PA
    August 15th, 2011 at 05:15 | #1

    If you are interested in graph visualization in Clojure be sure to check the Lacij library: https://github.com/pallix/lacij

  2. August 15th, 2011 at 09:48 | #2

    @PA
    Thanks. I’m aware of Lacij. I haven’t used it, but it looks impressive. I think initially targeting Graphviz makes sense since it’s kind of the de facto graph layout tool that most people use. That said, the dependency on a graphviz installation is kind of a drag so maybe I’ll try adding Lacij as a second output target. It should be a good exercise.

    There’s also Loom (https://github.com/jkk/loom) which I think has different overall goals, but is interesting nonetheless.

    Cheers,
    Dave

  1. August 14th, 2011 at 19:10 | #1