I have a tree over which I'd like to print the path between two nodes. I could not find a function that does the magic, but I believe the closest is expand_tree(). However, upon calling it and trying to print the nodes, I get an error:
path = tree.expand_tree(tree.get_node(4), filter=tree.get_node(83), sorting=False)
for node in path:
print(node)
Traceback (most recent call last):
File "E:\question.py", line 55, in <module>
for node in path:
File "E:\Anaconda3\envs\3dreconst\lib\site-packages\treelib\tree.py", line 427, in expand_tree
raise NodeIDAbsentError("Node '%s' is not in the tree" % nid)
treelib.exceptions.NodeIDAbsentError: Node 'Node(tag=4, identifier=4, data=None)' is not in the tree
I have a tree over which I'd like to print the path between two nodes. I could not find a function that does the magic, but I believe the closest is
expand_tree()
. However, upon calling it and trying to print the nodes, I get an error:What am I doing wrong?