Re: node integrity when copying subtree in nested sets




bernie wrote:
howdy,

Nested sets (or modified preorder tree transversal algorithm) work great
if a specific node only exists once inside the tree. I am using my tree
for user authentication. For example, a group may have users and other
groups in them. If the root groupA has groupB and groupC in it, and
groupB contains groupC then groupC exists twice in the tree. Now, my
issue is when I remove a subnode from groupC I need to remove that
subnode from every instance of groupC in the root tree. This can become
a nightmare of recursive functions (my reason for going with nested sets
was to avoid recursive functions).

Sorry, but I do not quite see the problem.
as a tree structure isn't it equivalent to this image?

groupA
+- groupB
+- groupC

In words: groupA is the parent of groupB which is the parent of groupC
Why would groupC exist twice?

Ed

.



Relevant Pages

  • node integrity when copying subtree in nested sets
    ... Nested sets (or modified preorder tree transversal algorithm) work great if a specific node only exists once inside the tree. ... If the root groupA has groupB and groupC in it, and groupB contains groupC then groupC exists twice in the tree. ... In Joe Celko's book "Joe Celko's Trees and Hierarchies in SQL for Smarties" he gives an example of copying a subtree inside a nested set and naming it "subtree2" or somesuch. ...
    (comp.databases)
  • Re: node integrity when copying subtree in nested sets
    ... groupA is the parent of groupB which is the parent of groupC ... when I add a fourth group into groupC it would need to be added twice into this tree. ...
    (comp.databases)
  • Re: Employees Hierarchy
    ... > There are many ways to represent a tree or hierarchy in SQL. ... > called an adjacency list model and it looks like this: ... > Another way of representing trees is to show them as nested sets. ...
    (microsoft.public.sqlserver.programming)
  • Re: vehicle to autoparts relationships
    ... Another approach to a tree structure is modeling it as nested sets ... Figure 5.2a: A tree. ... How does nested sets handle the part that is a part of multiple assemblies? ...
    (comp.databases.theory)
  • Re: Sorting Problem
    ... > point to each other and sort them with some sort of algorithm. ... The data structure looks like a tree. ... One of them will be about nested sets. ...
    (comp.lang.php)