java - Do I need to set childrenID when setting parentID and ID in the database?
PHP中文网2017-05-27 17:41:52
0
2
682
I want to traverse a tree recursively, but I feel that using parentID and ID cannot determine whether there are child nodes and cannot traverse it. I don’t know if I need to add a childrenID field
If you only represent a tree, a single table of parentID and ID is enough; it is called: adjacency list.
Then add a treepath. Record the path from each node to the root node