skbio.tree.TreeNode.assign_ids#

TreeNode.assign_ids()[source]#

Assign topologically stable unique IDs to all nodes of the tree.

Notes

This method assigns unique IDs to all nodes of the tree via a postorder traversal. The IDs are incremental integers starting from 0. The order is topologically stable. Following the call, all nodes in the tree will have their id attribute set.