skbio.core.tree.TreeNode.subsets

TreeNode.subsets()[source]

Return all sets of names that come from self and its descendants

Compute all subsets of tip names over self, or, represent a tree as a set of nested sets.

Returns:

frozenset

A frozenset of frozensets of str

Examples

>>> from skbio.core.tree import TreeNode
>>> tree = TreeNode.from_newick("(((a,b)c,(d,e)f)h)root;")
>>> for s in sorted(tree.subsets()):
...     print sorted(s)
['a', 'b']
['d', 'e']
['a', 'b', 'd', 'e']