![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, In the literature for nested sets, a commonly described operation is: given a node, find the path from the root to this node. I wish to find the most efficient way to do the inverse operation -- given a path, find the node. Is there a more efficient way of doing this than the naive approach of walking the path oneself (i.e. multiple queries to the database)? |
#3
| |||
| |||
|
|
Hi, In the literature for nested sets, a commonly described operation is: given a node, find the path from the root to this node. I wish to find the most efficient way to do the inverse operation -- given a path, find the node. Is there a more efficient way of doing this than the naive approach of walking the path oneself (i.e. multiple queries to the database)? Thanks, Hamish |
#4
| |||
| |||
|
|
"Hamish" <ham... (AT) gmail (DOT) com> wrote in message news:5da3650c-69b7-437d-8879-8f9632a79be8 (AT) l1g2000yqk (DOT) googlegroups.com... Hi, In the literature for nested sets, a commonly described operation is: given a node, find the path from the root to this node. I wish to find the most efficient way to do the inverse operation -- given a path, find the node. Is there a more efficient way of doing this than the naive approach of walking the path oneself (i.e. multiple queries to the database)? Thanks, Hamish If you build your nested sets in the traditional way, the criterion "where rgt = lft +1" will select leaf nodes, and only leaf nodes. If the path you have been given is a set of nodes with only one leaf, *this criterion will select it. |
![]() |
| Thread Tools | |
| Display Modes | |
| |