Container method

The method of (hypergraph) containers is a powerful tool that can help characterize the typical structure and/or answer extremal questions about families of discrete objects with a prescribed set of local constraints. Such questions arise naturally in extremal graph theory, additive combinatorics, discrete geometry, coding theory, and Ramsey theory; they include some of the most classical problems in the associated fields.

These problems can be expressed as questions of the following form: given a hypergraph $H$ on finite vertex set $V$ with edge set $E$ (i.e. a collection of subsets of $V$ with some size constraints), what can we say about the independent sets of $H$ (i.e. those subsets of $V$ that contain no element of $E$)? The hypergraph container lemma provides a method for tackling such questions.

History
One of the foundational problems of extremal graph theory, dating to work of Mantel in 1907 and Turán from the 1940s, asks to characterize those graphs that do not contain a copy of some fixed forbidden $H$ as a subgraph. In a different domain, one of the motivating questions in additive combinatorics is understanding how large a set of integers can be without containing a $k$-term arithmetic progression, with upper bounds on this size given by Roth ($$k=3$$) and Szemerédi (general $k$).

The method of containers (in graphs) was initially pioneered by Kleitman and Winston in 1980, who bounded the number of lattices and graphs without 4-cycles. Container-style lemmas were independently developed by multiple mathematicians in different contexts, notably including Sapozhenko, who initially used this approach in 2002-2003 to enumerate independent sets in regular graphs, sum-free sets in abelian groups, and study a variety of other enumeration problems

A generalization of these ideas to a hypergraph container lemma was devised independently by Saxton and Thomason and Balogh, Morris, and Samotij in 2015, inspired by a variety of previous related work.

Main idea and informal statement
Many problems in combinatorics can be recast as questions about independent sets in graphs and hypergraphs. For example, suppose we wish to understand subsets of integers $1$ to $n$, which we denote by $$[n]$$ that lack a $k$-term arithmetic progression. These sets are exactly the independent sets in the $k$-uniform hypergraph $$ H = (\{1,2,\ldots,n\}, E) $$, where $E$ is the collection of all $k$-term arithmetic progressions in $$ \{1,2,\ldots,n\} $$.

In the above (and many other) instances, there are usually two natural classes of problems posed about a hypergraph $H$: These problems are connected by a simple observation. Let $$\alpha(H)$$ be the size of a largest independent set of $H$ and suppose $$H$$ has $$i(H)$$ independent sets. Then,
 * What is the size of a maximum independent set in $H$? What does the collection of maximum-sized independent sets in $H$ look like?
 * How many independent sets does $H$ have? What does a "typical" independent set in $H$ look like?
 * $$2^{\alpha(H)} \le i(H) \le \sum_{r = 0}^{\alpha(H)} {|V(H)| \choose r},$$

where the lower bound follows by taking all subsets of a maximum independent set. These bounds are relatively far away from each other unless $$\alpha(H)$$ is very large, close to the number of vertices of the hypergraph. However, in many hypergraphs that naturally arise in combinatorial problems, we have reason to believe that the lower bound is closer to the true value; thus the primary goal is to improve the upper bounds on $i(H)$.

The hypergraph container lemma provides a powerful approach to understanding the structure and size of the family of independent sets in a hypergraph. At its core, the hypergraph container method enables us to extract from a hypergraph, a collection of containers, subsets of vertices that satisfy the following properties: The name container alludes to this last condition. Such containers often provide an effective approach to characterizing the family of independent sets (subsets of the containers) and to enumerating the independent sets of a hypergraph (by simply considering all possible subsets of a container).
 * There are not too many containers.
 * Each container is not much larger than the largest independent set.
 * Each container has few edges.
 * Every independent set in the hypergraph is fully included in some container.

