Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • BackTrack 5 R2
  • Wine 1.4 / 1.5.5
  • Mozilla Firefox 12...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.4 LTS
  • Linux Kernel 3.4
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.4
  • Home > Linux > Programming > Perl Modules

    Tree::Visualize 0.01

    Download button

    No screenshots available
    Downloads: 223  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Stevan Little | More programs
    Perl Artistic License / FREE
    March 7th, 2007, 22:05 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Tree::Visualize description

    A Perl module for visualizing Tree structures.

    Tree::Visualize is a Perl module for visualizing Tree structures.

    SYNOPSIS

    use Tree::Visualize;
    use Tree::Binary;

    my $tree = Tree::Binary->new("*")
    ->setLeft(
    Tree::Binary->new("+")
    ->setLeft(Tree::Binary->new("2"))
    ->setRight(Tree::Binary->new("2"))
    )
    ->setRight(
    Tree::Binary->new("+")
    ->setLeft(Tree::Binary->new("4"))
    ->setRight(Tree::Binary->new("5"))
    );

    my $visualize = Tree::Visualize->new($tree, 'ASCII', 'TopDown');
    print $visualize->draw();

    # +---+
    # +--------| * |-------+
    # | +---+ |
    # +---+ +---+
    # +--| + |--+ +--| + |--+
    # | +---+ | | +---+ |
    # +---+ +---+ +---+ +---+
    # | 2 | | 2 | | 4 | | 5 |
    # +---+ +---+ +---+ +---+

    my $tree = Tree::Binary::Search->new();
    foreach my $value (7, 3, 1, 0, 2, 5, 4, 6, 11, 9, 10, 8, 13, 12, 14) {
    $tree->insert($value => $value);
    }

    my $visualize = Tree::Visualize->new($tree, 'ASCII', 'Diagonal');
    print $visualize->draw();

    # (7)-------------(11)-----(13)-(14)
    # | | |
    # | | (12)
    # | |
    # | (9)-(10)
    # | |
    # | (8)
    # |
    # (3)-----(5)-(6)
    # | |
    # | (4)
    # |
    # (1)-(2)
    # |
    # (0)

    my $tree = Tree::Simple->new("test")
    ->addChildren(
    Tree::Simple->new("test-1")
    ->addChildren(
    Tree::Simple->new("test-1-1")
    ),
    Tree::Simple->new("test-2"),
    Tree::Simple->new("test-3")
    );

    my $visualize = Tree::Visualize->new($tree, 'ASCII', 'TopDown');
    print $visualize->draw();

    # |
    # +------+
    # | test |
    # +------+
    # ____________|_____________
    # | | |
    # +--------+ +--------+ +--------+
    # | test-1 | | test-2 | | test-3 |
    # +--------+ +--------+ +--------+
    # |
    # |
    # +----------+
    # | test-1-1 |
    # +----------+


    NOTE: This is very early release alpha software
    The goal of this module is to provide a means of easily visualizing trees in a number of output formats and layouts. Currently only ASCII output and a limited number of formats are supported. There is some support for output as GraphViz dot files, but that is buggy at best right now.

    As I said, this is alpha software, and so please don't expect it to do all that much. Many of the classes inside are not even implemented, and few if any are documented. I am releasing this to CPAN largely as a means of self-motivation, although I can make no promises about the speed of my progress.


    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    visualize structures | tree structures | Perl module | Tree | visualize | tree



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM