Flag algebra

Flag algebras are an important computational tool in the field of graph theory which have a wide range of applications in homomorphism density and related topics. Roughly, they formalize the notion of adding and multiplying homomorphism densities and set up a framework to solve graph homomorphism inequalities with computers by reducing them to semidefinite programming problems. Originally introduced by Alexander Razborov in a 2007 paper, the method has since come to solve numerous difficult, previously unresolved graph theoretic questions. These include the $$D_{2,3}$$ question regarding the region of feasible edge density, triangle density pairs and the maximum number of pentagons in triangle free graphs.

Motivation
The motivation of the theory of flag algebras is credited to John Adrian Bondy and his work on the Caccetta-Haggkvist conjecture, where he illustrated his main ideas via a graph homomorphism flavored proof to Mantel's Theorem. This proof is an adaptation on the traditional proof of Mantel via double counting, except phrased in terms of graph homomorphism densities and shows how much information can be encoded with just density relationships. "Theorem (Mantel): The edge density in a triangle-free graph $G$ is at most $\frac{1}{2}$. In other words, $\mathrm{ex}(K_2,\{K_3\})\le\frac{1}{2}.$" As the graph is triangle-free, among 3 vertices in $$G$$, they can either form an independent set, a single induced edge $$\tilde{P_3}$$, or a path of length 2 $$P_3$$. Denoting $$d(H,G)$$ as the induced density of a subgraph $$H$$ in $$G$$, double counting gives: "$\binom{n}{3}\left(d(\tilde{P_3},G)+2d(P_3,G)\right)=\binom{n}{2}(n-2)d(K_2,G)\implies d(\tilde{P_3},G)+2d(P_3,G)=3d(K_2,G).$" Intuitively, $$d(P_3,G)\approx 3d(K_2,G)^2$$ since a $$P_3$$ just consists of two $$K_2$$s connected together, and there are 3 ways to label the common vertex among a set of 3 points. In fact, this can be rigorously proven by double counting the number of induced $$P_3$$s. Letting $$|G|$$ denote the number of vertices of $$G$$, we have: "G" where $$P_3^b$$ is the path of length 2 with its middle vertex labeled, and $$d(P_3^b,G^v)$$ represents the density of $$P_3^b$$s subject to the constraint that the labeled vertex is used, and that $$P_3^b$$ is counted as a proper induced subgraph only when its labeled vertex coincides with $$v$$. Now, note that $$d(P_3^b,G^v)\approx d(K_2^b,G^v)^2$$ since the probability of choosing two $$K_2^b$$s where the unlabeled vertices coincide is small (to be rigorous, a limit as $$|G|\to\infty$$ should be taken, so $$d(H,G)$$ acts as a limit function on a sequence of larger and larger graphs $$G$$. This idea will be important for the actual definition of flag algebras.) To finish, apply the Cauchy–Schwarz inequality to get "G" Plugging this back into our original relation proves what was hypothesized intuitively. Finally, note that $$d(\tilde{P_3},G)\ge 0$$ so "$6d(K_2,G)^2\le 2d(P_3,G)\le 3d(K_2,G)\implies d(K_2,G)\le\frac{1}{2}.$" The important ideas from this proof which will be generalized in the theory of flag algebras are substitutions such as $$d(P_3,G)\to 3d(K_2,G)^2$$, the use of labeled graph densities, considering only the "limit case" of the densities, and applying Cauchy at the end to get a meaningful result.

Definition
Fix a collection of forbidden subgraphs $$\mathcal{H}$$ and consider the set of graphs $$\mathcal{G}$$ of $$\mathcal{H}$$-free graphs. Now, define a type of size $$k$$ to be a graph $$\sigma\in\mathcal G$$ with labeled vertices $$V(\sigma)=[k]$$. The type of size 0 is typically denoted as $$\varnothing$$.

