I created some nodes by a Node-class and added them to a tree using Treelib.
class Node(object):
def __init__(self, id, label, parent, type):
self.id = id
self.label = label
self.parent = parent
self.type = type
node = Node(id, label, parent, type)
if id == 'root':
tree.create_node(tag=id, identifier=id, data=node)
else:
tree.create_node(tag=id, identifier=id, parent=parent, data=node)
By calling tree.show() I got a great overview of the tree. Now I want to iterate through the tree and get the data of each node defined earlier. (not only a single property by tree.show(data_property=""))
Do you got any ideas of how to work with the defined data?
My final goal is to calculate the tree structure like a decision tree and I dont find a good way using Treelib so far.