简体   繁体   中英

Hierarchical data - Parent id or Nested set model

I'm working on a project that required categories, I used a nested set model and it worked out well. I have another portion of the same project, however it requires a different type of hierarchy, there will only ever be a parent. So, an item can only EVER relate to one other item.

Would you say for this, using simply parent_id would be more appropriate then a full nested set model?

Thank you!

I would say it doesn't matter. I think of nested set and adjacent tree model as different data structure but the same type of hierarchical tree. I think of a ternary trie and a patricia trie. Both have a different data structure but the type trie is the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM