# Graphon

In graph theory and statistics, a graphon (also known as a graph limit) is a symmetric measurable function $W:[0,1]^{2}\to [0,1]$, that is important in the study of dense graphs. Graphons arise both as a natural notion for the limit of a sequence of dense graphs, and as the fundamental defining objects of exchangeable random graph models. Graphons are tied to dense graphs by the following pair of observations: the random graph models defined by graphons give rise to dense graphs almost surely, and, by the regularity lemma, graphons capture the structure of arbitrary large dense graphs.

## Statistical formulation

A graphon is a symmetric measurable function $W:[0,1]^{2}\to [0,1]$. Usually a graphon is understood as defining an exchangeable random graph model according to the following scheme:
* Each vertex $j$ of the graph is assigned an independent random value $u_{j}\sim U[0,1]$
* Edge $(i,j)$ is independently included in the graph with probability $W(u_{i},u_{j})$.
A random graph model is an exchangeable random graph model if and only if it can be defined in terms of a (possibly random) graphon in this way. The model based on a fixed graphon $W$ is sometimes denoted $\mathbb {G} (n,W)$, by analogy with the Erdős–Rényi model of random graphs. A graph generated from a graphon $W$ in this way is called a $W$-random graph.
It follows from this definition and the law of large numbers that, if $W\neq 0$, exchangeable random graph models are dense almost surely.

### Examples

The simplest example of a graphon is $W(x,y)\equiv p$ for some constant $p\in [0,1]$. In this case the associated exchangeable random graph model is the Erdős–Rényi model $G(n,p)$ that includes each edge independently with probability $p$.
If we instead start with a graphon that is piecewise constant by:
* dividing the unit square into $k\times k$ blocks, and
* setting $W$ equal to $p_{lm}$ on the $(\ell ,m)^{\text{th}}$ block,
the resulting exchangeable random graph model is the $k$ community stochastic block model, a generalization of the Erdős–Rényi model. We can interpret this as a random graph model consisting of $k$ distinct Erdős–Rényi graphs with parameters $p_{\ell \ell }$ respectively, with bigraphs between them where each possible edge between blocks $(\ell ,\ell )$ and $(m,m)$ is included independently with probability $p_{\ell m}$.
Many other popular random graph models can be understood as exchangeable random graph models defined by some graphon, a detailed survey is included in Orbanz and Roy.

### Jointly exchangeable adjacency matrices

A random graph of size $n$ can be represented as a random $n\times n$ adjacency matrix. In order to impose consistency (in the sense of projectivity) between random graphs of different sizes it is natural to study the sequence of adjacency matrices arising as the upper-left $n\times n$ sub-matrices of some infinite array of random variables; this allows us to generate $G_{n}$ by adding a node to $G_{n-1}$ and sampling the edges $(j,n)$ for $j<n$. With this perspective, random graphs are defined as random infinite symmetric arrays $(X_{ij})$.
Following the fundamental importance of exchangeable sequences in classical probability, it is natural to look for an analogous notion in the random graph setting. One such notion is given by jointly exchangeable matrices; i.e. random matrices satisfying
    $(X_{ij})\ {\overset {d}{=}}\,(X_{\sigma (i)\sigma (j)})$
for all permutations $\sigma$ of the natural numbers, where ${\overset {d}{=}}$ means equal in distribution. Intuitively, this condition means that the distribution of the random graph is unchanged by a relabeling of its vertices: that is, the labels of the vertices carry no information.
There is a representation theorem for jointly exchangeable random adjacency matrices, analogous to de Finetti’s representation theorem for exchangeable sequences. This is a special case of the Aldous–Hoover theorem for jointly exchangeable arrays and, in this setting, asserts that the random matrix $(X_{ij})$ is generated by:
* Sample $u_{j}\sim U[0,1]$ independently
* $X_{ij}=X_{ji}=1$ independently at random with probability $W(u_{i},u_{j}),$
where $W:[0,1]^{2}\to [0,1]$ is a (possibly random) graphon. That is, a random graph model has a jointly exchangeable adjacency matrix if and only if it is a jointly exchangeable random graph model defined in terms of some graphon.

### Graphon estimation

Due to identifiability issues, it is impossible to estimate either the graphon function $W$ or the node latent positions $u_{i},$ and there are two main directions of graphon estimation. One direction aims at estimating $W$up to an equivalence class, or estimate the probability matrix induced by $W$.

## Analytic formulation

