c0fec0de / anytree

Python tree data library
Apache License 2.0
947 stars 133 forks source link

Sampling tree leaves #149

Closed dzieciou closed 3 years ago

dzieciou commented 3 years ago

I found an algorithm for sampling tree leaves:

Rosenbaum, Paul R. "Sampling the leaves of a tree with equal probabilities." Journal of the American Statistical Association 88.424 (1993): 1455-1457.

It is particularly good when a tree has leaves of different depths. Does anytree support that or is there a library based on anytree that supports that?

c0fec0de commented 3 years ago

Hi,

i do not know the article and have no access to it.

anytree serves various tree iteration algorithms: https://anytree.readthedocs.io/en/latest/api/anytree.iterators.html These iterators just serve every node according to their iteration strategy. The filter argument can be used to reduce the output to leave nodes only.

I cannot relate the article to that. Any ideas or improvements are welcome

c0fec0de commented 3 years ago

Close due to missing feedback - please re-open the ticket if you have input.