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

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

Replies are listed 'Best First'.
Re^4: out of order tree generation
by adambot (Acolyte) on Apr 04, 2019 at 01:04 UTC
    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