Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Recommended modules for Parent-Child trees?

by tilly (Archbishop)
on May 17, 2004 at 20:06 UTC ( #354090=note: print w/replies, xml ) Need Help??


in reply to Recommended modules for Parent-Child trees?

If you wish the nodes to be stored in a database, then I'd suggest reading (and understanding) Nested Set Trees. In the common case of insert occasionally, query often, they are far more efficient than the usual adjacency model that people think of.

Unfortunately I don't know of a module that automates generating them in Perl, and I'm not entirely sure what such a module should look like. (Which may be why I don't know of one...) So you'd have to do some reinvention, but at least you'd reinvent a good version.

  • Comment on Re: Recommended modules for Parent-Child trees?

Replies are listed 'Best First'.
Re: Re: Recommended modules for Parent-Child trees?
by Hero Zzyzzx (Curate) on May 18, 2004 at 03:37 UTC

    Got it. Nested set trees are very, very cool. Wow! Thanks for that. The efficiency with which you could select siblings/parents/ancestors and subtrees is crazy, recursive queries always bugged me (I've implemented parent-child relationships before).

    It's a bit hard to wrap my head around how to get it into code, but I can probably come up with something given the SQL in the article.

    I need to figure out now if speed of execution outweighs speed of development, and figure out where I'm going to spend my time.

    -Any sufficiently advanced technology is
    indistinguishable from doubletalk.

    My Biz

        Jeez. 1996 that thing was written. Almost makes me wish I had a computer science degree. Besides complexity (like that's something to put aside) a nested set tree model really seems the way to go in my case.

        I fear my hubris is getting the best of me, but I think I'm going to be writing a new DBI-backed module. . .

        -Any sufficiently advanced technology is
        indistinguishable from doubletalk.

        My Biz

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2021-05-10 23:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (109 votes). Check out past polls.

    Notices?