Discrete Laplace operator

In mathematics, the discrete Laplace operator is an analog of the continuous Laplace operator, defined so that it has meaning on a graph or a discrete grid. For the case of a finite-dimensional graph (having a finite number of edges and vertices), the discrete Laplace operator is more commonly called the Laplacian matrix.

The discrete Laplace operator occurs in physics problems such as the Ising model and loop quantum gravity, as well as in the study of discrete dynamical systems. It is also used in numerical analysis as a stand-in for the continuous Laplace operator. Common applications include image processing, where it is known as the Laplace filter, and in machine learning for clustering and semi-supervised learning on neighborhood graphs.

Graph Laplacians
There are various definitions of the discrete Laplacian for graphs, differing by sign and scale factor (sometimes one averages over the neighboring vertices, other times one just sums; this makes no difference for a regular graph). The traditional definition of the graph Laplacian, given below, corresponds to the negative continuous Laplacian on a domain with a free boundary.

Let $$G = (V,E)$$ be a graph with vertices $$V$$ and edges $$E$$. Let $$\phi\colon V\to R$$ be a function of the vertices taking values in a ring. Then, the discrete Laplacian $$\Delta$$ acting on $$\phi$$ is defined by


 * $$(\Delta \phi)(v)=\sum_{w:\,d(w,v)=1}\left[\phi(v)-\phi(w)\right]$$

where $$d(w,v)$$ is the graph distance between vertices w and v. Thus, this sum is over the nearest neighbors of the vertex v. For a graph with a finite number of edges and vertices, this definition is identical to that of the Laplacian matrix. That is, $$ \phi$$ can be written as a column vector; and so $$\Delta\phi$$ is the product of the column vector and the Laplacian matrix, while $$(\Delta \phi)(v)$$ is just the v'th entry of the product vector.

If the graph has weighted edges, that is, a weighting function $$\gamma\colon E\to R$$ is given, then the definition can be generalized to


 * $$(\Delta_\gamma\phi)(v)=\sum_{w:\,d(w,v)=1}\gamma_{wv}\left[\phi(v)-\phi(w)\right]$$

where $$\gamma_{wv}$$ is the weight value on the edge $$wv\in E$$.

Closely related to the discrete Laplacian is the averaging operator:


 * $$(M\phi)(v)=\frac{1}{\deg v}\sum_{w:\,d(w,v)=1}\phi(w).$$

Mesh Laplacians
In addition to considering the connectivity of nodes and edges in a graph, mesh Laplace operators take into account the geometry of a surface (e.g. the angles at the nodes). For a two-dimensional manifold triangle mesh, the Laplace-Beltrami operator of a scalar function $$u$$ at a vertex $$i$$ can be approximated as



(\Delta u)_{i} \equiv \frac{1}{2A_i} \sum_{j} (\cot \alpha_{ij} + \cot \beta_{ij}) (u_j - u_i), $$

where the sum is over all adjacent vertices $$j$$ of $$i$$, $$\alpha_{ij}$$ and $$\beta_{ij}$$ are the two angles opposite of the edge $$ij$$, and $$A_i$$ is the vertex area of $$i$$; that is, e.g. one third of the summed areas of triangles incident to $$i$$. It is important to note that the sign of the discrete Laplace-Beltrami operator is conventionally opposite the sign of the ordinary Laplace operator. The above cotangent formula can be derived using many different methods among which are piecewise linear finite elements, finite volumes, and discrete exterior calculus (PDF download: ).

To facilitate computation, the Laplacian is encoded in a matrix $$L\in\mathbb{R}^{|V|\times|V|}$$ such that $$ Lu = (\Delta u)_i $$. Let $$C$$ be the (sparse) cotangent matrix with entries

$$ C_{ij} = \begin{cases} \frac{1}{2}(\cot \alpha_{ij} + \cot \beta_{ij}) & ij \text{ is an edge, that is } j \in N(i), \\ -\sum\limits_{k \in N(i)}C_{ik} & i = j, \\ 0 & \text{otherwise} \end{cases} $$

Where $$N(i) $$ denotes the neighborhood of $$ i$$.

