balance

fun balance(config: BalanceConfig = BalanceConfig()): Tree

Balance a tree, making sure no children arrays grow too large for optimal performance. Returns a copy whose children may be grouped into subtrees of type NodeType.none.