Hat Guessing Numbers of Degenerate Graphs

Recently, Farnik asked whether the hat guessing number $\text{HG}(G)$ of a graph $G$ could be bounded as a function of its degeneracy $d$, and Bosek, Dudek, Farnik, Grytczuk and Mazur showed that $\text{HG}(G)\ge 2^d$ is possible. We show that for all $d\ge 1$ there exists a $d$-degenerate graph $G$ for which $\text{HG}(G) \ge 2^{2^{d-1}}$. We also give a new general method for obtaining upper bounds on $\text{HG}(G)$. The question of whether $\text{HG}(G)$ is bounded as a function of $d$ remains open.


Introduction
Hat puzzles have long been a mainstay of recreational mathematics, colorfully touching on ideas as diverse as the axiom of choice, modular arithmetic, and coding theory (see e.g. [19,20]). In this note, we study a particular hat puzzle on graphs introduced by Butler, Hajiaghayi, Kleinberg, and Leighton [5], which has attracted some recent interest in discrete mathematics [2,3,8,9,10,12,18].
Suppose n players are sitting on the vertices of a (finite, simple) graph G. An adversary puts a colored hat on each of their heads, in one of q colors. The players can only see the hats on their neighbors' heads, and in particular no player sees their own hat. The players simultaneously guess the colors of their own hats, and they collectively win if any single one of them guesses correctly. The players may not communicate after the hat colors are assigned but may agree upon a strategy beforehand. The hat guessing number HG(G) of G is then the largest q for which the players have a winning strategy in the game with q colors.
To our knowledge, the only connected graphs G for which we know the exact value of HG(G) are complete graphs, trees, or pseudotrees (connected graphs with exactly one cycle). The classic case is when G = K n is the complete graph on n vertices, and in this case HG(K n ) = n. One winning strategy is for the i-th player to guess the hat color (identifying colors with Z/nZ) that would make the total of all the colors sum to i (mod n). Butler, Hajiaghayi, Kleinberg, and Leighton [5] determined that HG(T ) = 2 for all trees T , and Szczechla [18] showed that for the cycle C n of length n, HG(C n ) = 3 if n = 4 or n is a multiple of 3, and HG(C n ) = 2 otherwise. Kokhas and Latyshev [15] showed that in fact the only connected graphs G with HG(G) = 2 are trees and graphs with a single cycle whose length is not 4 or a multiple of 3.
Farnik [9] observed that if G has maximum degree ∆, then HG(G) ≤ e∆ by the Lovász Local Lemma, and asked whether HG(G) is also bounded as a function of its degeneracy d (which is always at most ∆). Recall that a graph G is d-degenerate if there is a left-to-right ordering of its vertices where each vertex has at most d neighbors to its left. Farnik showed that if the players strategies are constrained to have a so-called "bi-polar" property, then the players cannot win unless there q ≤ d+1 colors, and conjectured that HG(G) ≤ d+1 in general. This was later disproved by Bosek, Dudek, Farnik, Grytczuk, and Mazur [3], who showed that for n large enough, HG(B d,n ) ≥ 2 d for the so-called book graph B d,n , which consists of a d-clique complete to n isolated vertices, and which is d-degenerate. 1 Alon, Ben-Eliezer, Shangguan, and Támo [2] considered another variant of this question, showing that if q is a prime power and the players' strategies are constrained to be linear (identifying the q hat colors with elements of F q ), then the players cannot win unless q ≤ d + 1.
Our first main result proves that in fact HG(G) can be at least double exponential in terms of the degeneracy d of G. Furthermore, we determine the hat guessing number exactly for a certain family of d-degenerate graphs G, adding an infinite family to the small list of graphs whose hat guessing number is known precisely.
Let T d (N ) denote the complete rooted N -ary tree with depth d, and define G d (N ) to be the graph obtained from T d (N ) by drawing an edge between every vertex and each of its ancestors (if the edge does not exist already). Ordering the vertices by their depth in T d (N ), we see that G d (N ) is d-degenerate. Recall that Sylvester's sequence (s n ) ∞ n=0 , defined by s 0 = 2 and s n = s 0 · · · s n−1 + 1 = s 2 n−1 − s n−1 + 1 for n ≥ 1, satisfies s n = ⌊E 2 n+1 + 1 2 ⌋ for some E ≈ 1.264. Theorem 1.1. For any d ≥ 1 and all N sufficiently large in terms of d, We say that a vertex ordering of a graph G is d-degenerate if each vertex has at most d neighbors to the left, and that such an ordering has depth D if the longest left-to-right path contains D edges. Our second main result shows that Theorem 1.1 is close to best possible, in the sense that HG(G) is always doubly-exponentially bounded in terms of d and D. Our last result shows that HG(B d,n ) = d (1+o(1))d for n sufficiently large, improving the bounds in [3] and characterizing the asymptotic growth of HG(B d,n ) up to a lower order term in the exponent.
In the next section we prove the upper bounds in Theorems 1.1 and 1.2; the main innovation is a deterministic adversary strategy that precommits to using very few colors on certain vertices of G. The lower bound in Theorem 1.1 is then proved separately in Section 3; we build a guessing strategy starting with the largest depth and show that, from depth i + 1 to depth i, we can roughly square-root the number of candidate colorings. We finish by proving Theorem 1.3 in Section 4.
Related work Perhaps the most famous hat guessing puzzle was introduced by Ebert [6]. Each player is independently given a red or blue hat with equal probability and the players, seeing the other players' hats, simultaneously either guess their hat color or pass. They win if at least one player guesses correctly and no player guesses incorrectly. The 3 player version was popularized in the New York Times [17]. Many variations of this puzzle have been studied (see [9,14] for surveys), including one [5] where, like in this work, the sight graph is an arbitrary graph, rather than a clique. Hat guessing puzzles have found connections to coding theory [7], to auctions [1], to network coding [13,16], to finite dynamical systems [10], and possibly to understanding DNA [11].

