Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Unanswered: Nested set Model


    I am trying to implement Joe Celko's Nested set model to create a treemenu. I read the article at, and I am trying to delete a single node (have't yet tried to delete a subtree). I use the procedure from the article, and it seems to fill in the gap ok, but the problem is that the ancestors are not updated. I think I read in a post somewhere at the forum, by Mr. Celko, that the ancestors need not be updated, but he also states in the article that the root node's right is always n*2. Do I have to update the ancestors, or can I leave them alone? Does anyone have some cut & paste code they can provide to help me out?

    Thanks in advance.


  2. #2
    Join Date
    Jun 2003
    Provided Answers: 1
    Celko's description of the nested set model looks pretty cool, and is probably more efficient than the adjacency model in many cases, but unless you are dealing with absolutely gigantic tables the adjacency method is more than satisfactory for storing tree structures. It is certainly easier to visualize, which means it is easier to code for and easier to debug, and these advantages cannot be lightly dismissed.

    I have personally never seen the nested set model implemented.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts