I am looking to use this concept in one of my upcoming project.
More info: Managing Hierarchical Data in MySQL.
Please share your experiences good or bad with examples.
I am adding more information to make it more broad:
I have child items that can have more than one parent (example: a user can belong to city and also a group called UserDefinedRegion), which the typical hierarchical models do not support, whether it is adjacency list or nested sets.
I am pasting the use case here for clarity:
Background: Currently the system has a fixed hierarchy in place which is State->County->City->User
Sales Manager logs in to the system and creates a new group which can by at the same level as City, or County.
Sales Manager logs in to the system and creates a new group which can be in between State and county or County and City.
Once the sales manager creates the groups, he should be able to view all the necessary reports rolled up the next day in his dashboard.
As you can see, second point can easily be accomplished by nested sets, but not the first point, which will introduce new parents nodes for the same child node.
So far the following solutions were proposed by stackOverflow users:
- Network Node structure supported by Network Database.
- Directed Acyclic graphs.
I am definitely looking for a RDBMS solution. It looks like not many have encountered multiple parent nodes in heirarchical data models in real life.