This represents the quantization error for a node. On any given iteration over the tree, it selects those nodes whose E statistics upward. This has the effect of minimizing any quantization error when merging two nodes together. When a node to be pruned has offspring, the pruning procedure invokes itself recursively in order to prune the tree from the leaves upward. This retains the pruned node's color characteristics for later averaging.
Assignment generates the output image from the pruned tree.
First, the assignment phase makes one pass over the pruned color description tree to establish the image's color map. This produces the mean color of all pixels that classify no lower than this node. Each of these colors becomes an entry in the color map. Finally, the assignment phase reclassifies each pixel in the pruned tree to identify the deepest node containing the pixel's color. The pixel's value in the pixel array becomes the index of this node's mean color in the color map.