On Fri, Dec 30, 2011 at 9:13 AM, Ville M. Vainio <[email protected]> wrote:
> On Fri, Dec 30, 2011 at 3:25 PM, Seth Johnson <[email protected]> 
> wrote:
>
>> One can use two indexes instead of having an edges entity:
>>
>> To find all children of node N, seek N in an index on the parent key
>> field.  Skip through until it doesn't match.
>
> This doesn't work if N is cloned somewhere, i.e. N has several parents.

Node key - Parent key
A  -  N
B  -  N
C  -  N
D  -  X
E  -  X
N  -  D
N  -  E

 X  - D  - N  - A
                 \ B
                 \ C
    \ E  - N  - A
                 \ B
                 \ C

To find all children of node N, seek N in an index on the parent key
field.  Skip through until it doesn't match.

Node key - Parent key
A  -  N
B  -  N
C  -  N


To find all parents of node N, seek N in an index on the node key
field.  Skip through (reading the parent key field) until it doesn't
match.

Node key - Parent key
N  -  D
N  -  E


Seems to work . . .


Seth

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to