Hierarchy Management
- Posted by euphoric (admin) Oct 11, 2008
- 914 views
I'm building a program to help manage a large company's hierarchical organizational chart. What is the most efficient way to store hierarchy information as well as "manage" it? For instance, some functions would be "Who is the boss?" "Who are the underlings?" "Who is at the bottom of a branch?" etc.
I'm thinking of storing the data in a database with at least
unique_id ... boss_id
In order to build the organization chart, I would start with the President. I would look for records that have him as boss_id. I would work down from there. But is there a more efficient solution? I'm considering an index, but how would I store that index so it is better than just searching the records for boss_ids?
Any ideas would be appreciated.
Here's a sample possible hierarchy:
Pres / | \ VP1 VP2 VP2 (Vice Presidents) / | | | | \ M1 M2 M3 M4 M5 M6 (managers)
Under managers would be secretaries, sales managers, etc., then sales personnel, etc.