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

I am writing a program that uses trees. I am currently using Tree::Nary. I need a way to draw the ouput tree in html/somewebgraphserver..etc. What is the best way to do that? Are there any perl modules out there that would do that? Chebby

Replies are listed 'Best First'.
Re: tree drawings
by jmcnamara (Monsignor) on May 16, 2001 at 12:11 UTC

    You might want to look at Leon Brocard's GraphViz.pm module which is a Perl interface to the graphing tools of the GraphViz project. These tools are for generating directed and undirected graphs of which a tree can be considered a subset.

    As part of the same project, you might also be interested in webdot which if a CGI program for generating graphs. There is an example of a tree on the webdot demo page.

    Anyone else who is interested in this module should have a look at Leon's GraphViz.pm graphing tutorial which shows examples of graphing Perl data structures, XML, sub-routine cross references, code profiling, modules dependencies, op-codes and the Perl grammar!!

    You are also use this module to graph Parse::RecDescent grammars and regexes and, as if that wasn't enough, there is also GraphViz::DBI for graphing database tables and relations and GraphViz::ISA for graphing the @ISA hierarchy.


    John.
    --

Re: tree drawings
by jeroenes (Priest) on May 16, 2001 at 11:25 UTC
    Since nobody has answered this question, I will give it a try.

    Tree::Nary just is a package to store and fetch N-tree data. The printing business is left up to you totally.

    You could pick up another module: Tree::DAG_Node for example can draw the trees in ascii. Otherwise you'll have to write the drawing code yourself. Start with an ASCII tree. You can always TT it and dump it in HTML. (use CGI to create your HTML).

    Hope this helps,

    Jeroen
    "We are not alone"(FZ)