Search

Search papers and lessons

Graph Laplacian

Level 3 · 10 min read

The graph Laplacian is a matrix that measures how much a signal on the vertices varies across edges, and its eigenvectors give the smoothest patterns a graph supports.

On this page

  • Colour = topic mix
  • Linear algebra
  • Discrete math
  • Sign in to see your progress

TL;DR

The graph Laplacian is a matrix built from a graph's adjacency matrix and its degrees. Put a number on each vertex and the Laplacian tells you how much those numbers differ across edges. A signal that agrees on neighbours scores low, and one that jumps along edges scores high. Its eigenvectors are the basic patterns a graph can hold, ordered from smoothest to most jagged, and its eigenvalues say how jagged each pattern is.

Where you'll see it: in spectral clustering, which splits a graph using the eigenvectors of its Laplacian, in semi-supervised learning on graphs, where labels spread along edges, and in graph neural networks, whose layers are smoothing operators built from it.

Intuition

Counting disagreements along edges

Take the four-vertex graph from the adjacency matrix lesson: vertices A, B, C and D, with edges A–B, A–C, B–C, C–D and B–D. Put a number on each vertex, say a temperature. Call the list of numbers x=(xA,xB,xC,xD)\mathbf{x} = (x_A, x_B, x_C, x_D), which is a vector.

Now ask a simple question: across each edge, how different are the two endpoints? Add up the squared differences over all edges. If every vertex has the same value, the total is zero. If one vertex is very different from its neighbours, the total is large. This total is the roughness of x\mathbf{x} on the graph.

The Laplacian is the matrix that computes this total in one step. You do not need to loop over edges. You multiply the matrix by the vector and take a dot product, and the answer is the same sum.

Why a matrix at all

Each vertex has a degree: the number of edges touching it. Write the degrees on a diagonal matrix DD. The Laplacian is

L=D−A,L = D - A,

where AA is the adjacency matrix. The degree matrix counts how many neighbours each vertex has, and the adjacency matrix subtracts the neighbour values back out. The row for a vertex ii says: take did_i times the value at ii, then subtract the values at its neighbours. If the vertex matches its neighbours, the result is zero. That is why the Laplacian measures disagreement.

The name comes from the discrete analogue of the Laplace operator in calculus, which measures how far a function at a point differs from the average of its surroundings. The graph version does the same thing with neighbours in place of nearby points.

The math

Definition: Graph Laplacian

For an undirected graph with nn vertices, adjacency matrix AA and degree matrix DD (a diagonal matrix with DiiD_{ii} equal to the degree of vertex ii), the unnormalized graph Laplacian is L=D−AL = D - A. The normalized Laplacian is Lsym=D−1/2LD−1/2L_{\text{sym}} = D^{-1/2} L D^{-1/2}, where D−1/2D^{-1/2} is the diagonal matrix with entries 1/di1/\sqrt{d_i}.

Basic properties

Every row of LL sums to zero, because each row has did_i on the diagonal and −1-1 in each of the did_i neighbour columns. So the all-ones vector 1\mathbf{1} always satisfies L1=0L\mathbf{1} = \mathbf{0}.

LL is symmetric, so it has real eigenvalues and orthogonal eigenvectors. This is the same spectral theorem that the eigenvalues and eigenvectors lesson builds toward. The eigenvalues are never negative, which follows from the quadratic form below.

The quadratic form

For any vector x\mathbf{x},

x⊤Lx=∑{i,j}∈E(xi−xj)2,\mathbf{x}^\top L \mathbf{x} = \sum_{\{i,j\} \in E} (x_i - x_j)^2,

where the sum runs over every edge once. To see this, expand the product. Each diagonal entry dixi2d_i x_i^2 collects one term for each edge touching ii, and each off-diagonal −xixj-x_i x_j pairs with the matching −xjxi-x_j x_i to give the −2xixj-2x_i x_j cross term of (xi−xj)2(x_i - x_j)^2. This identity is the reason the Laplacian is the right object: it is the energy of a signal on the graph.

Because each square is non-negative, x⊤Lx≥0\mathbf{x}^\top L \mathbf{x} \geq 0 for all x\mathbf{x}. The Laplacian is positive semidefinite.

Eigenvalues as roughness

Order the eigenvalues 0=λ1≤λ2≤⋯≤λn0 = \lambda_1 \leq \lambda_2 \leq \dots \leq \lambda_n, with orthonormal eigenvectors u1,…,un\mathbf{u}_1, \dots, \mathbf{u}_n. For a unit eigenvector, uk⊤Luk=λk\mathbf{u}_k^\top L \mathbf{u}_k = \lambda_k, so λk\lambda_k is exactly the roughness of that pattern. The first eigenvector is the constant vector, with roughness zero.

