dbTalk Databases Forums  

Does a Nested Sets tree require a single root node?

comp.databases.theory comp.databases.theory


Discuss Does a Nested Sets tree require a single root node? in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Cathead
 
Posts: n/a

Default Does a Nested Sets tree require a single root node? - 08-20-2003 , 12:52 AM






It seems to me that a nested sets tree must have a single root node. Is
this true?

I am converting an Adjacency List hierarchy to Nested Sets. In a situation
where I am organizing a list of manufacturers into a tree, there is no
single root manufacturer - so I would have to create an "artificial" root
node called "All Manufacturers", correct?

Cathead



Reply With Quote
  #2  
Old   
--CELKO--
 
Posts: n/a

Default Re: Does a Nested Sets tree require a single root node? - 08-22-2003 , 04:17 PM






Quote:
It seems to me that a nested sets tree must have a single root
node. Is this true?

Yes; that is the mathemtical definition of a tree and a root node; it
would not matter how you modeled it.

Quote:
I am converting an Adjacency List hierarchy to Nested Sets. In a
situation where I am organizing a list of manufacturers into a tree,
there is no single root manufacturer - so I would have to create an
"artificial" root node called "All Manufacturers", correct? <<

That would work, or you could go with a forest -- a table of trees

CREATE TABLE Forest
(tree_nbr INTEGER NOT NULL,
node CHAR(10) NOT NULL,
lft INTEGER NOT NULL,
rgt INTEGER NOT NULL,
CHECK (...),
PRIMARY KEY (tree_nbr, lft, rgt));


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.