And let $$ M $$ be the diagonal mass matrix $$ M $$ whose $$i$$-th entry along the diagonal is the vertex area $$ A_i $$. Then $$ L=M^{-1}C $$ is the sought discretization of the Laplacian.

A more general overview of mesh operators is given in.

Finite differences
Approximations of the Laplacian, obtained by the finite-difference method or by the finite-element method, can also be called discrete Laplacians. For example, the Laplacian in two dimensions can be approximated using the five-point stencil finite-difference method, resulting in


 * $$ \Delta f(x,y) \approx \frac{f(x-h,y) + f(x+h,y) + f(x,y-h) + f(x,y+h) - 4f(x,y)}{h^2}, $$

where the grid size is h in both dimensions, so that the five-point stencil of a point (x, y) in the grid is


 * $$\{(x-h, y), (x, y), (x+h, y), (x, y-h), (x, y+h)\}.$$

If the grid size h = 1, the result is the negative discrete Laplacian on the graph, which is the square lattice grid. There are no constraints here on the values of the function f(x, y) on the boundary of the lattice grid, thus this is the case of no source at the boundary, that is, a no-flux boundary condition (aka, insulation, or homogeneous Neumann boundary condition). The control of the state variable at the boundary, as f(x, y) given on the boundary of the grid (aka, Dirichlet boundary condition), is rarely used for graph Laplacians, but is common in other applications.

Multidimensional discrete Laplacians on rectangular cuboid regular grids have very special properties, e.g., they are Kronecker sums of one-dimensional discrete Laplacians, see Kronecker sum of discrete Laplacians, in which case all its eigenvalues and eigenvectors can be explicitly calculated.

Finite-element method
In this approach, the domain is discretized into smaller elements, often triangles or tetrahedra, but other elements such as rectangles or cuboids are possible. The solution space is then approximated using so called form-functions of a pre-defined degree. The differential equation containing the Laplace operator is then transformed into a variational formulation, and a system of equations is constructed (linear or eigenvalue problems). The resulting matrices are usually very sparse and can be solved with iterative methods.

Image processing
Discrete Laplace operator is often used in image processing e.g. in edge detection and motion estimation applications. The discrete Laplacian is defined as the sum of the second derivatives Laplace operator and calculated as sum of differences over the nearest neighbours of the central pixel. Since derivative filters are often sensitive to noise in an image, the Laplace operator is often preceded by a smoothing filter (such as a Gaussian filter) in order to remove the noise before calculating the derivative. The smoothing filter and Laplace filter are often combined into a single filter.

Implementation via operator discretization
For one-, two- and three-dimensional signals, the discrete Laplacian can be given as convolution with the following kernels:
 * 1D filter: $$\vec{D}^2_x=\begin{bmatrix}1 & -2 & 1\end{bmatrix}$$,
 * 2D filter: $$\mathbf{D}^2_{xy}=\begin{bmatrix}0 & 1 & 0\\1 & -4 & 1\\0 & 1 & 0\end{bmatrix}$$.

