| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Hierachical structures - an overview
"Mike MacSween" <mike.macsween.nospam_at_btinternet.com> wrote in message news:<3ff84593$0$52882$5a6aecb4_at_news.aaisp.net.uk>...
> "Lennart Jonsson" <lennart_at_kommunicera.umea.se> wrote in message
>
> > > 1a. Adjacency list + as per:
> > > http://fungus.teststation.com/~jon/treehandling/TreeHandling.htm
> > > Not sure about this. It claims to give the path upwards. It looks like
> it
> > > merely gives the ancestors, which isn't the same thing.
>
> Thanks you for putting me onto that in the first place
>
> > In what way does this differ? Are you meaning that the set of
> > ancestors is unordered, compared to the path?
>
> I think so
Guess it all comes down to how path is defined. In the doc it is defined as a union -> a set -> unorderd
>
> > In that case the path is
> > easy to create from the ancestor set.
>
> No doubt. I'll have a go (unless you can do it off the top of your head).
>
Just count the number of ancestors for each ancestor in the path. I.e something like:
select
p.ancestor_id,
(select count(1) from path where id = p.ancestor_id) as depth
from
path p
where
id = ?
order by depth
[...]
HTH
/Lennart
Received on Sun Jan 04 2004 - 22:06:44 CST
![]() |
![]() |