tomazos has asked for the wisdom of the Perl Monks concerning the following question:

I have a tree represented recursively as follows: each node of the tree is a %hash with keys that are named subtrees and one special keyvalue, the $hash{COUNT}, that holds an integer.

The COUNT at each node is greater than the sum of its children's COUNT.

I want to render a graphical block diagram such that each node is represented by a solid rectangle of random color with an area proportional to COUNT, and each child node is rendered within the solid rectangle of its parent, and not overlapping its siblings. (Because of the constraint that the parent's COUNT is greater than its children you can see this is possible)

Which CPAN module(s) would you recommend to do this? Is there a suitable visualization-specific module you would recommend? Or should I use a general drawing module?

Andrew Tomazos  |  |
  • Comment on Rendering visualization of tree to block diagram

Replies are listed 'Best First'.
Re: Rendering visualization of tree to block diagram
by pemungkah (Priest) on Jan 26, 2010 at 22:04 UTC
    You're looking for a treemap. Gtk3::Ex::TreeMap is one alternative on CPAN. You might also want to look at this page for a bunch of alternatives, some good, some not as.
Re: Rendering visualization of tree to block diagram
by scorpio17 (Canon) on Jan 27, 2010 at 14:41 UTC