$$\mathbf{D}^2_{xy}$$ corresponds to the (Five-point stencil) finite-difference formula seen previously. It is stable for very smoothly varying fields, but for equations with rapidly varying solutions more stable and isotropic form of the Laplacian operator is required, such as the nine-point stencil, which includes the diagonals:


 * 2D filter: $$\mathbf{D}^2_{xy}=\begin{bmatrix}0.25 & 0.5 & 0.25\\0.5 & -3 & 0.5\\0.25 & 0.5 & 0.25\end{bmatrix}$$,
 * 3D filter: $$\mathbf{D}^2_{xyz}$$ using seven-point stencil is given by:
 * first plane = $$\begin{bmatrix}0 & 0 & 0\\0 & 1 & 0\\0 & 0 & 0\end{bmatrix}$$; second plane = $$\begin{bmatrix}0 & 1 & 0\\1 & -6 & 1\\0 & 1 & 0\end{bmatrix}$$; third plane = $$\begin{bmatrix}0 & 0 & 0\\0 & 1 & 0\\0 & 0 & 0\end{bmatrix}$$.
 * and using 27-point stencil by:
 * first plane = $$\frac{1}{26}\begin{bmatrix}2 & 3 & 2\\3 & 6 & 3\\2 & 3 & 2\end{bmatrix}$$; second plane = $$\frac{1}{26}\begin{bmatrix}3 & 6 & 3\\6 & -88 & 6\\3 & 6 & 3\end{bmatrix}$$; third plane = $$\frac{1}{26}\begin{bmatrix}2 & 3 & 2\\3 & 6 & 3\\2 & 3 & 2\end{bmatrix}$$.
 * nD filter: For the element $$a_{x_1, x_2, \dots, x_n}$$ of the kernel $$\mathbf{D}^2_{x_1, x_2, \dots , x_n},$$
 * $$a_{x_1, x_2, \dots, x_n} = \left\{\begin{array}{ll}

-2n & \text{if } s = n, \\ 1 & \text{if } s = n - 1, \\ 0 & \text{otherwise,} \end{array}\right.$$
 * where $xi$ is the position (either $−1$, $0$ or $1$) of the element in the kernel in the i-th direction, and $s$ is the number of directions $i$ for which $xi = 0$.

Note that the nD version, which is based on the graph generalization of the Laplacian, assumes all neighbors to be at an equal distance, and hence leads to the following 2D filter with diagonals included, rather than the version above:
 * 2D filter: $$\mathbf{D}^2_{xy}=\begin{bmatrix}1 & 1 & 1\\1 & -8 & 1\\1 & 1 & 1\end{bmatrix}.$$

These kernels are deduced by using discrete differential quotients.

It can be shown that the following discrete approximation of the two-dimensional Laplacian operator as a convex combination of difference operators


 * $$\nabla^2_{\gamma}= (1 - \gamma) \nabla^2_{5} + \gamma \nabla ^2_{\times}

= (1 - \gamma) \begin{bmatrix}0 & 1 & 0\\1 & -4 & 1\\0 & 1 & 0\end{bmatrix} + \gamma \begin{bmatrix}1/2 & 0 & 1/2\\0 & -2 & 0\\1/2 & 0 & 1/2\end{bmatrix} $$

for γ ∈ [0, 1] is compatible with discrete scale-space properties, where specifically the value γ = 1/3 gives the best approximation of rotational symmetry. Regarding three-dimensional signals, it is shown that the Laplacian operator can be approximated by the two-parameter family of difference operators



\nabla^2_{\gamma_1,\gamma_2} = (1 - \gamma_1 - \gamma_2) \, \nabla_7^2 + \gamma_1 \, \nabla_{+^3}^2 +  \gamma_2 \, \nabla_{\times^3}^2 ), $$

where



(\nabla_7^2 f)_{0, 0, 0} =       f_{-1, 0, 0} + f_{+1, 0, 0} + f_{0, -1, 0} + f_{0, +1, 0} + f_{0, 0, -1} + f_{0, 0, +1} - 6 f_{0, 0, 0}, $$

(\nabla_{+^3}^2 f)_{0, 0, 0} = \frac{1}{4} (f_{-1, -1, 0} + f_{-1, +1, 0} + f_{+1, -1, 0} + f_{+1, +1, 0}        + f_{-1, 0, -1} + f_{-1, 0, +1} + f_{+1, 0, -1} + f_{+1, 0, +1}         + f_{0, -1, -1} + f_{0, -1, +1} + f_{0, +1, -1} + f_{0, +1, +1}          - 12 f_{0, 0, 0}), $$

(\nabla_{\times^3}^2 f)_{0, 0, 0} = \frac{1}{4} (f_{-1, -1, -1} + f_{-1, -1, +1} + f_{-1, +1, -1} + f_{-1, +1, +1}        + f_{+1, -1, -1} + f_{+1, -1, +1} + f_{+1, +1, -1} + f_{+1, +1, +1}           -  8 f_{0, 0, 0}). $$