Any graph on $n$ vertices $\{1,2,\dots ,n\}$ can be identified with its adjacency matrix $A_{G}$. This matrix corresponds to a step function $W_{G}:[0,1]^{2}\to [0,1]$, defined by partitioning $[0,1]$ into intervals $I_{1},I_{2},\dots ,I_{n}$ such that $I_{j}$ has interior $\left({\frac {j-1}{n}},{\frac {j}{n}}\right)$ and for each $(x,y)\in I_{i}\times I_{j}$, setting $W_{G}(x,y)$ equal to the $(i,j)^{\text{th}}$ entry of $A_{G}$. This function $W_{G}$ is the associated graphon of the graph $G$.
In general, if we have a sequence of graphs $(G_{n})$ where the number of vertices of $G_{n}$ goes to infinity, we can analyze the limiting behavior of the sequence by considering the limiting behavior of the functions $(W_{G_{n}})$. If these graphs converge (according to some suitable definition of convergence), then we expect the limit of these graphs to correspond to the limit of these associated functions.
This motivates the definition of a graphon (short for "graph function") as a symmetric measurable function $W:[0,1]^{2}\to [0,1]$ which captures the notion of a limit of a sequence of graphs. It turns out that for sequences of dense graphs, several apparently distinct notions of convergence are equivalent and under all of them the natural limit object is a graphon.

### Examples
#### Constant graphon

Take a sequence of $(G_{n})$ Erdős–Rényi random graphs $G_{n}=G(n,p)$ with some fixed parameter $p$. Intuitively, as $n$ tends to infinity, the limit of this sequence of graphs is determined solely by edge density of these graphs. In the space of graphons, it turns out that such a sequence converges almost surely to the constant $W(x,y)\equiv p$, which captures the above intuition.

#### Half graphon

Take the sequence $(H_{n})$ of half-graphs, defined by taking $H_{n}$ to be the bipartite graph on $2n$ vertices $u_{1},u_{2},\dots ,u_{n}$ and $v_{1},v_{2},\dots ,v_{n}$ such that $u_{i}$ is adjacent to $v_{j}$ precisely when $i\leq j$. If the vertices are listed in the presented order, then the adjacency matrix $A_{H_{n}}$ has two corners of "half square" block matrices filled with ones, with the rest of the entries equal to zero. For example, the adjacency matrix of $H_{3}$ is given by
${\begin{bmatrix}0&0&0&1&1&1\\0&0&0&0&1&1\\0&0&0&0&0&1\\1&0&0&0&0&0\\1&1&0&0&0&0\\1&1&1&0&0&0\end{bmatrix}}.$
As $n$ gets large, these corners of ones "smooth" out. Matching this intuition, the sequence $(H_{n})$ converges to the half-graphon $W$ defined by $W(x,y)=1$ when $|x-y|\geq 1/2$ and $W(x,y)=0$ otherwise.

#### Complete bipartite graphon

Take the sequence $(K_{n,n})$ of complete bipartite graphs with equal sized parts. If we order the vertices by placing all vertices in one part at the beginning and placing the vertices of the other part at the end, the adjacency matrix of $(K_{n,n})$ looks like a block off-diagonal matrix, with two blocks of ones and two blocks of zeros. For example, the adjacency matrix of $K_{2,2}$ is given by
${\begin{bmatrix}0&0&1&1\\0&0&1&1\\1&1&0&0\\1&1&0&0\end{bmatrix}}.$
As $n$ gets larger, this block structure of the adjacency matrix remains constant, so that this sequence of graphs converges to a "complete bipartite" graphon $W$ defined by $W(x,y)=1$ whenever $\min(x,y)\leq 1/2$ and $\max(x,y)>1/2$, and setting $W(x,y)=0$ otherwise.
If we instead order the vertices of $K_{n,n}$ by alternating between parts, the adjacency matrix has a chessboard structure of zeros and ones. For example, under this ordering, the adjacency matrix of $K_{2,2}$ is given by
${\begin{bmatrix}0&1&0&1\\1&0&1&0\\0&1&0&1\\1&0&1&0\end{bmatrix}}.$
As $n$ gets larger, the adjacency matrices become a finer and finer chessboard. Despite this behavior, we still want the limit of $(K_{n,n})$ to be unique and result in the graphon from example 3. This means that when we formally define convergence for a sequence of graphs, the definition of a limit should be agnostic to relabelings of the vertices.

#### Limit of W-random graphs

Take a random sequence $(G_{n})$ of $W$-random graphs by drawing $G_{n}\sim \mathbb {G} (n,W)$ for some fixed graphon $W$. Then just like in the first example from this section, it turns out that $(G_{n})$ converges to $W$ almost surely.

