Re: Nested sort, trying again
From: -CELKO- <jcelko212_at_earthlink.net>
Date: 8 Oct 2005 16:24:20 -0700
Message-ID: <1128813860.926512.275700_at_g14g2000cwa.googlegroups.com>
Date: 8 Oct 2005 16:24:20 -0700
Message-ID: <1128813860.926512.275700_at_g14g2000cwa.googlegroups.com>
Well, you have code to move subtrees around in TREES & HIERARCHIES, so you can sort the tree structure after a change. A node (lft,rgt) pair (x,y) has a level that is easy to compute so you can see all the children of a common parent; this gives an ugly view with all the nodes at that same level in the hieratchy. The brother to the right is (r, y+1) and the brother to the right is (x-1, s) , or they do not exist.
But being lazy, I would convert the nested sets to an adjacency list, then use the stack algorithm to rebuild the tree in sorted order. Slower, but easier to code. Received on Sun Oct 09 2005 - 01:24:20 CEST
