Josh Berkus schrieb:
> Adjacency list trees are easier to understand conceptually, there are more
> tools on freshmeat.net for them, and they are the most efficient form of tree
> for graphical display.
Hi,
for graphical display it may be (the application to display could do the
work), but displaying data in tables (or tabulars, if you prefer
LaTeX-Syntax) leeds to recursion, I'd say.
> Nested Set trees are hard to wrap your mind around,
Yes ;-)
> lack a lot in the way of code samples on freshmeat, are harder to
> build GUI tools for, but are much, much faster for determining
> branch membership and branch parenthood.
While wrapping around my mind to understand Nested Sets, I got an idea
to speed up the count of subnodes and leaves (expensive if only "lft"
and "rgt" are used) by adding a third field called "lvl".
See
http://www.net-one.de/~ks/WOoK/postmaster.php http://www.net-one.de/~ks/WOoK/nset.sql.txt
I wrote something about it here some months ago, got a few PMs with
positive reactions (so I'm writing this) and a correction. Due to time
lack, the 'documents' linked above are still draft, ugly written and
the examples may work or not, sorry.
The idea of "lvl" maybe useless or not? I'm not an expert.
> So which model you use depends on what you intend to do with the tree.
And try to understand Oleg's contrib/ltree. It may be better.
Greetings,
Knut Sübert