caesar0301/treelib

how to replace a node with a new tree

k3vinlusec opened this issue · 2 comments

Hi,

treelib doesn't provide an API like replace(node, new) to implement replacing a node with a new tree.
Does anyone know how to implement this functionality with the present API?

Thanks!

You should be able do this in two lines:

tree.remove_node(id_of_node_to_remove)
tree.paste(new_tree)

If that doesn't work, please comment with a full, but concise working example.

Gonna close this for now, but lmk if you have any more questions