### Recovering graph parameters from graphons

Given graph $G$ with associated graphon $W=W_{G}$, we can recover graph theoretic properties and parameters of $G$ by integrating transformations of $W$. For example, the edge density (i.e. average degree divided by number of vertices) of $G$ is given by the integral $\int _{0}^{1}\int _{0}^{1}W(x,y)\;\mathrm {d} x\,\mathrm {d} y.$ This is because $W$ is $\{0,1\}$-valued, and each edge $(i,j)$ in $G$ corresponds to a region $I_{i}\times I_{j}$ of area $1/n^{2}$ where $W$ equals $1$.
Similar reasoning shows that the triangle density in $G$ is equal to ${\frac {1}{6}}\int _{0}^{1}\int _{0}^{1}\int _{0}^{1}W(x,y)W(y,z)W(z,x)\;\mathrm {d} x\,\mathrm {d} y\,\mathrm {d} z.$

### Notions of convergence

There are many different ways to measure the distance between two graphs. If we are interested in metrics that "preserve" extremal properties of graphs, then we should restrict our attention to metrics that identify random graphs as similar. For example, if we randomly draw two graphs independently from an Erdős–Rényi model $G(n,p)$ for some fixed $p$, the distance between these two graphs under a "reasonable" metric should be close to zero with high probability for large $n$.
Naively, given two graphs on the same vertex set, one might define their distance as the number of edges that must be added or removed to get from one graph to the other, i.e. their . However, the edit distance does not identify random graphs as similar; in fact, two graphs drawn independently from $G(n,{\tfrac {1}{2}})$ have an expected (normalized) edit distance of ${\tfrac {1}{2}}$.
There are two natural metrics that behave well on dense random graphs in the sense that we want. The first is a sampling metric, which says that two graphs are close if their distributions of subgraphs are close. The second is an edge discrepancy metric, which says two graphs are close when their edge densities are close on all their corresponding subsets of vertices.
Miraculously, a sequence of graphs converges with respect to one metric precisely when it converges with respect to the other. Moreover, the limit objects under both metrics turn out to be graphons. The equivalence of these two notions of convergence mirrors how various notions of quasirandom graphs are equivalent.

#### Homomorphism densities

One way to measure the distance between two graphs $G$ and $H$ is to compare their relative subgraph counts. That is, for each graph $F$ we can compare the number of copies of $F$ in $G$ and $F$ in $H$. If these numbers are close for every graph $F$, then intuitively $G$ and $H$ are similar looking graphs. Rather than dealing directly with subgraphs, however, it turns out to be easier to work with graph homomorphisms. This is fine when dealing with large, dense graphs, since in this scenario the number of subgraphs and the number of graph homomorphisms from a fixed graph are asymptotically equal.
Given two graphs $F$ and $G$, the homomorphism density $t(F,G)$ of $F$ in $G$ is defined to be the number of graph homomorphisms from $F$ to $G$. In other words, $t(F,G)$ is the probability a randomly chosen map from the vertices of $F$ to the vertices of $G$ sends adjacent vertices in $F$ to adjacent vertices in $G$.
Graphons offer a simple way to compute homomorphism densities. Indeed, given a graph $G$ with associated graphon $W_{G}$ and another $F$, we have
$t(F,G)=\int \prod _{(i,j)\in E(F)}W_{G}(x_{i},x_{j})\;\left\{\mathrm {d} x_{i}\right\}_{i\in V(F)}$
where the integral is multidimensional, taken over the unit hypercube $[0,1]^{V(F)}$. This follows from the definition of an associated graphon, by considering when the above integrand is equal to $1$. We can then extend the definition of homomorphism density to arbitrary graphons $W$, by using the same integral and defining
$t(F,W)=\int \prod _{(i,j)\in E(F)}W(x_{i},x_{j})\;\left\{\mathrm {d} x_{i}\right\}_{i\in V(F)}$
for any graph $F$.
Given this setup, we say a sequence of graphs $(G_{n})$ is left-convergent if for every fixed graph $F$, the sequence of homomorphism densities $\left(t(F,G_{n})\right)$ converges. Although not evident from the definition alone, if $(G_{n})$ converges in this sense, then there always exists a graphon $W$ such that for every graph $F$, we have $\lim _{n\to \infty }t(F,G_{n})=t(F,W)$ simultaneously.

#### Cut distance

