tree_rgb_map

tree_rgb_map(labels, tree_structure, item_leaf_map)

Assign colors by DFS leaf order of the DYF tree.

Leaves adjacent in DFS share subtree ancestry, so they get similar hues. This produces smooth color gradients within tree subtrees and natural discontinuities at subtree boundaries.

Parameters

Name Type Description Default
labels per-item cluster/bucket labels (array-like of ints) required
tree_structure list of node dicts from idx.get_tree_structure() required
item_leaf_map array of length N mapping item index → leaf node_id required