开发者

Hierarchical data - Parent id or Nested set model

开发者 https://www.devze.com 2023-04-10 08:27 出处:网络
I\'m working on a project that required categories, I used a neste开发者_高级运维d set model and it worked out well.I have another portion of the same project, however it requires a different type of

I'm working on a project that required categories, I used a neste开发者_高级运维d 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号