Calculus on finite weighted graphs

In mathematics, calculus on finite weighted graphs is a discrete calculus for functions whose domain is the vertex set of a graph with a finite number of vertices and weights associated to the edges. This involves formulating discrete operators on graphs which are analogous to differential operators in calculus, such as graph Laplacians (or discrete Laplace operators) as discrete versions of the Laplacian, and using these operators to formulate differential equations, difference equations, or variational models on graphs which can be interpreted as discrete versions of partial differential equations or continuum variational models. Such equations and models are important tools to mathematically model, analyze, and process discrete information in many different research fields, e.g., image processing, machine learning, and network analysis.

In applications, finite weighted graphs represent a finite number of entities by the graph's vertices, any pairwise relationships between these entities by graph edges, and the significance of a relationship by an edge weight function. Differential equations or difference equations on such graphs can be employed to leverage the graph's structure for tasks such as image segmentation (where the vertices represent pixels and the weighted edges encode pixel similarity based on comparisons of Moore neighborhoods or larger windows), data clustering, data classification, or community detection in a social network (where the vertices represent users of the network, the edges represent links between users, and the weight function indicates the strength of interactions between users).

The main advantage of finite weighted graphs is that by not being restricted to highly regular structures such as discrete regular grids, lattice graphs, or meshes, they can be applied to represent abstract data with irregular interrelationships.

If a finite weighted graph is geometrically embedded in a Euclidean space, i.e., the graph vertices represent points of this space, then it can be interpreted as a discrete approximation of a related nonlocal operator in the continuum setting.

Basic definitions
A finite weighted graph $$G$$ is defined as a triple $$G = (V, E, w)$$ for which
 * $$V = \{x_1, \dots, x_n\}, n\in\mathbb{N}$$, is a finite set of indices denoted as graph vertices or nodes,
 * $$E \subset V \times V$$ is a finite set of (directed) graph edges connecting a subset of vertices,
 * $$w \colon E \rightarrow \mathbb{R}$$ is an edge weight function defined on the edges of the graph.

In a directed graph, each edge $$(x_i,x_j)\in E$$ has a start node $$x_i\in V$$ and an end node $$x_j\in V$$. In an undirected graph for every edge $$(x_i,x_j)$$ there exists an edge $$(x_j,x_i)$$ and the weight function is required to be symmetric, i.e., $$w(x_i,x_j) = w(x_j,x_i)$$. On the remainder of this page, the graphs will be assumed to be undirected, unless specifically stated otherwise. Many of the ideas presented on this page can be generalized to directed graphs.

The edge weight function $$w$$ associates to every edge $$(x_i,x_j) \in E$$ a real value $$w(x_i,x_j) > 0$$. For both mathematical and application specific reasons, the weight function on the edges is often required to be strictly positive and on this page it will be assumed to be so unless specifically stated otherwise. Generalizations of many of the ideas presented on this page to include negatively weighted edges are possible. Sometimes an extension of the domain of the edge weight function to $$V\times V$$ is considered (with the resulting function still being called the edge weight function) by setting $$w(x_i,x_j)=0$$ whenever $$(x_i,x_j) \not\in E$$.

In applications each graph vertex $$x \in V$$ usually represents a single entity in the given data, e.g., elements of a finite data set, pixels in an image, or users in a social network. A graph edge represents a relationship between two entities, e.g. pairwise interactions or similarity based on comparisons of geometric neighborhoods (for example of pixels in images) or of another feature, with the edge weight encoding the strength of this relationship. Most commonly used weight functions are normalized to map to values between 0 and 1, i.e., $$ w : E \rightarrow (0,1] $$.

In the following it is assumed that the considered graphs are connected without self-loops or multiple edges between vertices. These assumptions are mostly harmless as in many applications each connected component of a disconnected graph can be treated as a graph in its own right, each appearance of $$w(x_i,x_i)$$ (which would be nonzero in the presence of self-loops) appears in the presence of another factor which disappears when $$i=j$$ (see the section on differential graph operators below), and edge weights can encode similar information as multiple edges could.

