Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

(cLive ;-) Re: representing a tree graphically...

by cLive ;-) (Prior)
on Jan 10, 2002 at 01:09 UTC ( [id://137567]=note: print w/replies, xml ) Need Help??


in reply to Re: (cLive ;-) Re: representing a tree graphically...
in thread representing a tree graphically...

Re 1: Hash starts off as $page->{$id}-{'parent'}, but for readability's sake I created a second, ordered array of hashes that was the original IDs mapped to an array index showing the correct display order (ie, sorted by 'treepath'). It was just easier to visualise.

Nice code, but one thing's not as it should be (which I implied, but didn't specify *explicitly* before). I need the nodes to display in order (to allow users to build the order they want pages displayed in when menus are drawn, so they need to be sorted by 'treepath', eg:

#one + #two | \ #five | \ #boo | \ #baz \ #three + #four + #yak \ #six + #foo | \ #yuk \ #ggg
and not the re-ordered way that your code outputs the tree at the moment, if that makes sense.

But thanks for the insight. I'll have a little play with the ideas you presented.

cLive ;-)

Replies are listed 'Best First'.
Re: (cLive ;-) Re: representing a tree graphically...
by hossman (Prior) on Jan 10, 2002 at 03:02 UTC
    i just used the stock "sort" but you could easily drop in any sort method, as long as the criteria for sorting was something htat could be looked up using the node name (or a property of hte node object if you used proper objects)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://137567]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-03-28 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found