Implementation via continuous reconstruction
A discrete signal, comprising images, can be viewed as a discrete representation of a continuous function $$f(\bar r)$$, where the coordinate vector $$\bar r \in R^n $$ and the value domain is real $$f\in R$$. Derivation operation is therefore directly applicable to the continuous function, $$f$$. In particular any discrete image, with reasonable presumptions on the discretization process, e.g. assuming band limited functions, or wavelets expandable functions, etc. can be reconstructed by means of well-behaving interpolation functions underlying the reconstruction formulation,

f(\bar r)=\sum_{k\in K}f_k \mu_k(\bar r) $$ where $$f_k\in R$$ are discrete representations of $$f$$ on grid $$K$$ and $$\mu_k $$ are interpolation functions specific to the grid $$K$$. On a uniform grid, such as images, and for bandlimited functions,   interpolation functions are shift invariant amounting to  $$\mu_k(\bar r)= \mu(\bar r-\bar r_k) $$ with $$\mu $$ being an appropriately dilated sinc function defined in $$n$$-dimensions i.e. $$\bar r=(x_1,x_2...x_n)^T$$. Other approximations of $$\mu$$ on uniform grids, are appropriately dilated Gaussian functions in $$n$$-dimensions. Accordingly, the discrete Laplacian becomes a discrete version of the Laplacian of the continuous $$f(\bar r)$$