Neighborhood
A node $$x_j \in V$$ is a neighbor of the node $$x_i \in V$$ if there exists an edge $$(x_i,x_j) \in E$$. In terms of notation this relationship can be abbreviated by $$x_j \sim x_i$$, which should be read as "$$x_j$$ is a neighbor of $$x_i$$". Otherwise, if $$x_j$$ is not a neighbor of $$x_i$$ one writes $$x_j\not\sim x_i$$. The neighborhood $$\mathcal N(x_i)$$ of a vertex $$x_i \in V$$ is simply the set of neighbors $$\mathcal{N}(x_i) := \{ x_j\in V \colon x_j \sim x_i \}$$. The degree of a vertex $$x_i \in V$$ is the weighted size of its neighborhood:


 * $$ \deg(x_i) := \sum_{j\,:\,x_j \sim x_i} w(x_i,x_j).$$

Note that in the special case where $$ w\equiv 1$$ on $$E$$ (i.e. the graph is unweighted) we have $$ \deg(x_i) := |\mathcal{N}(x_i)|$$.

Space of real vertex functions
Let $$\mathcal{H}(V) := \{f : V \rightarrow \mathbb{R} \}$$ be the space of (real) vertex functions. Since $$V$$ is a finite set, any vertex function $$f\in \mathcal{H}(V)$$ can be represented as a $$n$$-dimensional vector $$f \in \mathbb{R}^n$$ (where $$ n:= |V|$$) and hence the space of vertex functions $$\mathcal{H}(V)$$ can be identified with an $$n$$-dimensional Hilbert space: $$\mathcal{H}(V) \cong \mathbb{R}^n$$. The inner product of $$\mathcal{H}(V)$$ is defined as:


 * $$\langle f, g \rangle_{\mathcal{H}(V)} := \sum_{x_i \in V} f(x_i) g(x_i), \quad \forall f, g \in \mathcal{H}(V).$$

Furthermore, for any vertex function $$f \in \mathcal{H}(V)$$ the $$\ell_p$$-norm and $$\ell_\infty$$-norm of $$f$$ are defined as:


 * $$\|f\|_p = \begin{cases}

\left( \sum_{x_i\in V} |f(x_i)|^p \right)^\frac{1}{p}, &\text{ for } 1 \leqslant p < \infty \ ,\\ \max_{x_i\in V}|f(x_i)|,                              &\text{ for } p = \infty \. \end{cases}$$

The $$\ell_2$$-norm is induced by the inner product.

In applications vertex functions are useful to label the vertices of the nodes. For example, in graph-based data clustering, each node represents a data point and a vertex function is used to identify cluster membership of the nodes.

Space of real edge functions
Analogously to real vertex functions, one can introduce the space of real edge functions $$\mathcal{H}(E) := \{F:E \rightarrow \mathbb{R} \}$$. As any edge function $$F$$ is defined on a finite set of edges $$E$$, it can be represented as a $$m$$-dimensional vector $$F \in \mathbb{R}^{m}$$, where $$m := |E|$$. Hence, the space of edge functions $$\mathcal{H}(E)$$ can be identified as a $$m$$-dimensional Hilbert space, i.e., $$\mathcal{H}(E) \cong \mathbb{R}^{m}$$.

One special case of an edge function is the normalized edge weight function $$w \colon E \rightarrow (0, 1]$$ introduced above in the section on basic definitions. Similar to that function, any edge function $$F$$ can be trivially extended to $$V \times V$$ by setting $$F(x_i, x_j) := 0 $$ if $$(x_i, x_j) \not\in E$$. The space of those extended edge functions is still denoted by $$\mathcal{H}(E)$$ and can be identified with $$\mathbb{R}^m$$, where now $$m := |V|^2$$.

