Re: Nested set model with large gaps and spreads in the numbering

From: --CELKO-- <71062.1056_at_compuserve.com>
Date: 4 Oct 2002 12:51:04 -0700
Message-ID: <c0d87ec0.0210041151.6cfc30d8_at_posting.google.com>


>> Writing a book AND moving! You're a glutton for punishment. :-) <<

This was not quite my plan, but life is what happens while you are working on your dreams.

>> Looking over the many posts in this forum concerning the nested set model, I can't help but wonder if one could define the sets equally well by replacing the "left" and "right" columns with "node_id" and "num_descendants" columns. <<

Actually I have a suggestion somewhat like that. use the pre-order traversal number and the rightmost son.

OrgChart
emp trv_nbr rgt_most



'Albert' 1 6
'Bert' 2 2
'Chuck' 3 6
'Donna' 4 4
'Eddie' 5 5
'Fred' 6 6

The organizational chart would look like this as a directed graph:

            Albert (1,6)
            /        \
          /            \
    Bert (2,2)    Chuck (3,6)
                   /    |   \
                 /      |     \
               /        |       \
             /          |         \
        Donna (4,4)  Eddie (5,5)  Fred (6,6)

Remember a shorthand in PL/I where you coudl replace a string of END keywords with a single "END <block name>" construct? Same idea. Received on Fri Oct 04 2002 - 21:51:04 CEST

Original text of this message