Upper bounds
We prove a general upper bound on HG(G) that implies both Theorem 1.2 and the upper bound in Theorem 1.1.
If G is a graph with vertices ordered v 1 , . . . , v n , define A(v i ) := N (v) ∩ {v 1 , . . . , v i−1 } to be the set of neighbors of v i to the left of v i (A for "ancestor"). Let [n] be the set {1, . . . , n}, and for a set S, let S k denote the collection of k-element subsets of S.
Proof. Fix any guessing strategy for the players, which we may assume the adversary knows. We describe an adversary strategy which prevents any vertex from guessing correctly using q colors, where q = max{t 1 , . . . , t n }.
The adversary pre-commits to using only a color from [t i ] for the hat of v i . The adversary then chooses the hat colors of v i in decreasing order of i, starting from the rightmost vertex v n . Assume that, for some 1 ≤ i ≤ n, all vertices to the right of v i have been assigned hat colors. Over all possible remaining ways to place the hats, there are at most distinct tuples of colors that can appear on the set A(v i ). Since the hat colors to the right of v i have all been assigned, the guess of v i now depends solely on the colors in A(v i ), so at most t i − 1 colors are possible for v i to guess. Hence, the adversary can find a color out of [t i ] that v i is guaranteed not to guess.
We have shown that there exists a color q i ∈ [t i ] not guessed by v i , regardless of the hat assignments yet to be made. Giving v i this hat color and continuing to the left, we are done.
We now can deduce the upper bounds simply by exhibiting the appropriate vertex orderings.
Proof of Theorem 1.2. Suppose G has a vertex ordering where each vertex has at most d leftneighbors, and the longest left-to-right path has length D. We say that v i has depth k if the longest left-to-right path with v i as its rightmost vertex has length k. Applying Lemma 2.1 to this ordering, we find that if a k satisfies a 0 = 2 and a k = a d k−1 + 1 for k > 0, then t i ≤ a k if k is the depth of v i , and so HG(G) < a D . It is easy to check that a D ≤ 2 d D+1 , as desired.
The upper bound in Theorem 1.1 is similar.
Proof of upper bound in Theorem 1.1. Order the vertices of the graph G d (N ) so that every vertex comes after its parent in the tree T d (N ), so that for each v ∈ G d (N ), the set A(v) is exactly the set of ancestors of v in T d (N ). By the definition of G d (N ), each vertex at depth k has exactly one ancestor of every depth smaller than k. Applying Lemma 2.1 to this ordering, we see that t i = s k where k is the depth of v i and s k is the k-th term of Sylvester's sequence. The depth is d, so HG(G) < s d , as desired.