The inner product of $$\mathcal{H}(E)$$ is defined as:


 * $$ \langle F, G \rangle_{\mathcal{H}(E)} := \sum_{(x_i, x_j) \in E} F(x_i, x_j) G(x_i, x_j), \quad \forall F, G \in \mathcal{H}(E).$$

Additionally, for any edge function $$F \in \mathcal{H}(V)$$ the $$\ell_p$$-norm and $$\ell_\infty$$-norm of $$F$$ are defined as:


 * $$\|F\|_p = \begin{cases}

\left(\sum_{(x_i, x_j)\in E} |F(x_i, x_j)|^p\right)^\frac{1}{p} &\text{ for } 1 \leqslant p < \infty \ ,\\ \max_{(x_i, x_j) \in E}|F(x_i, x_j)|,                          &\text{ for } p = \infty \. \end{cases} $$

The $$\ell_2$$-norm is induced by the inner product.

If one extends the edge set $$E$$ in a way such that $$E = V \times V$$ than it becomes clear that $$\mathcal{H}(E) \cong \mathbb{R}^{n \times n}$$ because $$\mathcal{H}(V) \cong \mathbb{R}^n$$. This means that each edge function can be identified with a linear matrix operator.

Differential graph operators
An important ingredient in the calculus on finite weighted graphs is the mimicking of standard differential operators from the continuum setting in the discrete setting of finite weighted graphs. This allows one to translate well-studied tools from mathematics, such as partial differential equations and variational methods, and make them usable in applications which can best be modeled by a graph. The fundamental concept which makes this translation possible is the graph gradient, a first-order difference operator on graphs. Based on this one can derive higher-order difference operators, e.g., the graph Laplacian.

Weighted differences
Let $$G = (V,E,w)$$ be a finite weighted graph and let $$f\in \mathcal{H}(V)$$ be a vertex function. Then the weighted difference (or weighted graph derivative) of $$f$$ along a directed edge $$(x_i,x_j) \in E$$ is



\partial_{x_j}f(x_i) \ := \ \sqrt{w(x_i, x_j)}\left(f(x_j) - f(x_i)\right). $$

For any weighted difference the following properties hold:


 * $$\partial_{x_i}f(x_j) = -\partial_{x_j}f(x_i),$$
 * $$\partial_{x_i}f(x_i) = 0,$$
 * $$f(x_i) = f(x_j) \Rightarrow \partial_{x_j}f(x_i) = 0.$$

Weighted gradient
Based on the notion of weighted differences one defines the weighted gradient operator on graphs $$\nabla_w: \mathcal{H}(V) \rightarrow \mathcal{H}(E)$$ as



(\nabla_w f)(x_i, x_j) \ = \ \partial_{x_j}f(x_i). $$

This is a linear operator.

To measure the local variation of a vertex function $$f$$ in a vertex $$x_i \in V$$ one can restrict the gradient $$\nabla_w f$$ of $$f$$ to all directed edges starting in $$x_i$$ and using the $$\ell_p$$-norm of this edge function, i.e.,


 * $$\|(\nabla_w f)(x_i,\cdot)\|_{\ell_p} = \begin{cases}

\left(\sum_{x_j \sim x_i}w(x_i, x_j)^\frac{p}{2}|f(x_j) - f(x_i)|^p\right)^\frac{1}{p} &\text{ for } 1 \leq p < \infty,\\ \max_{x_j \sim x_i} \sqrt{w(x_i, x_j)}|f(x_j) - f(x_i)|                               &\text{ for } p = \infty. \end{cases}$$

Weighted divergence
The adjoint operator $$\nabla_w^*\colon\mathcal{H}(E)\rightarrow \mathcal{H}(V)$$ of the weighted gradient operator is a linear operator defined by



\langle \nabla_wf,G\rangle_{\mathcal{H}(E)} = \langle f,\nabla_w^*G\rangle_{\mathcal{H}(V)} \quad \text{ for all } f\in \mathcal{H}(V), G\in \mathcal{H}(E). $$

