Output an image of a directed acyclic graph

813 Views Asked by At

I'd like to:

  1. Represent a DAG according to The Ruby Way.
  2. Generate an image from the DAG.

There would be no more than 100 nodes (and often far less, say, 10 for the 80th percentile case). I do not need to permanently store the data, just the image, so no database considerations need to be made.

2

There are 2 best solutions below

0
On BEST ANSWER

Graphviz is the tried-and-true tool for visualizing all sorts of graphs, and it's been around for a while. See: http://www.graphviz.org/

There's Ruby wrapper around it available, see: https://github.com/glejeune/Ruby-Graphviz

(disclaimer: I've used Graphviz, but not the Ruby wrapper)

0
On

If all you need to do is output images, I'd feed textual representations into the "dot" tool of graphviz.