The hypergraph container lemma achieves the above container decomposition in two pieces. It constructs a deterministic function $f$. Then, it provides an algorithm that extracts from each independent set $I$ in hypergraph $H$, a relatively small collection of vertices $$S \subset I$$, called a fingerprint, with the property that $$ S \subset I \subset S \cup f(S)$$. Then, the containers are the collection of sets $$S \cup f(S)$$ that arise in the above process, and the small size of the fingerprints provides good control on the number of such container sets.

Graph container algorithm
We first describe a method for showing strong upper bounds on the number of independent sets in a graph; this exposition is adapted from a survey of Samotij about the graph container method, originally employed by Kleitman-Winston and Sapozhenko.

Notation
We use the following notation in the below section.
 * $$ G = (V, E) $$ is a graph on $$|V| = n$$ vertices, where the vertex set is equipped with (arbitrary) ordering $$ \{v_1, \ldots, v_n \} $$.
 * Let $$ \ell(G) $$ be the collection of independent sets of $G$ with size $$ i(G) := |\ell(G)| $$. Let $$i(G, r)$$ be the number of independent sets of size $r$.
 * The max-degree ordering of a vertex subset $$ A \subset V$$ is the ordering of the vertices in $A$ by their degree in the induced subgraph $$G[A]$$.

Kleitman-Winston algorithm
The following algorithm gives a small "fingerprint" for every independent set in a graph and a deterministic function of the fingerprint to construct a not-too-large subset that contains the entire independent set

Fix graph $G$, independent set $$I \in \ell(G)$$ and positive integer $$q \le |I|$$.
 * 1) Initialize: let $$A=V(G), S=\emptyset$$.
 * 2) Iterate for $$s = 1,2,\ldots, q$$:
 * 3) * Construct the max-degree ordering of $$A,\,(v_1, \ldots v_{|A|})$$
 * 4) * Find the minimal index $$j_s$$ such that $$v_{j_s} \in I$$ (i.e. the vertex in $A$ of largest degree in induced subgraph $G[A]$)
 * 5) * Let $$S \leftarrow S \cup \{v_{j_s}\},\,A \leftarrow A \backslash (\{v_1, \ldots, v_{j_s}\} \cup N(v_{j_s}))$$, where $$N(v)$$ is the neighborhood of vertex $$v$$.
 * 6) Output the vector $$(j_1, \ldots, j_q)$$ and the vertex set $$A \cap I$$.

Analysis
By construction, the output of the above algorithm has property that $$\{v_{j_1}, \ldots, v_{j_q}\} \subset I \subset \{v_{j_1}, \ldots, v_{j_q}\} \cup (A \cap I)$$, noting that $$A \cap I$$ is a vertex subset that is completely determined by $$\{j_1, \ldots, j_q\}$$ and not otherwise a function of $$I$$. To emphasize this we will write $$A = A(j_1, \ldots, j_q)$$. We also observe that we can reconstruct the set $$S = \{v_{j_1}, \ldots, v_{j_q}\} = S(j_1, \ldots j_q)$$ in the above algorithm just from the vector $$(j_1, \ldots, j_q)$$.

This suggests that $$S$$ might be a good choice of a fingerprint and $$S(j_1, \ldots j_q) \cup A(j_1, \ldots, j_q)$$ a good choice for a container. More precisely, we can bound the number of independent sets of $$G$$ of some size $$r \ge q$$ as a sum over output sequences $$(j_1, \ldots j_q)$$
 * $$i(G, r) = \sum_{(j_s)_{s = 1}^q} i(G[A(j_1, \ldots j_q)], r-q) \le \sum_{(j_s)} {A(j_1, \ldots j_q)\choose r- q}$$,

where we can sum across $$r$$ to get a bound on the total number of independent sets of the graph:
 * $$i(G) = \sum_{r = 0}^{q-1} {n \choose r} + \sum_{(j_s)_{s = 1}^q} i(G[A(j_1, \ldots j_q)]) \le \sum_{r = 0}^{q-1} {n \choose r} + \sum_{(j_s)} 2^{|A(j_1, \ldots j_q)|}$$.