If the graph splits into cc connected pieces, then λ1=⋯=λc=0\lambda_1 = \dots = \lambda_c = 0. Each piece gets its own constant pattern, and no edge joins two pieces, so nothing forces a difference. The second smallest eigenvalue λ2\lambda_2, called the algebraic connectivity or Fiedler value, is positive exactly when the graph is connected, and small values mean the graph is nearly split in two.

Normalized version

Degree matters. A hub with 50 edges contributes far more to LL than a vertex with 2 edges. The normalized Laplacian LsymL_{\text{sym}} divides out the degrees, so every vertex counts on the same scale. Its eigenvalues lie between 0 and 2 for any graph. Many spectral methods use it for that reason.

Worked examples

Example
Two vertices joined by one edge
  1. Adjacency matrix: A=(0110)A = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}.
  2. Degrees: each vertex has one edge, so D=(1001)D = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}.
  3. Laplacian: L=D−A=(1−1−11)L = D - A = \begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix}.
  4. Try the constant vector: L(1,1)⊤=(1−1,−1+1)⊤=(0,0)⊤L(1, 1)^\top = (1 - 1, -1 + 1)^\top = (0, 0)^\top. Eigenvalue 00.
  5. Try the difference vector: L(1,−1)⊤=(1+1,−1−1)⊤=(2,−2)⊤=2 (1,−1)⊤L(1, -1)^\top = (1 + 1, -1 - 1)^\top = (2, -2)^\top = 2\,(1, -1)^\top. Eigenvalue 22.
  6. Check the quadratic form on x=(1,−1)\mathbf{x} = (1, -1): the single edge gives (1−(−1))2=4(1 - (-1))^2 = 4. Using the eigenvalue, x⊤Lx=2⋅∥x∥2=2⋅2=4\mathbf{x}^\top L \mathbf{x} = 2 \cdot \|\mathbf{x}\|^2 = 2 \cdot 2 = 4. The two agree.

Interpretation: the graph has two eigenvalues, 00 for "both vertices the same" and 22 for "opposite signs". The opposite-sign pattern is the rough one.

Example
The four-vertex graph from the adjacency lesson

Vertices A, B, C, D with edges A–B, A–C, B–C, C–D and B–D. The degrees are 2,3,3,22, 3, 3, 2, so

L=(2−1−10−13−1−1−1−13−10−1−12).L = \begin{pmatrix} 2 & -1 & -1 & 0 \\ -1 & 3 & -1 & -1 \\ -1 & -1 & 3 & -1 \\ 0 & -1 & -1 & 2 \end{pmatrix}.
  1. Check the row sums: row A is 2−1−1+0=02 - 1 - 1 + 0 = 0, row B is −1+3−1−1=0-1 + 3 - 1 - 1 = 0, and the other rows work the same way.
  2. Roughness of the spike x=(1,0,0,0)\mathbf{x} = (1, 0, 0, 0). Only the edges A–B and A–C touch a nonzero value, and each contributes 12=11^2 = 1. The total is 22. This matches LAA=2L_{AA} = 2.
  3. Find the eigenvalues with symmetry. The graph is unchanged if you swap A with D and B with C, so the eigenvectors split into patterns that are symmetric or antisymmetric under that swap.
  4. Symmetric patterns have the form (a,b,b,a)(a, b, b, a). Applying LL gives (2a−2b, −2a+2b, … )(2a - 2b,\ -2a + 2b,\ \dots), a 2×22 \times 2 system with eigenvalues 00 and 44. The eigenvectors are (1,1,1,1)(1, 1, 1, 1) and (1,−1,−1,1)(1, -1, -1, 1).
  5. Antisymmetric patterns have the form (a,b,−b,−a)(a, b, -b, -a). Applying LL gives the decoupled equations 2a2a and 4b4b, so the eigenvalues are 22 and 44, with eigenvectors (1,0,0,−1)(1, 0, 0, -1) and (0,1,−1,0)(0, 1, -1, 0).
  6. Check the trace. The diagonal of LL sums to 2+3+3+2=102 + 3 + 3 + 2 = 10, and 0+2+4+4=100 + 2 + 4 + 4 = 10.

So the spectrum is {0,2,4,4}\{0, 2, 4, 4\}. The zero eigenvalue appears once because the graph is connected, and the Fiedler value is λ2=2\lambda_2 = 2.

Example
A path with five vertices

A path on nn vertices has a known spectrum, λk=2−2cos⁡ ⁣(kπn)\lambda_k = 2 - 2\cos\!\left(\frac{k\pi}{n}\right) for k=0,…,n−1k = 0, \dots, n-1. For n=5n = 5:

  1. k=0k = 0: 2−2cos⁡0=02 - 2\cos 0 = 0.
  2. k=1k = 1: 2−2cos⁡36∘≈0.3822 - 2\cos 36^\circ \approx 0.382.
  3. k=2k = 2: 2−2cos⁡72∘≈1.3822 - 2\cos 72^\circ \approx 1.382.
  4. k=3k = 3: 2−2cos⁡108∘≈2.6182 - 2\cos 108^\circ \approx 2.618.
  5. k=4k = 4: 2−2cos⁡144∘≈3.6182 - 2\cos 144^\circ \approx 3.618.