The lower bound
We now show the lower bound HG(G d (N )) ≥ s d − 1 for sufficiently large N . Our guessing strategy uses repeatedly the simple observation that each player can act under the assumption that every other player guesses incorrectly, since otherwise they would collectively win. For each v ∈ V (G) of depth 0 ≤ i ≤ d − 1, assign each of its children w a subset S w ⊂ [q] i+1 of size r i + 1 such that all q i+1 r i +1 such subsets are assigned to at least one child of v. This is possible as the number of children of v is N ≥ q i+1 r i +1 for all i ≤ d − 1. We are now ready to describe the guessing strategy. Roughly speaking, the idea is that the vertices of larger depth in the tree are so numerous that the vertices of smaller depth can deduce a lot of information about their own colors from the assumption that their descendants all guess incorrectly. The strategy will be built starting from the largest depth d, so that we first fix the guess of w before the guess of any element of A(w). Crucially, by the definition of G, all information available to w is available to any v ∈ A(w) except for the color of v.
We prove that, for any 0 ≤ i ≤ d and any depth-i vertex v, the vertices of D(v) can guess their hat colors so that vertex v (and its ancestors) can deduce a set of r i possibilities for χ(Ā(v)), using solely the information χ(D(v)). Formally, there is a guessing strategy for vertices of depth > i and a functions f v : r i depending only on χ(D(v)), such that if all vertices of depth greater than i guess wrong, then f v (χ(D(v)) contains χ(Ā(v)).
We proceed by reverse induction on i. The base case i = d is trivial, as for every vertex v of depth d, we can take f v (·) = [q] d+1 , which indeed is a set of size r d and contains every possible hat assignment forĀ(v). Now suppose i ≤ d − 1 and the assertion is true for i + 1, so that we have built the guessing strategy for vertices of depth greater than i + 1, and there exist functions f w for vertices w at depth i + 1. For each such w, let R w := f w (χ(D(w))) be the set of r i+1 assignments that w can "deduce" for χ(Ā(w)). Say that a color c ∈ [q] is w-abundant if there are at least r i + 1 colorings χ ′ ∈ R w with χ ′ (w) = c, and let C w be the set of w-abundant colors.
If i = d − 1, then there are clearly at most q = r i + 1 many w-abundant colors. If i < d − 1, so by the pigeonhole principle, there are again at most r i + 1 w-abundant colors. Thus, we may define φ w : C w → S w mapping the kth smallest w-abundant color to kth smallest element of S w for all k. Note that vertex w can compute φ w : w sees all of D(w), so w can compute R w , and thus C w , and thus φ w as S w was predetermined. If χ(Ā(v)) = φ w (c) for some w-abundant color c, vertex w guesses c. Otherwise, w guesses arbitrarily.
Let v be a vertex of depth i. We show that, from the hat colors of D(v), we can compute a set f v (χ(D(v)) of r i hat assignments toĀ(v) that contains the correct assignment if all vertices in D(v) guess incorrectly. First, from χ(D(v)), for each child w of v, one can compute the set of w-abundant colors C w and the injection φ w , and hence can determine if v has a child w for which χ(w) not w-abundant.
We break into two cases based on whether c w = χ(w) is w-abundant for all children w of v. If there exists a single w for which c w is not w-abundant, then there are at most r i colorings χ ′ ∈ R w for which χ ′ (w) = c w , and v can just let f v (χ(D(v)) be this set of at-most-r i colorings, restricted toĀ(v). If all descendants of w guess incorrectly, R w contains the correct coloring ofĀ(w), so f v (χ(D(v)) contains the correct coloring ofĀ(v).
Otherwise, all children w of v have a hat color that is w-abundant. Call an assignment toĀ(v) good if it is not equal to φ w (χ(w)) for any child w. Since the sets S w range over all (r i + 1)-subsets of [q] i+1 , and φ w (χ(w)) ∈ S w always, there are at most r i good assignments. Let f v (χ(D(v))) be the set of good assignments, with some arbitrary assignments thrown in to make it size exactly r i . Suppose all vertices in D(v) guess incorrectly. We show the assignment toĀ(v) is good. For each w, either χ(Ā(v)) is not in the image of φ w , or w guesses the color corresponding to χ(Ā(v)), which cannot be χ(w) since we assume w guesses incorrectly. In either case, χ(Ā(v)) = φ w (χ(w)) for all children w of v, so the assignment toĀ(v) is good, and therefore in f v (χ(D(v))). This shows how to construct f v (·) in all cases, completing the induction.
By the induction, it follows that the root vertex v 0 at depth 0 can determine a set f v 0 (χ(D(v 0 ))) of r 0 = s 1 − 2 = 1 colorings forĀ(v 0 ) = {v 0 }, and so v 0 uniquely determines its hat color assuming all the other vertices guess incorrectly. This completes the proof.

Books
In this section, we prove Theorem 1.3. Recall that the book graph B d,n is obtained by removing an n-clique from a complete graph K n+d . The vertices of the removed n-clique are called the pages of the book, and the remaining d vertices are its spine. Note that B d,n is d-degenerate.
We first reduce HG(B d,n ) to an equivalent geometric problem, introduced by Bosek, Dudek, Farnik, Grytczuk, and Mazur [3]. Let h(N d ) (which is µ a (K d ) in the notation of [3]) denote the largest t such that every t-subset of N d can be covered by picking at most one point from every axis-aligned line. Formally, we say that a set S ⊆ N d is coverable if there exists a partition S = S 1 ⊔ S 2 ⊔ · · · ⊔ S d such that S i contains at most one point along any line parallel to the i-th coordinate axis. For example, h(N 2 ) = 5 because any 5-set in the plane is coverable, but the 6-set {0, 1} × {0, 1, 2} is not. A similar concept was also considered e.g. in [4]. Proof. In [3,Theorem 13], it was shown that HG(B d,n ) ≥ h(N d ) + 1 for all n large enough. We show HG(B d,n ) ≤ h(N d ) + 1 for all n. Let U denote the spine of B d,n and V denote its pages, so that U forms a d-clique complete to the n pages V , which form an independent set. Let S ∈ N d be a set of size q = h(N d ) + 1 that is not coverable. Without loss of generality, S is a subset of [q] d , so we can also view elements of S as hat colorings of U . In fact the adversary will pre-commit to using only elements of S as the coloring on U .
Fix a guessing strategy on B d,n with colors [q + 1], and for any s ∈ S and v ∈ V let f v (s) denote the guess that vertex v makes if s is the coloring of U . Since |S| = q, by the pigeonhole principle there is some color q v ∈ [q + 1] that never appears in {f v (s) : s ∈ S}. Give each v ∈ V hat color q v ; this guarantees that no v ∈ V guesses correctly. For each u ∈ U , the subset S u ⊆ S of colorings of U where u guesses correctly contains at most one point along any line parallel to u's coordinate axis in N d . By the definition of S, there must exist some s ∈ S outside all of the S u . Thus there is a hat assignment where no vertex guesses correctly, and the upper bound follows.
A lower bound h(N d ) ≥ 2 d − 1 was shown in [3]. We give a stronger lower bound and an upper bound that matches it up to o(1) in the exponent.
Proof. The upper bound follows from the observation that any set is not coverable. Indeed, at most d d−2 (d + 1) points can be picked along lines in any of the first d − 1 axis directions, and at most d d−1 points can be picked in the last axis direction for a total of at most (d − 1)d d−2 (d + 1) + d d−1 = |S| − 1 points covered, so at least one point of S remains uncovered.
For the lower bound, as h(N) = 1, it suffices to prove Let S ⊂ N d have size (d + 1)h(N d−1 ) + d and define P i,y := {x ∈ N d : x i = y} to be a hyperplane orthogonal to the x i -axis. Say y ∈ N is i-abundant if |S ∩ P i,y | ≥ h(N d−1 ) + 1 (vacuously, no value is 0-abundant), and that x ∈ N d is type-i if i is the smallest index such that x i is not i-abundant, and say x is type-0 if it is not type-i for any i ∈ [d]. By definition, for any x, there is exactly one i ≥ 0 such that x is type-i. By the pigeonhole principle, for any i, at most d integers are i-abundant. Without loss of generality, these integers are 1, 2, . . . , d i ≤ d.
Let L 0,0 denote the set of type-0 points. Let L i,y ⊆ P i,y denote the set of type-i points x such that x i = y. Clearly the sets L i,y partition N d . For any i, y with L i,y defined, let L i,y denote the set of lines through a point in L i,y parallel to some j-axis with j = i. One can check that the L i,y are pairwise disjoint: for any i < i ′ and y and y ′ , a line in both L i,y and L i ′ ,y ′ must be parallel to some j axis for j = i and j = i ′ and furthermore must pass through points x ∈ L i,y and x ′ ∈ L i ′ ,y ′ . Then x i ′ is not i ′ -abundant, so x is not type-0, contradicting the fact that x ∈ L i,y if i = 0. Also, x ′ i is not i-abundant, so if i = 0, then x ′ is not type-i ′ as 0 < i < i ′ , contradicting the fact that x ′ ∈ L i ′ ,y ′ . We conclude that the L i,y are pairwise disjoint. For all i ∈ [d] and y not i-abundant, we have |S ∩ L i,y | ≤ |S ∩ P i,y | ≤ h(N d−1 ). By definition of h(·) it is possible to pick a point on each line in L i,y to cover S ∩ L i,y . For each line in L 0,0 in the ith direction, we pick the unique point x ∈ [d] d on the line such that d j=0 x j ≡ i mod d. This picks at most 1 point on each line and covers all elements of S, completing the proof.