in reply to out of order tree generation
Slightly OT.
I once did an actual org chart using graphviz (dot). I found a spreadsheet with employees and their managers. I let dot do all the work. The hardest bit was fixing up folks who didn't have a boss (contractors and consultants reported to an administrative entity on paper).
But if the data is clean and consistent...
I think there's a Perl module to interact with graphviz too.
-QM
--
Quantum Mechanics: The dreams stuff is made of
In Section
Seekers of Perl Wisdom