For undirected graphs with a symmetric weight function $$w \in \mathcal{H}(E)$$ the adjoint operator $$\nabla_w^*$$ of a function $$F\in \mathcal{H}(E)$$ at a vertex $$x_i\in V$$ has the following form:



\left(\nabla_w^*F\right)(x_i) \ = \ \frac{1}{2}\sum_{x_j\sim x_i}{\sqrt{w(x_i, x_j)}(F(x_j, x_i) - F(x_i, x_j))}. $$

One can then define the weighted divergence operator on graphs via the adjoint operator as $$\operatorname{div}_w := -\nabla_w^*$$. The divergence on a graph measures the net outflow of an edge function in each vertex of the graph.

Graph Laplace operator
The weighted graph Laplacian $$\Delta_w : \mathcal{H}(V) \rightarrow \mathcal{H}(V)$$ is a well-studied operator in the graph setting. Mimicking the relationship $$\operatorname{div}(\nabla f) = \Delta f$$ of the Laplace operator in the continuum setting, the weighted graph Laplacian can be derived for any vertex $$x_i \in V$$ as:


 * $$\begin{align}

(\operatorname{div}_w(\nabla_w f))(x_i) &= \frac{1}{2}\sum_{x_j \sim x_i}\sqrt{w(x_i, x_j)}(\nabla_w f(x_j, x_i) - \nabla_w f(x_i, x_j))\\ &= \frac{1}{2}\sum_{x_j \sim x_i}\sqrt{w(x_i, x_j)}\left(\sqrt{w(x_i, x_j)}(f(x_j) - f(x_i)) - \sqrt{w(x_j, x_i)}(f(x_i) - f(x_j))\right)\\ &= \frac{1}{2}\sum_{x_j \sim x_i}w(x_i, x_j)(2f(x_j) - 2f(x_i))\\ &= \sum_{x_j \sim x_i}w(x_i, x_j)(f(x_j) - f(x_i)) \ =: \ (\Delta_w f)(x_i). \end{align}$$

Note that one has to assume that the graph $$G$$ is undirected and has a symmetric weight function $$w(x_i, x_j) = w(x_j, x_i)$$ for this representation.

Graph p-Laplace operators
The continuous $$p$$-Laplace operator is a second-order differential operator that can be well-translated to finite weighted graphs. It allows the translation of various partial differential equations, e.g., the heat equation, to the graph setting.

Based on the first-order partial difference operators on graphs one can formally derive a family of weighted graph $$p$$-Laplace operators $$\Delta_{w,p} \colon \mathcal{H}(V) \rightarrow \mathcal{H}(V)$$ for $$1 \leq p < \infty $$ by minimization of the discrete $$p$$-Dirichlet energy functional



E(f) \ := \ \frac{1}{p} \sum_{x_i \in V} \|\nabla_w f(x_i,\cdot)\|_{\ell_p}^p. $$

The necessary optimality conditions for a minimizer of the energy functional $$E$$ lead to the following definition of the graph $$p$$-Laplacian:



(\Delta_{w,p} f)(x_i) \ := \ \sum_{x_j\sim x_i} w(x_i, x_j)^\frac{p}{2} |f(x_j) - f(x_i)|^{p-2} (f(x_j) - f(x_i)). $$

Note that the graph Laplace operator is a special case of the graph $$p$$-Laplace operator for $$p = 2$$, i.e.,



(\Delta_{w,2} f)(x_i) \ = \ (\Delta_w f)(x_i) \ = \ \sum_{x_j\sim x_i} w(x_i, x_j) (f(x_j) - f(x_i)). $$

Applications
Calculus on finite weighted graphs is used in a wide range of applications from different fields such as image processing, machine learning, and network analysis. A non-exhaustive list of tasks in which finite weighted graphs have been employed is:
 * image denoising
 * image segmentation
 * image inpainting
 * tomographic reconstruction
 * inverse problems
 * data clustering
 * point cloud compression
 * hand-written digit recognition