When trying to minimize this upper bound, we want to pick $$q$$ that balances/minimizes these two terms. This result illustrates the value of ordering vertices by maximum degree (to minimize $$|A(j_1, \ldots j_q)|$$).

Lemmas
The above inequalities and observations can be stated in a more general setting, divorced from an explicit sum over vectors $$(j_s)$$.

Lemma 1: Given a graph $$G$$ with $$n$$ and assume that integer $$q$$ and real numbers $$R, \beta \in [0, 1]$$ satisfy $$R \ge e^{-\beta q}n$$. Suppose that every induced subgraph on at least $$R$$ vertices has edge density at least $$\beta$$. Then for every integer $$r \ge q$$,
 * $$i(G, r) \le {n \choose q}{R \choose r - q}.$$

Lemma 2: Let $$G$$ be a graph on $$n$$ vertices and assume that an integer $$q$$ and reals $$R, D$$ are chosen such that $$n \le R+ qD$$. If all subsets $$U$$ of at least $$R$$ vertices have at least $$D|U|/2$$ edges, then there is a collection $$\mathcal{F}$$ of subsets of $$q$$ vertices ("fingerprints") and a deterministic function $$f: \mathcal{C} \rightarrow \mathcal{P}(V(G)$$, so that for every independent set $$I \subset V(G)$$, there is $$S \in \mathcal{F}$$ such that $$S \subset I \subset f(S) \cup S$$.

Hypergraph container lemma
Informally, the hypergraph container lemma tells us that we can assign a small fingerprint $$S \subset I$$ to each independent set, so that all independent sets with the same fingerprint belong to the same larger set, $$C = f(S)$$, the associated container, that has size bounded away from the number of vertices of the hypergraph. Further, these fingerprints are small (and thus there are few containers), and we can upper bound their size in an essentially optimal way using some simple properties of the hypergraph.

We recall the following notation associated to $$k$$ uniform hypergraph $$\mathcal{H}$$.
 * Define $$\Delta_l(\mathcal{H}) := \max\{d_{H}(A) \mid A \subset V(\mathcal{H}), |A| = l\}$$ for positive integers $$1\le l \le k$$, where $$d_{\mathcal{H}}(A) = |\{e \in E(\mathcal{H}) \mid A \subset e\}|$$.
 * Let $$\mathcal{I}(\mathcal{H})$$ be the collection of independent sets of $$\mathcal{H}$$. $$I$$ will denote some such independent set.

Statement
We state the version of this lemma found in a work of Balogh, Morris, Samotij, and Saxton

Let $$\mathcal{H}$$ be a $$k$$-uniform hypergraph and suppose that for every $$l \in \{1,2,\ldots, k\}$$ and some $$b, r \in \mathbb{N}$$, we have that $$\Delta_l(H) \le \left( \frac{b}{|V(H)|} \right)^{l-1} \frac{|E(H)|}{r}$$. Then, there is a collection $$\mathcal{C} \subset \mathcal{P}(V(H))$$ and a function $$f: \mathcal{P}(V(H)) \rightarrow \mathcal{C}$$ such that
 * for every $$I \in \mathcal{I}(H)$$ there exists $$S \subset I$$ with $$|S|\le(k-1)b$$ and $$I\subset f(S)$$.
 * $$|C| \le |V(H)| - \delta r$$ for every $$C \in \mathcal{C}$$ and $$\delta = 2^{-k(k+1)}$$.

Upper bound on the number of independent sets
We will show that there is an absolute constant $C$ such that every $$n$$-vertex $$d$$-regular graph $$G$$ satisfies $$i(G) \le 2^{\left(1 + C \sqrt{\frac{\log d}{d}}\right)\frac{n}{2}}$$.

We can bound the number of independent sets of each size $$r$$ by using the trivial bound $$i(G, r) \le {n \choose r} \le {n \choose n/10} \le 2^{0.48n}$$ for $$r \le n/10$$. For larger $$r$$, take $$\beta > 10/n, q = \lfloor 1/\beta \rfloor, R = \frac{n}{2} + \frac{\beta n^2}{2d}.$$ With these parameters, $d$-regular graph $$G$$ satisfies the conditions of Lemma 1 and thus,
 * $$ i(G, r) \le {n \choose q}{R \choose r - q} \le {n \choose q}{\frac{n}{2} + \frac{\beta n^2}{2d} \choose r - q} \le \left(\frac{en}{q} \right)^q {\frac{n}{2} + \frac{\beta n^2}{2d} \choose r - q} \le (e\beta n)^{\lfloor 1/\beta \rfloor} {\frac{n}{2} + \frac{\beta n^2}{2d} \choose r - q}.$$

Summing over all $$0\le r \le n$$ gives
 * $$i(G) \le 2^{0.49n} + 2^{\frac{n}{2} + \frac{\beta n^2}{2d} + \lfloor 1/\beta \rfloor \log_2(e \beta n)}$$,

which yields the desired result when we plug in $$\beta = \sqrt{d \log d}/n.$$

Sum-free sets
A set $$A$$ of elements of an abelian group is called sum-free if there are no $$x,y,z\in A$$ satisfying $$x+y=z$$. We will show that there are at most $$2^{(1/2+o(1))n}$$ sum-free subsets of $$[n]:=\{1,2,\ldots, n\}$$.

This will follow from our above bounds on the number of independent sets in a regular graph. To see this, we will need to construct an auxiliary graph. We first observe that up to lower order terms, we can restrict our focus to sum-free sets with at least $$n^{2/3}$$ elements smaller than $$n/2$$ (since the number of subsets in the complement of this is at most $$ (n/2)^{n^{2/3}} 2^{n/2 + 1}$$).

Given some subset $$ S \subset \{1,2,\ldots, \lceil n/2 \rceil - 1\}$$, we define an auxiliary graph $$G_S$$ with vertex set $$[n]$$ and edge set $$\{\{x, y\} \mid x + s \equiv y \pmod n \text{ for some } s \in S \cup (-S)\}$$, and observe that our auxiliary graph is $$2|S|$$ regular since each element of $S$ is smaller than $$n/2$$. Then if $$S_A$$ are the smallest $$n^{2/3}$$ elements of subset $$A \subset [n]$$, the set $$A \backslash S_A$$ is an independent set in the graph $$G_{S_A}$$. Then, by our previous bound, we see that the number of sum-free subsets of $$[n]$$ is at most
 * $$(n/2)^{n^{2/3}} 2^{n/2+} + {n/2 \choose n^{2/3}} 2^{(1 + O(n^{-1/3} \sqrt{\log n}))\frac{n}{2}} \le 2^{(1/2 + O(n^{-1/3}\log n))n}.$$

Triangle-free graphs
We give an illustration of using the hypergraph container lemma to answer an enumerative question by giving an asymptotically tight upper bound on the number of triangle-free graphs with $$n$$ vertices.

Informal statement
Since bipartite graphs are triangle-free, the number of triangle free graphs with $$n$$ vertices is at least $$2^{\lfloor n^2/4 \rfloor}$$, obtained by enumerating all possible subgraphs of the balanced complete bipartite graph $$K_{\lfloor n/2\rfloor,\lceil n/2 \rceil}$$.

We can construct an auxiliary $3$-uniform hypergraph $H$ with vertex set $$V(H) = E(K_n)$$ and edge set $$E(H) = \{\{e_1, e_2, e_3\} \subset E(K_n) = V(H) \mid e_1, e_2, e_3 \text{ form a triangle}\}$$. This hypergraph "encodes" triangles in the sense that the family of triangle-free graphs on $$n$$ vertices is exactly the collection of independent sets of this hypergraph, $$\mathcal{I}(H)$$.

The above hypergraph has a nice degree distribution: each edge of $$K_n$$, and thus vertex in $$V(H)$$ is contained in exactly $$n-2$$ triangles and each pair of elements in $$V(H)$$ is contained in at most 1 triangle. Therefore, applying the hypergraph container lemma (iteratively), we are able to show that there is a family of $$n^{O(n^{3/2})}$$ containers that each contain few triangles that contain every triangle-free graph/independent set of the hypergraph.

Upper bound on the number of triangle-free graphs
We first specialize the generic hypergraph container lemma to 3-uniform hypergraphs as follows:

Lemma: For every $$c > 0$$, there exists $$\delta > 0$$ such that the following holds. Let $$H$$ be a 3-uniform hypergraph with average degree $$d \ge 1/\delta$$ and suppose that $$\Delta_1(H) \le c d, \Delta_2(H) \le c\sqrt{d}$$. Then there exists a collection $$\mathcal{C} \subset \mathcal{P}(V(H))$$ of at most $$|\mathcal{C}| \le {|V(H)| \choose |V(H)|/\sqrt{d}}$$ containers such that
 * for every $$I \in \mathcal{I}(H)$$, there exists $$I \subset C \in \mathcal{C}$$
 * $$|C| \le (1 - \delta)|V(H)|$$ for all $$C \in \mathcal{C}$$

Applying this lemma iteratively will give the following theorem (as proved below):

Theorem: For all $$\epsilon > 0$$, there exists $$C>0$$ such that the following holds. For each positive integer $n$, there exists a collection $$\mathcal{G}$$ of graphs on $n$ vertices with $$|\mathcal{G}| \le n^{Cn^{3/2}}$$ such that
 * each $$G \in \mathcal{G}$$ has fewer than $$\epsilon n^3$$ triangles,
 * each triangle-free graph on $$n$$ vertices is contained in some $$G \in \mathcal{G}$$.

Proof: Consider the hypergraph $$H$$ defined above. As observed informally earlier, the hypergraph satisfies $$|V(H)| = {n \choose 2}, \Delta_2(H) = 1, d(v) = n - 2$$ for every $$v \in V(H)$$. Therefore, we can apply the above Lemma to $$H$$ with $$c=1$$ to find some collection $$\mathcal{C}$$ of $$n^{O(n^{3/2})}$$ subsets of $$E(K_n)$$ (i.e. graphs on $$n$$ vertices) such that This is not quite as strong as the result we want to show, so we will iteratively apply the container lemma. Suppose we have some container $$C \in \mathcal{C}$$ with at least $$\epsilon n^3$$ triangles. We can apply the container lemma to the induced sub-hypergraph $$H[C]$$. The average degree of $$H[C]$$ is at least $$6 \epsilon n$$, since every triangle in $$C$$ is an edge in $$H[C]$$, and this induced subgraph has at most $${n \choose 2}$$ vertices. Thus, we can apply Lemma with parameter $$c = 1/\epsilon$$, remove $$C$$ from our set of containers, replacing it by this set of containers, the containers covering $$\mathcal{I}(H[C])$$.
 * every triangle free graph is a subgraph of some $$C \in \mathcal{C}$$,
 * every $$C \in \mathcal{C}$$ has at most $$(1 - \delta) {n \choose 2}$$ edges.

We can keep iterating until we have a final collection of containers $$\mathcal{C}$$ that each contain fewer than $$\epsilon n^3$$ triangles. We observe that this collection cannot be too big; all of our induced subgraphs have at most $${n \choose 2}$$ vertices and average degree at least $$6 \epsilon n$$, meaning that each iteration results in at most $$n^{O(n^{3/2})}$$ new containers. Further, the container size shrinks by a factor of $$1-\delta$$ each time, so after a bounded (depending on $$\epsilon$$) number of iterations, the iterative process will terminate.