\nabla^2 f(\bar r_k)= \sum_{k'\in K}f_{k'} (\nabla^2 \mu(\bar r-\bar r_{k'}))|_{\bar r= \bar r_k} $$ which in turn is a convolution with the Laplacian of the interpolation function on the uniform (image) grid $$K$$. An advantage of using Gaussians as interpolation functions is that they yield linear operators, including Laplacians, that are free from rotational artifacts of the coordinate frame in which $$f$$ is represented via $$f_k$$, in $$n$$-dimensions, and are frequency aware by definition. A linear operator has not only a limited range in the $$\bar r$$ domain but also an effective range in the frequency domain (alternatively Gaussian scale space) which can be controlled explicitly via the variance of the Gaussian in a principled manner. The resulting filtering can be implemented by separable filters and decimation (signal processing)/pyramid (image processing) representations for further computational efficiency in $$n$$-dimensions. In other words, the discrete Laplacian filter of any size can be generated conveniently as the sampled Laplacian of Gaussian with spatial size befitting the needs of a particular application as controlled by its variance. Monomials which are non-linear operators can also be implemented using a similar reconstruction and approximation approach provided that the signal is sufficiently over-sampled. Thereby, such non-linear operators e.g. Structure Tensor, and Generalized Structure Tensor which are used in pattern recognition for their total least-square optimality in orientation estimation, can be realized.

Spectrum
The spectrum of the discrete Laplacian on an infinite grid is of key interest; since it is a self-adjoint operator, it has a real spectrum. For the convention $$\Delta = I - M$$ on $$Z$$, the spectrum lies within $$[0,2]$$ (as the averaging operator has spectral values in $$[-1,1]$$). This may also be seen by applying the Fourier transform. Note that the discrete Laplacian on an infinite grid has purely absolutely continuous spectrum, and therefore, no eigenvalues or eigenfunctions.

Theorems
If the graph is an infinite square lattice grid, then this definition of the Laplacian can be shown to correspond to the continuous Laplacian in the limit of an infinitely fine grid. Thus, for example, on a one-dimensional grid we have


 * $$\frac{\partial^2F}{\partial x^2} =

\lim_{\epsilon \rightarrow 0} \frac{[F(x+\epsilon)-F(x)]-[F(x)-F(x-\epsilon)]}{\epsilon^2}. $$

This definition of the Laplacian is commonly used in numerical analysis and in image processing. In image processing, it is considered to be a type of digital filter, more specifically an edge filter, called the Laplace filter.

Discrete heat equation
Suppose $\phi$ describes a temperature distribution across a graph, where $\phi_i$  is the temperature at vertex $i$. According to Newton's law of cooling, the heat transferred from node $i$ to node $j$  is proportional to $\phi_i - \phi_j$  if nodes $i$  and $j$  are connected (if they are not connected, no heat is transferred). Then, for thermal conductivity $k$ ,


 * $$\begin{align}

\frac{d \phi_i}{d t}   &= -k \sum_j A_{ij} \left(\phi_i - \phi_j \right) \\ &= -k \left(\phi_i \sum_j A_{ij} - \sum_j A_{ij} \phi_j \right) \\ &= -k \left(\phi_i \ \deg(v_i) - \sum_j A_{ij} \phi_j \right) \\ &= -k \sum_j \left(\delta_{ij} \ \deg(v_i) - A_{ij} \right) \phi_j \\ &= -k \sum_j \left(L_{ij} \right) \phi_j. \end{align}$$

In matrix-vector notation,
 * $$\begin{align}

\frac{d\phi}{dt} &= -k(D - A)\phi \\ &= -kL \phi, \end{align}$$

which gives
 * $$\frac{d \phi}{d t} + kL\phi = 0.$$

Notice that this equation takes the same form as the heat equation, where the matrix −L is replacing the Laplacian operator $\nabla^2$ ; hence, the "graph Laplacian".

To find a solution to this differential equation, apply standard techniques for solving a first-order matrix differential equation. That is, write $\phi$ as a linear combination of eigenvectors $\mathbf{v}_i$  of L (so that $L\mathbf{v}_i = \lambda_i \mathbf{v}_i$ ) with time-dependent coefficients, $\phi(t) = \sum_i c_i(t) \mathbf{v}_i.$

Plugging into the original expression (because L is a symmetric matrix, its unit-norm eigenvectors $\mathbf{v}_i$ are orthogonal):


 * $$\begin{align}

0 ={} &\frac{d\left(\sum_i c_i(t) \mathbf{v}_i\right)}{dt} + kL\left(\sum_i c_i(t) \mathbf{v}_i\right) \\ {}={} &\sum_i \left[\frac{dc_i(t)}{dt} \mathbf{v}_i + k c_i(t) L \mathbf{v}_i\right] \\ {}={} &\sum_i \left[\frac{dc_i(t)}{dt} \mathbf{v}_i + k c_i(t) \lambda_i \mathbf{v}_i\right] \\ \Rightarrow 0 ={} &\frac{dc_i(t)}{dt} + k \lambda_i c_i(t), \\ \end{align}$$

whose solution is
 * $$c_i(t) = c_i(0) e^{-k \lambda_i t}.$$

As shown before, the eigenvalues $\lambda_i$ of L are non-negative, showing that the solution to the diffusion equation approaches an equilibrium, because it only exponentially decays or remains constant. This also shows that given $\lambda_i$ and the initial condition $c_i(0)$, the solution at any time t can be found.

To find $c_i(0)$ for each $i$  in terms of the overall initial condition $\phi(0)$, simply project $\phi(0)$  onto the unit-norm eigenvectors $\mathbf{v}_i$ ;
 * $$c_i(0) = \left\langle \phi(0), \mathbf{v}_i \right\rangle $$.

This approach has been applied to quantitative heat transfer modelling on unstructured grids.

In the case of undirected graphs, this works because $L$ is symmetric, and by the spectral theorem, its eigenvectors are all orthogonal. So the projection onto the eigenvectors of $L$ is simply an orthogonal coordinate transformation of the initial condition to a set of coordinates which decay exponentially and independently of each other.

Equilibrium behavior
To understand $\lim_{t \to \infty}\phi(t)$, the only terms $ c_i(t) = c_i(0) e^{-k \lambda_i t}$ that remain are those where $\lambda_i = 0$ , since
 * $$\lim_{t\to\infty} e^{-k \lambda_i t} = \begin{cases}

0, & \text{if} & \lambda_i > 0 \\ 1, & \text{if} & \lambda_i = 0 \end{cases}$$

In other words, the equilibrium state of the system is determined completely by the kernel of $L$.

Since by definition, $\sum_{j}L_{ij} = 0$, the vector $\mathbf{v}^1$ of all ones is in the kernel. If there are $k$ disjoint connected components in the graph, then this vector of all ones can be split into the sum of $k$  independent $\lambda = 0$  eigenvectors of ones and zeros, where each connected component corresponds to an eigenvector with ones at the elements in the connected component and zeros elsewhere.

The consequence of this is that for a given initial condition $c(0)$ for a graph with $N$  vertices
 * $$\lim_{t\to\infty}\phi(t) = \left\langle c(0), \mathbf{v^1} \right\rangle \mathbf{v^1}$$

where
 * $$\mathbf{v^1} = \frac{1}{\sqrt{N}} [1, 1, \ldots, 1] $$

For each element $\phi_j$ of $\phi$, i.e. for each vertex $j$  in the graph, it can be rewritten as
 * $$\lim_{t\to\infty}\phi_j(t) = \frac{1}{N} \sum_{i = 1}^N c_i(0) $$.

In other words, at steady state, the value of $\phi$ converges to the same value at each of the vertices of the graph, which is the average of the initial values at all of the vertices. Since this is the solution to the heat diffusion equation, this makes perfect sense intuitively. We expect that neighboring elements in the graph will exchange energy until that energy is spread out evenly throughout all of the elements that are connected to each other.

Example of the operator on a grid


This section shows an example of a function $\phi$ diffusing over time through a graph. The graph in this example is constructed on a 2D discrete grid, with points on the grid connected to their eight neighbors. Three initial points are specified to have a positive value, while the rest of the values in the grid are zero. Over time, the exponential decay acts to distribute the values at these points evenly throughout the entire grid.

The complete Matlab source code that was used to generate this animation is provided below. It shows the process of specifying initial conditions, projecting these initial conditions onto the eigenvalues of the Laplacian Matrix, and simulating the exponential decay of these projected initial conditions.

Discrete Schrödinger operator
Let $$P\colon V\rightarrow R$$ be a potential function defined on the graph. Note that P can be considered to be a multiplicative operator acting diagonally on $$\phi$$


 * $$(P\phi)(v)=P(v)\phi(v).$$

Then $$H=\Delta+P$$ is the discrete Schrödinger operator, an analog of the continuous Schrödinger operator.

If the number of edges meeting at a vertex is uniformly bounded, and the potential is bounded, then H is bounded and self-adjoint.

The spectral properties of this Hamiltonian can be studied with Stone's theorem; this is a consequence of the duality between posets and Boolean algebras.

On regular lattices, the operator typically has both traveling-wave as well as Anderson localization solutions, depending on whether the potential is periodic or random.

The Green's function of the discrete Schrödinger operator is given in the resolvent formalism by
 * $$G(v,w;\lambda)=\left\langle\delta_v\left| \frac{1}{H-\lambda}\right| \delta_w\right\rangle $$

where $$\delta_w$$ is understood to be the Kronecker delta function on the graph: $$\delta_w(v)=\delta_{wv}$$; that is, it equals 1 if v=w and 0 otherwise.

For fixed $$w\in V$$ and $$\lambda$$ a complex number, the Green's function considered to be a function of v is the unique solution to


 * $$(H-\lambda)G(v,w;\lambda)=\delta_w(v).$$

ADE classification
Certain equations involving the discrete Laplacian only have solutions on the simply-laced Dynkin diagrams (all edges multiplicity 1), and are an example of the ADE classification. Specifically, the only positive solutions to the homogeneous equation:
 * $$\Delta \phi = \phi,$$

in words,
 * "Twice any label is the sum of the labels on adjacent vertices,"

are on the extended (affine) ADE Dynkin diagrams, of which there are 2 infinite families (A and D) and 3 exceptions (E). The resulting numbering is unique up to scale, and if the smallest value is set at 1, the other numbers are integers, ranging up to 6.

The ordinary ADE graphs are the only graphs that admit a positive labeling with the following property:
 * Twice any label minus two is the sum of the labels on adjacent vertices.

In terms of the Laplacian, the positive solutions to the inhomogeneous equation:
 * $$\Delta \phi = \phi - 2.$$

The resulting numbering is unique (scale is specified by the "2"), and consists of integers; for E8 they range from 58 to 270, and have been observed as early as 1968.