use Graph::Easy;

brian_d_foy on 2007-08-27T05:42:00

And the cool module of the day is Graph::Easy (live demo) by Tels++.

It's kinda like GraphViz, but it also supports various text-mode output formats.

That's very cool if you want to render a graph of, let's say an inheritance hierarchy in, let's say Emacs. Which I do.

Widen your browser window and take a look at this fairly complicated graph that it managed to deal with (ancestors of the class CatalystX::FeedMe::View::Atom (found at the bottom)).

     .................................
     :        Class::Accessor        :
     :...............................:
       ^
       |
       |
     .................................
  +> :     Class::Accessor::Fast     : <-----+
  |  :...............................:       |
  |    ^                                     |
  |    |                                     |
  |    |                                     |
  |  .................................       |
  |  :    Catalyst::AttrContainer    : ------+---------------------------+
  |  :...............................:       |                           |
  |    ^                                     |                           |
  |    |                                     |                           |
  |    |                                     |                           v
  |  .................................     .......................     ............................
  +- :        Catalyst::Base         : --> : Catalyst::Component : --> : Class::Data::Inheritable :
     :...............................:     :.....................:     :..........................:
       ^
       |
       |
     .................................
     :   Catalyst::View::Atom::XML   :
     :...............................:
       ^
       |
       |
     .................................
     : CatalystX::FeedMe::View::Atom :
     :...............................:


It can even handle groups of nodes (with bounding boxes) and things I thought would be really weird in text-only.

The graph that I display in Emacs is actually quite a bit more compact than the output above. I munged the text a bit to make it fit in the Message window (all upwards arrows are removed since that's the most common inheritance relationship).

     [ Class::Accessor               ]
  +> [ Class::Accessor::Fast         ] <-----+
  |  [ Catalyst::AttrContainer       ] ------+---------------------------+
  |    |                                     |                           v
  +- [ Catalyst::Base                ] --> [ Catalyst::Component ] --> [ Class::Data::Inheritable ]
     [ Catalyst::View::Atom::XML     ]
     [ CatalystX::FeedMe::View::Atom ]


Hopefully that's about the most complicated structure I'll have to visualize.


Graph::Easy and related

steph on 2007-08-27T08:31:46

besides Graph::Easy and GraphViz are also the projects asymptote and GLE. GLE seems to be able to produce very complicated stuff, I haven't tried it yet but I will.

cheers --stephan