caesar0301 / treelib

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

New Tree.children_itr method #118

Open cowo78 opened 5 years ago

cowo78 commented 5 years ago

In case creating a list like Tree.children() does is too heavy for efficiency reasons.

caesar0301 commented 4 years ago

It seems as duplicated as method children which could convert into an iterator via iter(childrenI())

cowo78 commented 4 years ago

Not really. Doing an iter(children()) would first create a list then iterate over it while children_itr() would just create the iterator. In the first case memory usage is O(N), in the second is O(1).