First, we define a $$\sigma$$-flag, a partially labeled graph which will be crucial for the theory of flag algebras: "Definition: A $\sigma$-flag is a pair $(F,\theta)$ where $F\in\mathcal G$ is an underlying, unlabeled, $\mathcal H$-free graph, while $\theta:[k]\to V(F)$ defines a labeled graph embedding of $\sigma$ onto the vertices $F$." Denote the set of $$\sigma$$-flags to be $$\mathcal F^\sigma$$ and the set of $$\sigma$$-flags of size $$n$$ to be $$\mathcal F^\sigma_n$$. As an example, $$P_3^b$$ from the proof of Mantel's Theorem above is a $$\sigma$$-flag where $$\sigma$$ is a type of size 1 corresponding to a single vertex.

For $$\sigma$$-flags $$F_1,F_2,\ldots,F_t,(G,\theta)$$ satisfying $$|G|-|\sigma|\ge \sum_{i=1}^t |F_i|-|\sigma|$$, we can define the density of the $$\sigma$$-flags onto the underlying graph $$G$$ in the following way: Definition: The density $$p(F_1,F_2,\ldots,F_t;G)$$ of the $$\sigma$$-flags $$F_1,\ldots,F_t$$ in $$G$$ is defined to be the probability of successfully randomly embedding $$F_1,\ldots,F_t$$ into $$V(G)$$ such that they are nonintersecting on $$V(G)\setminus\mathrm{im}(\theta)$$ and are all labeled in the exact same way as $$G$$ on $$\mathrm{im}(\theta)$$.

More precisely, choose pairwise disjoint $$U_1,U_2,\ldots,U_t\subseteq V(G)\setminus\mathrm{im}(\theta)$$ at random and define $$p(F_1,\ldots,F_t;G)$$ to be the probability that the $$\sigma$$-flag $$(G[U_i\cup\mathrm{im}(\theta)],\theta)$$ is isomorphic to $$F_i$$ for all $$i\in[t]$$.

