caesar0301 / treelib

An efficient implementation of tree data structure in python 2/3.
http://treelib.readthedocs.io/en/latest/
Other
801 stars 185 forks source link

Nodes tree-wise bpointer/fpointers #126

Closed leonardbinet closed 4 years ago

leonardbinet commented 4 years ago

I encountered the following conditions:

The only solution I had was to create for each subtree a deepcopy, but it was very greedy and expensive in terms of memory.

This pull-request implements the ability to generate shallow copies of trees (no deep-copy of nodes), and mutate multiple shallow copies of the same tree without impacting other trees hierarchies.

I do so by assigning Nodes not a single _bpointer _fpointer, but one per shallow copy of tree.

caesar0301 commented 4 years ago

Linked issue https://github.com/caesar0301/treelib/issues/127