Re: Best SQL hierarchical model for large/heavily updated graphs?

From: -CELKO- <jcelko212_at_earthlink.net>
Date: 7 Feb 2006 07:21:37 -0800
Message-ID: <1139325697.740289.239210_at_z14g2000cwz.googlegroups.com>


>> One of the fundamental floors of this technique is that if you want to link a particular branch into another part of the tree, you have to replicate the whole branch's materialized paths to the new position in the tree, <<

But that is the nature of a tree. The question is: do want a copy of the subtree or do you want to link to the same subtree? I have code for making a copy of a subtree under a second parent in TREES & HIERARCHIES IN SQL. It is not bad and you just have to remember to check for cycles.

If youy wan to do a link, then you need a forest table with multiple trees so you can reference the same subtree in multiple places as lead nodes within the parent tree. A little ugly, but do-able, if you don't go too deep with it.

In nested sets or intervals, you separate the nodes from the edges. You can modify this to allow a leaf node to reference a subtree Received on Tue Feb 07 2006 - 16:21:37 CET

Original text of this message