Note that, when embedding $$F$$ into $$G$$, where $$F,G$$ are $$\sigma$$-flags, it can be done by first embedding $$F$$ into a $$\sigma$$-flag $$F'$$ of size $$n\in[|F|,|G|]$$ and then embedding $$F'$$ into $$G$$, which gives the formula: $$p(F;G)=\sum_{F'\in \mathcal F^\sigma_n}p(F;F')p(F';G)$$. Extending this to sets of $$\sigma$$-flags gives the Chain Rule: "Theorem (Chain Rule): If $F_1,F_2,\ldots,F_t,G$ are $\sigma$-flags, $s,n$ are naturals such that $F_1,\ldots,F_t$ fit in $G$, $F_1,\ldots,F_s$ fit in a $\sigma$-flag of size $n$, and a $\sigma$-flag of size $n$ combined with $F_{s+1},\ldots,F_t$ fit in $G$, then $p(F_1,F_2,\ldots,F_t;G)=\sum_{F\in\mathcal F^\sigma_n}p(F_1,\ldots,F_s;F)p(F,F_{s+1},\ldots,F_t;G)$."

Recall that the previous proof for Mantel's involved linear combinations of terms of the form $$d(H,G)$$. The relevant ideas were slightly imprecise with letting $$|G|$$ tend to infinity, but explicitly there is a sequence $$G_1,G_2,\ldots$$ such that $$d(H,G_i)$$ converges to some $$\phi(H)$$ for all $$H$$, where $$\phi$$ is called a limit functional. Thus, all references to $$d(H,G)$$ really refer to the limit functional. Now, graph homomorphism inequalities can be written as linear combinations of $$\phi$$ with different $$H$$s, but it would be convenient to express them as a single term. This motivates defining $$\mathbb R\mathcal F^\sigma$$, the set of formal linear combinations of $$\sigma$$-flags over $$\mathbb R$$, and now $$\phi$$ can be extended to a linear function over $$\mathbb R\mathcal F^\sigma$$.

However, using the full space $$\mathbb R\mathcal F^\sigma$$ is wasteful when investigating just limit functionals, since there exist nontrivial relations between densities of certain $$\sigma$$-flags. In particular, the Chain Rule shows that "$\phi(F)=\phi\left(\sum_{F'\in\mathcal F^\sigma_n}p(F;F')F'\right)\implies F-\sum_{F'\in\mathcal F^\sigma_n}p(F;F')F'\in\ker\phi$" is always true. Rather than dealing with all of these elements of the kernel, let the set of expressions of the above form (i.e. those obtained from Chain Rule with a single $$\sigma$$-flag) as $$\mathcal K^\sigma$$ and quotient them out in our final analysis. These ideas combine to form the definition for a flag algebra: "Definition (Flag Algebras): A flag algebra is defined on the space of linear combinations of $\sigma$-flags $\mathcal A^\sigma = \mathbb R\mathcal F^\sigma/\mathcal K^\sigma$ equipped with bilinear operator $F\cdot G=\sum_{H\in \mathcal F^\sigma_n}p(F,G;H)H$" for $$F,G\in \mathcal F^\sigma$$ and any natural $$n$$ such that $$F,G$$ fit in a $$\sigma$$-flag of size $$n$$, extending the operator linearly to $$\mathbb R\mathcal F^\sigma$$. It remains to check that the choice of $$n$$ does not matter for a pair $$F,G$$ provided it is large enough (this can be proven with Chain Rule) as well as that if $$f\in \mathcal K^\sigma$$ then $$f\cdot g\in\mathcal K^\sigma$$, meaning that the operator respects the quotient and thus forms a well-defined algebra on the desired space.

One important result of this definition for the operator is that multiplication is respected on limit functionals. In particular, for a limit functional $$\phi$$, the identity $$\phi(f\cdot g)=\phi(f)\cdot\phi(g)$$ holds true. For example, it was shown that $$\phi(P_3^b)=\phi(K_2^b)^2$$ in our proof for Mantel's, and this result is just a corollary of this statement. More generally, the fact that $$\phi$$ is multiplicative means that all limit functionals are algebra homomorphisms between $$\mathcal A^\sigma$$ and $$\mathbb R$$.

The downward operator
The definition above provides a framework for dealing with $$\sigma$$-flags, which are partially labeled graphs. However, most of the time, unlabeled graphs, or $$\varnothing$$-flags, are of greatest interest. To get from the former to the latter, define the downward operator.

The downward operator is defined in the most natural way: given a $$\sigma$$-flag $$F$$, let $$\downarrow\!\!F$$ to be the $$\varnothing$$-flag resulting from forgetting the labels assigned to $$\sigma$$. Now, to define a natural mapping between $$\sigma$$-flags and unlabeled graphs, let $$q_\sigma(F)$$ be the probability that an injective map $$\theta:[k]\to V(F)$$ taken at random has image isomorphic to $$\sigma$$, and define $$[\![F]\!]_\sigma=q_\sigma(F)\downarrow\!\!F$$. Extending $$[\![\cdot]\!]$$ linearly to $$\mathbb R\mathcal F^\sigma$$ gives a valid linear map which sends combinations of $$\sigma$$-flags to combinations of unlabeled ones.

The most important result regarding $$[\![\cdot]\!]$$ is its averaging properties. In particular, fix a $$\sigma$$-flag $$F$$ and unlabeled graph $$G$$ with $$|G|\ge |F|$$, then choosing an embedding $$\theta$$ of $$\sigma$$ on $$G$$ at random defines random variable $$p(F;(G,\theta))$$. It can be shown that "$\mathbb E[p(F;(G,\theta)]=\frac{q_\sigma(F)p(\downarrow\!\!F;G)}{q_\sigma(\sigma)p(\downarrow\!\!\sigma;G)}.$"

Optimization with flag algebras
All linear functionals, $$\phi$$ are algebra homomorphisms $$\phi:\mathcal A^\sigma\to\mathbb R$$. Furthermore, by definition, $$\phi(F)\ge 0$$ for any $$\sigma$$-flag $$F$$ since $$\phi$$ represents a density limit. Thus, say that a homomorphism $$\psi\in\operatorname{Hom}(\mathcal A^\sigma,\mathbb R)$$ is positive if and only if $$\psi(F)\ge 0\forall F\in\mathcal F^\sigma$$, and let $$\operatorname{Hom}^+(A^\sigma,\mathbb R)$$ be the set of positive homomorphisms. One can show that the set of limit functionals $$\Phi$$ is exactly the set of positive homomorphisms $$\operatorname{Hom}^+(A^\sigma,\mathbb R)$$, so it suffices to understand the latter definition of the set.

In order for a linear combination $$f\in\mathcal A^\sigma$$ to yield a valid graph homomorphism inequality, it needs to be nonnegative over all possible linear functionals, which will then imply that it is true for all graphs. With this in mind, define the semantic cone of type $$\sigma$$, a set $$\mathcal S^\sigma\subset \mathcal A^\sigma$$ such that "$\mathcal S^\sigma=\{f\in \mathcal A^\sigma \mid \phi(f)\ge 0\,\,\,\forall \phi\in\operatorname{Hom}^+(\mathcal A^\sigma,\mathbb R)\}.$" Once again, $$\sigma=\varnothing$$ is the case of most interest, which corresponds to the case of unlabeled graphs. However, the downward operator has the property of mapping $$\mathcal S^\sigma$$ to $$\mathcal S^\varnothing$$, and it can be shown that the image of $$\mathcal S^\sigma$$ under $$[\![\cdot]\!]_\sigma$$ is a subset of $$\mathcal S^\varnothing$$, meaning that any results on the type $$\sigma$$ semantic cone readily generalize to unlabeled graphs as well.

Just by naively manipulating elements of $$\mathcal A^\sigma$$, numerous elements of the semantic cone $$\mathcal S^\sigma$$ can be generated. For example, since elements of $$\operatorname{Hom}^+(\mathcal A^\sigma,\mathbb R)$$ are nonnegative for $$\sigma$$-flags, any conical combination of elements of $$\mathcal F^\sigma$$ will yield an element of $$\mathcal S^\sigma$$. Perhaps more non-trivially, any conical combination of squares of elements of $$A^\sigma$$ will also yield an element of the semantic cone.

Though one can find squares of flags which sum to nontrivial results manually, it is often simpler to automate the process. In particular, it is possible to adapt the ideas in sum-of-squares optimization for polynomials to flag algebras. Define the degree of a vector $$f\in\mathbb R\mathcal F^\sigma$$ to be the largest flag with nonzero coefficient in the expansion of $$f$$, and let the degree of $$f^*\in\mathcal A^\sigma$$ to be the minimum degree of a vector over all choices in $$f^*+\mathcal K^\sigma$$. Also, define $$v_{\sigma,n}=\mathcal F^\sigma_n\to\mathcal A^\sigma$$ as the canonical embedding sending $$F$$ to itself for all $$F\in\mathcal F^\sigma_n$$. These definitions give rise to the following flag-algebra analogue: "\sigma" With this theorem, graph homomorphism problems can now be relaxed into semidefinite programming ones which can be solved via computer. For example, Mantel's Theorem can be rephrased as finding the smallest $$\lambda\in\mathbb R$$ such that $$\lambda\varnothing-K_2\in S^\varnothing$$. As $$S^\varnothing$$ is poorly understood, it is difficult to make progress on the question in this form, but note that conic combinations of $$\varnothing$$-flags and squares of vectors lie in $$S^\varnothing$$, so instead take a semidefinite relaxation. In particular, minimize $$\lambda$$ under the constraint that $$\lambda\varnothing-K_2=r+[\![v_{1,2}^\intercal Qv_{1,2}]\!]$$ where $$r$$ is a conic combination of $$\varnothing$$-flags and $$Q$$ is positive semi-definite. This new optimization problem can be transformed into a semidefinite-programming problem which is then solvable with standard algorithms.

Generalizations
The method of flag algebras readily generalizes to numerous graph-like constructs. As Razborov wrote in his original paper, flags can be described with finite model theory instead. Instead of graphs, models of some nondegenerate universal first-order theory $$T$$ with equality in a finite relational signature $$L$$ with only predicate symbols can be used. A model $$M$$, which replaces our previous notion of a graph, has ground set $$V(M)$$, whose elements are called vertices.

Now, defining sub-models and model embeddings in an analogous way to subgraphs and graph embeddings, all of the definitions and theorems above can be nearly directly translated into the language of model theory. The fact that the theory of flag algebras generalizes well means that it can be used not only to solve problems in simple graphs, but also similar constructs such as, but not limited to, directed graphs and hypergraphs.