What are the ways that you use to model and retrieve hierarchical info in a database?
I like the Modified Preorder Tree Traversal Algorithm. This technique makes it very easy to query the tree.
But here is a list of links about the topic which I copied from the Zend Framework (PHP) contributors webpage (posted there by Posted by Laurent Melmoux at Jun 05, 2007 15:52).
Many of the links are language agnostic:
There is 2 main representations and algorithms to represent hierarchical structures with databases :
It's well explained here:
Here are some more links that I've collected:
adjacency list model
nested set
Graphes
Classes :
Nested Sets DB Tree Adodb
Visitation Model ADOdb
PEAR::DB_NestedSet
PEAR::Tree
nstrees