HumanContent
asked on
hierarchical tree
Hi experts,
I have to build a hierarchical tree and am uncertain wich method is the best. I have 2 methods to choose from:
1: Flat Table Model - with a parent Id, rank and indent level
For more info: http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/4047/index.html
2: Modified Preorder Tree Traversal -- with a left and right number
For more info: http://www.sitepoint.com/article/hierarchical-data-database/2
Does anyone know what the advantages / disadvantages are of these methods?
I have to build a hierarchical tree and am uncertain wich method is the best. I have 2 methods to choose from:
1: Flat Table Model - with a parent Id, rank and indent level
For more info: http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/4047/index.html
2: Modified Preorder Tree Traversal -- with a left and right number
For more info: http://www.sitepoint.com/article/hierarchical-data-database/2
Does anyone know what the advantages / disadvantages are of these methods?
I second that emotion. Here's some of my own code that seems to work pretty well:
https://www.experts-exchange.com/questions/21338262/Recursive-Category-List-with-ability-to-expand-and-retract.html
https://www.experts-exchange.com/questions/21338262/Recursive-Category-List-with-ability-to-expand-and-retract.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great anthony, thanks for the answer, this was excactly what i was looking for. Think i'll go for the pre-ordered model, because of the possibility of Traverse from child back through ancestors to the final root.
I would have to say both methods have their strong points and therefor it depends on personal preference which method is 'best'.
You could get several different answers to this questions and all of them would be accurate.
Regards,
Max.