如何使用 python 中的 treelib 库在树中插入节点?

How does the insertion of nodes in a tree work using the treelib library in python?

你们好吗?
我对名为 treelib 的 python 库有疑问。我注意到,当使用 'tree.show ()' 函数时,它 returns 带有子项的树按字母顺序排序,这引发了这个库中的插入如何工作的问题。我去了他们的源代码,但是因为我从 python 开始,我不明白在树中插入节点是如何工作的......所以,使用这个库的人知道如何通知我如果在像下面这样的插入中:

tree.create ("E", 1)
tree.create ("A", 2, parent = 1)
tree.create ("B", 3, parent = 1)

E左边的儿子会是谁?右边的儿子是谁?

根据 documentation,您的树应该如下所示:

E
├── A
└── B