There are a number of ways of storing a hierarchy in SQL, then
accessing that tree, displaying it, etc., with PHP or Cold Fusion.
I'm currently using the easy method, store a parent ID, and iterate
through with a recursive function. Simply put, this doesn't scale.
Too much stuff in memory, too many database accesses.
I'm considering a preorder traversal as being better - more complex -
less database accesses. Since the bottleneck is usually the
database, I like the idea of the pre-order.
However: is there a more advanced algorithm out there? (I'm a CS grad
so I can handle your best shot). Graph theory too complex?
Ideally just provide the names of algorithms, a summary, with a few
pros and cons..
Bonus points if it scales to handle simultaneous hierarchies intersecting.
I am not interested in XSLT or XML related technologies, I am using SQL |