in reply to Re: out of order tree generation
in thread out of order tree generation

the chart i'm trying to make should look like:
Professor v-----------v------------v---------v Cubert Hermes Zoidberg Amy v----------v Dwight Leela v--------------v Fry Bender
so as you can see, top down. To do the find, would i use the map function or is there something better?

Replies are listed 'Best First'.
Re^3: out of order tree generation
by LanX (Saint) on Apr 03, 2019 at 21:46 UTC
    Personally I'd build a Hash of Arrays %children , by looping with while(my ($id, $att) = each %second_level) and pushing into $children{$boss_id}

    No code sorry this looks too much like homework, but actually you have enough now anyway ...;)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      thanks! This is actually a passion project -- i need to track upgrades to units in a game.
        Good luck! =)

        As a side note, efficiently printing the tree is far more challenging.

        I'd probably try a recursive approach where you first calculate all subtrees and their width to be able to design the actual tree.

        But this wouldn't be as space efficient as your handmade diagram.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice