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

Limit contains method to a set depth #171

Open golharam opened 3 years ago

golharam commented 3 years ago

Right now, I see .contains() on the tree will search the tree for a given node. Suppose I only want to search the immediate children of a node? Based on what I can tell, I have to get the children of the node, then iterate over them to find the matching child, if any. It would be nice to have a depth option on .contains() or a .find() method on a Node to search the immediate children.