Closed jinwuxia closed 7 years ago
The Tree stores the nodes in a dictionary, which does not preserve the order. On tree output the child nodes are sorted by their id. http://anytree.readthedocs.io/ might implement what you are looking for.
Still based on your treelib, I use an increased tag to represent the node id, and it works. Thanks for your advice.
hi,
Your program works very well. But I have another related problem to ask for you.
I create a tree. The script is the following:
tree = Tree()
tree.create_node("HH", "hh")
tree.create_node("JJ", "jj", parent='hh')
tree.create_node("AA", "aa", parent='hh')
tree.show()
The tree will show like this:HH
--- AA
--- JJ
But, Node JJ should be created before AA, as the code expects. I expect that the tree branching order is consistent with the order that the node is created.
The expected result is:
HH
--- JJ
--- AA
Then, how could I achieve that? Do your program provide this function?
Thanks a lot for your help.