Low kk means a slowly varying pattern across the path, and high kk means one that alternates quickly. The eigenvalue grows with the number of sign changes, which is the roughness story in one line.

00.511.522.533.5401234mode index keigenvalue
  • 2 - 2 cos(k pi / 5)
The dots are the five eigenvalues of the path on five vertices. The curve is only a smooth guide through them, since k is a whole number.

Tradeoffs and failure modes

The unnormalized Laplacian LL and the normalized LsymL_{\text{sym}} answer different questions, and choosing the wrong one is a common mistake.

SituationProblemBetter choice
Degrees vary a lot (hubs and leaves)LL lets high-degree vertices dominate the spectrumLsymL_{\text{sym}}, or random-walk normalization
You want cuts that balance cluster sizesLL alone can isolate tiny clustersNormalized cut built on LsymL_{\text{sym}}
Graph is directedL=D−AL = D - A is not symmetric and its spectrum may be complexDirected Laplacians, or symmetrize AA first
Graph is hugeA full eigendecomposition costs O(n3)O(n^3)Sparse eigensolvers for the few smallest eigenvalues
Graph changes over timeRecomputing eigenvectors each step is expensiveIncremental or approximate spectral methods

A subtler failure: eigenvectors for repeated eigenvalues are not unique. When λ2=λ3\lambda_2 = \lambda_3, any rotation within that subspace is equally valid, so an algorithm that reads a single "second eigenvector" can give different answers on the same graph.

History

Gustav Kirchhoff used a matrix closely related to the Laplacian in 1847 to count spanning trees of an electrical network, in what became the matrix-tree theorem. The matrix was a tool for circuits long before it had a graph-theory name.

Spectral graph theory grew in the early 1970s. Miroslav Fiedler studied the second smallest eigenvalue and its relation to how well a graph can be split, and that value is now called the Fiedler value. Later work by Fan Chung in the 1990s gathered these results into a systematic theory.

In machine learning, the Laplacian became a practical tool around 2000. Jianbo Shi and Jitendra Malik used normalized cuts for image segmentation in 2000, and Mikhail Belkin and Partha Niyogi used Laplacian eigenmaps for dimensionality reduction in 2003. Xiaojin Zhu, Zoubin Ghahramani and John Lafferty used the Laplacian to spread labels through a graph in 2003, which is the basis of the method described in semi-supervised learning. The idea caught on because it turned a graph into ordinary linear algebra. Kipf and Welling's graph convolutional network in 2017 is built on a smoothing operator closely related to LsymL_{\text{sym}}.

Check yourself

QuestionRecall: what is the Laplacian LL of a graph in terms of DD and AA?Show answer

L=D−AL = D - A, where DD is the diagonal matrix of vertex degrees and AA is the adjacency matrix. The degree term counts each vertex's neighbours, and the subtraction of AA removes the neighbour values, so a vertex that matches all its neighbours gets zero.

QuestionComputation: for the path on three vertices 1–2–3, what is x⊤Lx\mathbf{x}^\top L \mathbf{x} for x=(1,0,0)\mathbf{x} = (1, 0, 0)?Show answer

The edges are 1–2 and 2–3. Only edge 1–2 has a difference, with (1−0)2=1(1 - 0)^2 = 1. Edge 2–3 gives (0−0)2=0(0 - 0)^2 = 0. The total is 11. Check with the matrix: L=(1−10−12−10−11)L = \begin{pmatrix} 1 & -1 & 0 \\ -1 & 2 & -1 \\ 0 & -1 & 1 \end{pmatrix}, and L11=1L_{11} = 1.

QuestionWhy: why does a graph with two connected pieces have two zero eigenvalues?Show answer

Each piece has its own constant pattern, which is an eigenvector with eigenvalue zero: set every vertex in one piece to 1 and every vertex in the other piece to 0. No edge joins the pieces, so every edge difference is zero and so is the quadratic form. Those two patterns are independent, so the eigenvalue zero has multiplicity two.

QuestionApplied: a social network has a few users with thousands of followers and many with only two. Which Laplacian would you use for spectral clustering, and why?Show answer

Use the normalized Laplacian LsymL_{\text{sym}}. The unnormalized LL weights each vertex by its degree, so the hubs dominate the quadratic form and can pull the clusters toward a split that isolates a few users. Dividing by the degrees puts every vertex on the same scale, so the clusters reflect the shape of the network rather than its hubs.

Sources