Take two graphs $G$ and $H$ on the same vertex set. Because these graphs share the same vertices, one way to measure their distance is to restrict to subsets $X,Y$ of the vertex set, and for each such pair of subsets compare the number of edges $e_{G}(X,Y)$ from $X$ to $Y$ in $G$ to the number of edges $e_{H}(X,Y)$ between $X$ and $Y$ in $H$. If these numbers are similar for every pair of subsets (relative to the total number of vertices), then that suggests $G$ and $H$ are similar graphs.
As a preliminary formalization of this notion of distance, for any pair of graphs $G$ and $H$ on the same vertex set $V$ of size $|V|=n$, define the labeled cut distance between $G$ and $H$ to be
$d_{\square }(G,H)={\frac {1}{n^{2}}}\max _{X,Y\subseteq V}\left|e_{G}(X,Y)-e_{H}(X,Y)\right|.$
In other words, the labeled cut distance encodes the maximum discrepancy of the edge densities between $G$ and $H$. We can generalize this concept to graphons by expressing the edge density ${\tfrac {1}{n^{2}}}e_{G}(X,Y)$ in terms of the associated graphon $W_{G}$, giving the equality
$d_{\square }(G,H)=\max _{X,Y\subseteq V}\left|\int _{I_{X}}\int _{I_{Y}}W_{G}(x,y)-W_{H}(x,y)\;\mathrm {d} x\,\mathrm {d} y\right|$
where $I_{X},I_{Y}\subseteq [0,1]$ are unions of intervals corresponding to the vertices in $X$ and $Y$. Note that this definition can still be used even when the graphs being compared do not share a vertex set. This motivates the following more general definition.
   Definition 1. For any symmetric, measurable function $f:[0,1]^{2}\to \mathbb {R}$, define the cut norm of $f$ to be the quantity
   $\lVert f\rVert _{\square }=\sup _{S,T\subseteq [0,1]}\left|\int _{S}\int _{T}f(x,y)\;\mathrm {d} x\,\mathrm {d} y\right|$ taken over all measurable subsets $S,T$ of the unit interval.
This captures our earlier notion of labeled cut distance, as we have the equality $\lVert W_{G}-W_{H}\rVert _{\square }=d_{\square }(G,H)$.
This distance measure still has one major limitation: it can assign nonzero distance to two isomorphic graphs. To make sure isomorphic graphs have distance zero, we should compute the minimum cut norm over all possible "relabellings" of the vertices. This motivates the following definition of the cut distance.
   Definition 2. For any pair of graphons $U$ and $W$, define their cut distance to be
   $\delta _{\square }(U,W)=\inf _{\varphi }\lVert U-W^{\varphi }\rVert _{\square }$ where $W^{\varphi }(x,y)=W(\varphi (x),\varphi (y))$ is the composition of $W$ with the map $\varphi$, and the infimum is taken over all measure-preserving bijections from the unit interval to itself.
The cut distance between two graphs is defined to be the cut distance between their associated graphons.
We now say that a sequence of graphs $(G_{n})$ is convergent under the cut distance if it is a Cauchy sequence under the cut distance $\delta _{\square }$. Although not a direct consequence of the definition, if such a sequence of graphs is Cauchy, then it always converges to some graphon $W$.

#### Equivalence of convergence

As it turns out, for any sequence of graphs $(G_{n})$, left-convergence is equivalent to convergence under the cut distance, and furthermore, the limit graphon $W$ is the same. We can also consider convergence of graphons themselves using the same definitions, and the same equivalence is true. In fact, both notions of convergence are related more strongly through what are called counting lemmas.
   Counting Lemma. For any pair of graphons $U$ and $W$, we have
   $|t(F,U)-t(F,W)|\leq e(F)\delta _{\square }(U,W)$ for all graphs $F$.
The name "counting lemma" comes from the bounds that this lemma gives on homomorphism densities $t(F,W)$, which are analogous to subgraph counts of graphs. This lemma is a generalization of the graph counting lemma that appears in the field of regularity partitions, and it immediately shows that convergence under the cut distance implies left-convergence.
   Inverse Counting Lemma. For every real number $\varepsilon >0$, there exist a real number $\eta >0$ and a positive integer $k$ such that for any pair of graphons $U$ and $W$ with
   $|t(F,U)-t(F,W)|\leq \eta$ for all graphs $F$ satisfying $v(F)\leq k$, we must have $\delta _{\square }(U,W)<\varepsilon$.
This lemma shows that left-convergence implies convergence under the cut distance.

### The space of graphons

