With Haskell and GraphViz, it’s a cinch to publish graphs. Unfortunately, it’s not a cinch until you learn that it’s a cinch. I’m not afraid to admit that it took me three days to understand the graphviz library.
- Install Haskell, GraphViz, and the graphviz library.
- Download gnomes.hs.
- Run ./gnomes.hs > gnomes.dot
- Run dot -Tpng gnomes.dot > gnomes.png
You’ll get the following image:

The intermediate step isn’t important.
Repeat with me.hs and you’ll get another image:

An ego-centric graph.
As I said before, the hard part is learning how graphviz is a cinch. Specifying the parameters in graphToDot is tricky. Luckily, Ivan Miljenovic and Brent Yorgey were quick to offer help. Once you get the hang of specifying Attributes, you’re ready to profit!
Update: This guide forms the basis for a much more complicated graph of the Collatz Space.
Yes, maybe I should go and finish off that graphviz tutorial I started on a few months back…