Link to home
Start Free TrialLog in
Avatar of HumanContent
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?

Avatar of DreamMaster
DreamMaster

Personally I'd go for the first method which in my humble opinion is more clear than the other.

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.
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
ASKER CERTIFIED SOLUTION
Avatar of anthonywjones66
anthonywjones66

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HumanContent

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.