We can make the cut-distance into a metric by taking the set of all graphons and identifying two graphons $U\sim W$ whenever $\delta _{\square }(U,W)=0$. The resulting space of graphons is denoted ${\widetilde {\mathcal {W}}}_{0}$, and together with $\delta _{\square }$ forms a metric space.
This space turns out to be compact. Moreover, it contains the set of all finite graphs, represented by their associated graphons, as a dense subset. These observations show that the space of graphons is a completion of the space of graphs with respect to the cut distance. One immediate consequence of this is the following.
   Corollary 1. For every real number $\varepsilon >0$, there is an integer $N$ such that for every graphon $W$, there is a graph $G$ with at most $N$ vertices such that $\delta _{\square }(W,W_{G})<\varepsilon$.
To see why, let ${\mathcal {G}}$ be the set of graphs. Consider for each graph $G\in {\mathcal {G}}$ the open ball $B_{\square }(G,\varepsilon )$ containing all graphons $W$ such that $\delta _{\square }(W,W_{G})<\varepsilon$. The set of open balls for all graphs covers ${\widetilde {\mathcal {W}}}_{0}$, so compactness implies that there is a finite subcover $\{B_{\square }(G,\varepsilon )\mid G\in {\mathcal {G}}_{0}\}$ for some finite subset ${\mathcal {G}}_{0}\subset {\mathcal {G}}$. We can now take $N$ to be the largest number of vertices among the graphs in ${\mathcal {G}}_{0}$.

## Applications
### Regularity lemma

Compactness of the space of graphons $({\widetilde {\mathcal {W}}}_{0},\delta _{\square })$ can be thought of as an analytic formulation of Szemerédi's regularity lemma; in fact, a stronger result than the original lemma. Szemeredi's regularity lemma can be translated into the language of graphons as follows. Define a step function to be a graphon $W$ that is piecewise constant, i.e. for some partition ${\mathcal {P}}$ of $[0,1]$, $W$ is constant on $S\times T$ for all $S,T\in {\mathcal {P}}$. The statement that a graph $G$ has a regularity partition is equivalent to saying that its associated graphon $W_{G}$ is close to a step function.
The proof of compactness requires only the weak regularity lemma:
   Weak Regularity Lemma for Graphons. For every graphon $W$ and $\varepsilon >0$, there is a step function $W'$ with at most $\lceil 4^{1/\varepsilon ^{2}}\rceil$ steps such that $\lVert W-W'\rVert _{\square }\leq \varepsilon$.
but it can be used to prove stronger regularity results, such as the strong regularity lemma:
   Strong Regularity Lemma for Graphons. For every sequence $\mathbf {\varepsilon } =(\varepsilon _{0},\varepsilon _{1},\dots )$ of positive real numbers, there is a positive integer $S$ such that for every graphon $W$, there is a graphon $W'$ and a step function $U$ with $k<S$ steps such that $\lVert W-W'\rVert _{1}\leq \varepsilon _{0}$ and $\lVert W'-U\rVert _{\square }\leq \varepsilon _{k}.$
The proof of the strong regularity lemma is similar in concept to Corollary 1 above. It turns out that every graphon $W$ can be approximated with a step function $U$ in the $L_{1}$ norm, showing that the set of balls $B_{1}(U,\varepsilon _{0})$ cover ${\widetilde {\mathcal {W}}}_{0}$. These sets are not open in the $\delta _{\square }$ metric, but they can be enlarged slightly to be open. Now, we can take a finite subcover, and one can show that the desired condition follows.

### Sidorenko's conjecture

The analytic nature of graphons allows greater flexibility in attacking inequalities related to homomorphisms.
For example, Sidorenko's conjecture is a major open problem in extremal graph theory, which asserts that for any graph $G$ on $n$ vertices with average degree $pn$ (for some $p\in [0,1]$) and bipartite graph $H$ on $v$ vertices and $e$ edges, the number of homomorphisms from $H$ to $G$ is at least $p^{e}n^{v}$. Since this quantity is the expected number of labeled subgraphs of $H$ in a random graph $G(n,p)$, the conjecture can be interpreted as the claim that for any bipartite graph $H$, the random graph achieves (in expectation) the minimum number of copies of $H$ over all graphs with some fixed edge density.
Many approaches to Sidorenko's conjecture formulate the problem as an integral inequality on graphons, which then allows the problem to be attacked using other analytical approaches.

## Generalizations

Graphons are naturally associated with dense simple graphs. There are extensions of this model to dense directed weighted graphs, often referred to as decorated graphons. There are also recent extensions to the sparse graph regime, from both the perspective of random graph models and graph limit theory.