Hierarchical Data Storage
Trevor DeVore
lists at mangomultimedia.com
Mon Feb 12 13:47:38 CST 2007
On Feb 12, 2007, at 11:26 AM, Ruslan Zasukhin wrote:
>> I thought about using double values as well. Looking at how updates
>> are performed in the modified preorder tree traversal algorithm it
>> seems to me that adding child nodes can potentially invalidate data
>> in many records that aren't part of the current hierarchy. If I am
>> understanding the concept correctly, this seems like a bad thing if
>> you have lots of clients working on parts of the tree.
>>
>> Using doubles to at least isolate the tree connected to each root
>> node seems like it could solve that issue for some projects.
>
> I think should exists only one root.
>
> May be I have not think deeply yet, but it seems to me if AddNode()
> touch
> not ALL right nodes but only nearest nodes, then this improve
> concurrency.
Let's say I have a lessons and steps table in my database. A lesson
is made up of one or more steps. A step with no children means it's
content is displayed to the user, a step with children is used to
create a hierarchal lesson structure.
Lesson 1
Step 1
Step 1.1
Step 1.2
Step 1.3
Step 2
Step 2.1
Step 2.2
Lesson 2
Step 1
Step 1.1
Step 1.2
So I was picturing Leson 1.Step 1, Leson 1.Step 2, Leson 2.Step 1 as
"root" nodes and using the algorithm on the steps table. When I
modify the order or number of steps in Lesson 1 I wouldn't want to
modify relationship data in Lesson 2. That is where the thought of
using doubles came from. For steps, the number to the left of the
decimal represented the lesson and the number to the right
represented the numbers used left left/right values.
This is the first I've really thought about the modified preorder
tree traversal algorithm before and perhaps the above scenario isn't
how it would be used. Or maybe the tables would have to be designed
differently.
Make any sense?
--
Trevor DeVore
Blue Mango Learning Systems - www.bluemangolearning.com
trevor at bluemangolearning.com
More information about the Valentina
mailing list