rockpool.utilities.tree_utils
Tree manipulation utilities with no external dependencies
This module provides methods for building and manipulating trees.
A Tree
is a nested dictionary. A Leaf
is any other object. A Node
is a non-leaf Tree
node. A TreeDef
is a nested dictionary with no data, only structure.
Functions
|
Generate all branches (paths from root node to any leaf) in a tree |
|
Get a value from a tree branch, specifying a branch |
|
Construct a tree with boolean leaves, for nodes that match a target tree |
|
Set the values in a full tree, for branches that match a target tree |
|
Set the values in a full tree, for branches that match a target tree, if the target tree leaf nodes evaluate to |
|
Set a value in a tree branch, specifying a branch |
|
Generate the tree branches to tree nodes that evaluate to |
|
Flatten a tree into a linear list of leaf nodes and a tree description |
|
Map a function over the leaves of a tree |
|
Build a tree from a flat list of leaves, plus a tree definition |
|
Perform a recursive update of a tree to insert or replace nodes from a second tree |