3

Suppose there is an infinite single-rooted complete binary tree--i.e., every node except the root has a single parent, and every node has two children. There are also $n$ colors to choose from. The task is to paint as many full levels (sets of nodes equidistant to the root) as possible, starting with the root and without skipping any levels, with the following condition: No pair of nodes of the same color at the same level in the tree is painted the same color as any of their ancestors in common.

For example, the following trees are invalid $2$-colorings for the first three levels:

     0 <         1 <  
    / \         / \     
   0   1       0   1    
  / \ / \     / \ / \  
  0 1 0 1     1 1 0 1  
  ^   ^       ^ ^

For the former, the two 0's at the bottom level are painted the same color as the root, and in the latter, the two 1's on the left fail similarly.

The following is the only valid 2-coloring for 3 levels (up to relabeling and isomorphism):

     0      
    / \     
   0   1    
  / \ / \   
  1 1 0 1   

Let $L(n)$ be the maximum number of levels one can fully paint with $n$ colors. The question is whether there is a closed formula for $L(n)$, or how far can we characterize $L(n)$ otherwise.

Obs 1: There is an easy lower bound of $L(n) \geq n$ since we can paint each full level a different color.

Obs 2: There is a pigeonhole argument that says that for $2^k-1$ colors, one can't paint more than $k \cdot 2^k$ levels.

Obs 3: I ran some code to find the first values of $L(n)$, and I saw that $L(3) = 5$ since there was no 3-coloring of 6 levels, and we can paint the first 5 levels like this:

               0
       0               1
   1       1       0       1
 1   2   1   2   0   1   2   2
2 2 1 2 2 2 1 2 2 2 2 2 0 2 1 2

Clearly, $L(1) = 1$ and it can be shown that $L(2) = 3$. Does the pattern continue, and $L(n) = 2n-1$?

alsips-cl
  • 133
  • 2
    (Index by 1) Hint: Let the weight of each node at level $k$ be $ \frac{1}{2^{k-1}}$. Show that for each color, the sum of weights is $ < 2$, hence $L(n) < 2n$. $\quad$ Then, identify the pattern to construct $L(n) \geq 2n-1$. – Calvin Lin Dec 17 '24 at 06:04

1 Answers1

2

(We index by 1, even though OP indexed the colors by 0).

Part 1: Showing that $ L(n) < 2n$ via structure finder.

At level $k$, assign each node a weight of $ \frac{1}{2^{k-1}}$. Since there are $2^{k-1}$ nodes, hence it has a total weight of 1. So, if we can find the max total weight, this gives us a bound on the max complete depth of the tree.

Claim 1: For a (finite) rooted tree, the weight of color $i$ is (strictly) less than 2.

Observation A: If a node at level $k$ has color $i$, then for the subgraph under that node, each level underneath it has at most 1 node of color $i$.
Hence, the sum of weights of color $i$ in this subgraph is (strictly) less than $ \frac{1}{2^{k-1} } + \frac{1}{2^{k} } + \ldots = \frac{2}{ 2^{k-1}} $.

Observation B: For a rooted tree, if we select some nodes such that each rooted path contains at most one of these nodes, then the sum of weights is $ \leq 1$.

Proof of claim 1: Fix a color $i$. As we go along each root path, select the first time that color $i$ is used.

  • For each of these nodes, Observation A tells us that the sum of weights of color $i$ in the subgraph is (strictly) less than twice the weight of the node.
  • By construction, each rooted path has at most one such node, so Observation B tells us that the sum of their weights is $ \leq 1$.
  • Hence, the sum of weights of color $i$ is $\leq 2$.
  • In order to get the strictly less, we need the levels to be finite in Observation A. So either
    1. Accept OP's Obs 2 about finiteness via an unstated PGP argument, or
    2. Run through this argument once to get finiteness - max level of $2n$.

Corollary: Summing over all $n$, colors, $L(n) < 2n$ as desired.

Part 2: Showing that $L(n) \geq 2n-1$ via construction inductively.

OP has provided a valid 2-coloring for 3 levels (Unique up to relabeling and isomorphism, left as an exercise):

     0      
    / \     
   0   1    
  / \ / \   
  1 1 0 1   

We inductively use this to construct the example.
Given $2n-1$ rows colored with $n$ colors, we extend it by 2 rows with the following algorithm: If the node at level $2n-1$ is $M$, then extend it with the color $n+1$ by replacing the node with the following tree

       M      
     /    \     
    M     n+1    
  /   \   /  \   
 n+1 n+1 M   n+1   

It remains to show that this extension satisfies the conditions.

  • At level $2n$
    • Given 2 nodes that are colored $n+1$, none of the nodes at level $\leq 2n-1$ is equal to $n+1$, so this is trivially satisfied.
    • Given 2 nodes that are colored $M$, then their root node at level $2n-1$ is colored $M$, and inductively none of their common ancestors are colored $M$.
  • At level $2n+1$
    • Given 2 nodes that are colored $n+1$, none of the nodes at level $\leq 2n-1$ is equal to $n+1$. By construction, they will not share the same node at level $2n$.
    • Given 2 nodes that are colored $M$, then their root node at level $2n-1$ is colored $M$, and inductively none of their common ancestors are colored $M$.

Thus, this is a valid tree of $n+1$ colors with depth $2n+1$.

Note: Here is what this algorithm yields for $n=3$ (with colors indexed by 0)

               0
       0               1
   1       1       0       1
 1   2   1   2   0   2*   1*   2
2 2 1 2 2 2 1 2 2 2 1* 2 2* 2 1 2

The differences from OP's are denoted with a *. It wasn't obvious to me how to extend OP's example in terms of 1/ coming up with a simple description of the pattern, and 2/ a reason for why it is a valid coloring.

Corollary: Combining both parts, $L(n) = 2n-1$ as OP hypothesized.

Calvin Lin
  • 77,541
  • Thank you for your answer! Only one terminology question: is "structure finder" the name of a proof technique? I might need to look at more proofs like this. – alsips-cl Dec 17 '24 at 17:24
  • @alsips-cl It's a very loosely defined proof technique known as "Structure Finder and Structure Avoider" to describe how to approach construction problems. In this case, the structure we found was the "first node of color i", which made it easy to organize the proof. – Calvin Lin Dec 18 '24 at 00:58