TExcelTAD
Home › Spectral Graph Theory & Modern Graph Algorithms › Algebraic Connectivity and the Fiedler Vector

Algebraic Connectivity and the Fiedler Vector

In 1973 Miroslav Fiedler named λ2(L)\lambda_2(L) the algebraic connectivity of a graph and proved that it behaves like a connectivity measure. Two years later he studied the corresponding eigenvector, now called the Fiedler vector, and showed that its sign pattern cuts the graph into connected pieces. These two papers started spectral partitioning. This lesson covers Fiedler's inequalities, his theorem on the structure of the vector, and two uses of the vector: ordering vertices along a line and drawing a graph.

Algebraic connectivity as connectivity

Write a(G)=λ2(LG)a(G) = \lambda_2(L_G). By Eigenvalue Zero and Connected Components, a(G)>0a(G) > 0 iff GG is connected, and by the monotonicity of Courant-Fischer, adding edges never decreases it. Fiedler (1973) related it to the classical connectivities. Let κ(G)\kappa(G) be the vertex connectivity (fewest vertices whose removal disconnects GG) and κ′(G)\kappa'(G) the edge connectivity (fewest edges whose removal disconnects it).

Theorem (Fiedler, 1973). For every graph GG other than the complete graph, a(G)≤κ(G)≤κ′(G)a(G) \le \kappa(G) \le \kappa'(G).

The second inequality is classical (Whitney, 1932). For the first, the key step is that removing a vertex vv and its edges lowers aa by at most 1: a(G−v)≥a(G)−1a(G - v) \ge a(G) - 1. Removing a separating set of κ(G)\kappa(G) vertices therefore leaves a disconnected graph with 0=a(G−S)≥a(G)−κ(G)0 = a(G - S) \ge a(G) - \kappa(G). (The vertex-removal step uses an interlacing argument and is not proved here.)

The inequality a(G)≤κ′(G)a(G) \le \kappa'(G) has a two-line proof by a test vector, worth knowing because it is the template for Cheeger's inequality. Let (S,S‾)(S, \overline S) be a minimum edge cut, with s=∣S∣s = \lvert S \rvert. The vector x=(n−s)1S−s1S‾x = (n - s)\mathbf{1}_S - s\mathbf{1}_{\overline S} is orthogonal to 1\mathbf{1}, and

xTLxxTx=κ′(G) n2s(n−s)2+(n−s)s2=n κ′(G)s(n−s).\frac{x^{\mathsf{T}} L x}{x^{\mathsf{T}} x} = \frac{\kappa'(G)\, n^2}{s(n-s)^2 + (n-s)s^2} = \frac{n\,\kappa'(G)}{s(n-s)} .

Since s(n−s)≥n−1s(n - s) \ge n - 1 for 1≤s≤n−11 \le s \le n - 1, this gives a(G)≤nn−1κ′(G)a(G) \le \frac{n}{n-1}\kappa'(G); the extra factor disappears in Fiedler's sharper argument.

python · try it yourself
import itertools
import numpy as np

def lap(n, edges):
    L = np.zeros((n, n))
    for u, v in edges:
        L[u, u] += 1; L[v, v] += 1; L[u, v] -= 1; L[v, u] -= 1
    return L

def connected(nodes, edges):
    nodes = set(nodes)
    if not nodes:
        return True
    start = next(iter(nodes)); seen, stack = {start}, [start]
    while stack:
        u = stack.pop()
        for a, b in edges:
            for x, y in ((a, b), (b, a)):
                if x == u and y in nodes and y not in seen:
                    seen.add(y); stack.append(y)
    return seen == nodes

def vertex_connectivity(n, edges):
    for k in range(n - 1):
        for S in itertools.combinations(range(n), k):
            rest = [v for v in range(n) if v not in S]
            if not connected(rest, [(a, b) for a, b in edges if a in rest and b in rest]):
                return k
    return n - 1

def edge_connectivity(n, edges):
    best = len(edges)
    for mask in range(1, 2 ** (n - 1)):           # every cut (S, complement) with vertex n-1 outside S
        best = min(best, sum(((mask >> a) & 1) != ((mask >> b) & 1) for a, b in edges))
    return best

graphs = {
    "cycle C_8": (8, [(i, (i + 1) % 8) for i in range(8)]),
    "cube Q_3": (8, [(x, x ^ (1 << i)) for x in range(8) for i in range(3) if x < x ^ (1 << i)]),
    "two K_4 sharing a vertex": (7, [(a, b) for a in range(4) for b in range(a + 1, 4)] +
                                    [(a, b) for a in range(3, 7) for b in range(a + 1, 7)]),
    "wheel W_8": (8, [(i, (i + 1) % 7) for i in range(7)] + [(i, 7) for i in range(7)]),
}
print("graph                      a(G)   kappa   kappa'")
for name, (n, edges) in graphs.items():
    a = float(np.linalg.eigvalsh(lap(n, edges))[1])
    print(f"{name:25} {a:6.4f}   {vertex_connectivity(n, edges):5}   {edge_connectivity(n, edges):6}")
graph                      a(G)   kappa   kappa'
cycle C_8                 0.5858       2        2
cube Q_3                  2.0000       3        3
two K_4 sharing a vertex  1.0000       1        3
wheel W_8                 1.7530       3        3

The two K4K_4 sharing a vertex have a cut vertex, so κ=1\kappa = 1, and a(G)=1a(G) = 1 meets Fiedler's bound with equality. For the cube, a=2a = 2 while κ=κ′=3\kappa = \kappa' = 3. The cycle shows how loose the bound can be: its connectivity is 2 everywhere, but a(C8)≈0.59a(C_8) \approx 0.59 reflects that a cycle is long, which vertex and edge counts cannot see.

The Fiedler vector and its nodal domains

A Fiedler vector is any eigenvector xx of λ2\lambda_2. If λ2\lambda_2 is simple it is unique up to scaling.

Theorem (Fiedler, 1975). Let GG be connected and xx a Fiedler vector. For every c≤0c \le 0, the vertices {v:xv≥c}\{v : x_v \ge c\} induce a connected subgraph. (By symmetry, so do {v:xv≤c}\{v : x_v \le c\} for c≥0c \ge 0.)

In words: cutting the graph at a threshold of the Fiedler vector, on the side of the threshold that contains the mean value 0, never produces scattered fragments. In particular, the non-negative vertices and the non-positive vertices each form a connected piece. This is the structural reason why thresholding the Fiedler vector gives sensible two-way partitions, and the starting point of the sweep-cut algorithm.

Ordering vertices: spectral seriation

On the path, the Fiedler vector cos⁡(π(v+12)/n)\cos(\pi(v + \frac12)/n) is monotone: it sorts the vertices along the path. Atkins, Boman and Hendrickson (1998) proved that this generalizes. If the rows and columns of a similarity matrix can be permuted so that similarities decrease away from the diagonal (an "R-matrix"), sorting by the Fiedler vector finds such a permutation. This spectral seriation is used to order archaeological finds by date, to reassemble DNA fragments, and to reorder sparse matrices so that their nonzeros hug the diagonal.

The program hides the order of 12 items whose similarity decays with their distance along a line, plus noise, then recovers it from the Fiedler vector of the similarity graph.

python · try it yourself
import numpy as np

rng = np.random.default_rng(42)
n = 12
pos = np.arange(n)
W = np.exp(-np.abs(pos[:, None] - pos[None, :]) / 2.0)        # similarity decays with distance
noise = rng.uniform(0, 0.05, size=(n, n))
W = W + (noise + noise.T) / 2
np.fill_diagonal(W, 0)
perm = rng.permutation(n)                                   # hide the order
Wp = W[np.ix_(perm, perm)]
L = np.diag(Wp.sum(axis=1)) - Wp
vals, vecs = np.linalg.eigh(L)
f = vecs[:, 1]
f = f if f[0] > 0 else -f
order = perm[np.argsort(f)]
print("shuffled labels:          ", perm.tolist())
print("sorted by Fiedler vector: ", order.tolist())
print("recovered (up to reversal):", order.tolist() in (list(range(n)), list(range(n))[::-1]))
shuffled labels:           [2, 9, 1, 8, 3, 11, 6, 10, 7, 5, 4, 0]
sorted by Fiedler vector:  [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
recovered (up to reversal): True

Drawing a graph with eigenvectors

Hall (1970) asked for an embedding v↦(xv,yv)v \mapsto (x_v, y_v) of the vertices in the plane that keeps adjacent vertices close: minimize ∑{u,v}∈E∥(xu,yu)−(xv,yv)∥2=xTLx+yTLy\sum_{\{u,v\} \in E} \lVert (x_u, y_u) - (x_v, y_v) \rVert^2 = x^{\mathsf{T}} L x + y^{\mathsf{T}} L y. Without constraints the answer is to put every vertex at one point. Requiring x,yx, y to be unit vectors, orthogonal to 1\mathbf{1} (centred) and to each other (not on one line), Courant-Fischer gives the minimum λ2+λ3\lambda_2 + \lambda_3 at the eigenvectors v2,v3v_2, v_3. This spectral drawing often reveals the shape of a graph that was built from geometry, as in the program, which shuffles the vertices of a 5×85 \times 8 grid and still draws it as a grid.

python · try it yourself
import numpy as np
import matplotlib.pyplot as plt

r, c = 5, 8
idx = lambda i, j: i * c + j
edges = [(idx(i, j), idx(i, j + 1)) for i in range(r) for j in range(c - 1)] + \
        [(idx(i, j), idx(i + 1, j)) for i in range(r - 1) for j in range(c)]
n = r * c
perm = np.random.default_rng(5).permutation(n)               # relabel the vertices at random
L = np.zeros((n, n))
for u, v in edges:
    a, b = perm[u], perm[v]
    L[a, a] += 1; L[b, b] += 1; L[a, b] -= 1; L[b, a] -= 1
vals, vecs = np.linalg.eigh(L)
x, y = vecs[:, 1], vecs[:, 2]
print("lambda_2, lambda_3, lambda_4:", np.round(vals[1:4], 4) + 0.0)
fig, ax = plt.subplots(figsize=(5, 3.2))
for u, v in edges:
    a, b = perm[u], perm[v]
    ax.plot([x[a], x[b]], [y[a], y[b]], color="gray", lw=0.8)
ax.scatter(x, y, s=18, zorder=3)
ax.set_title("Spectral drawing of a shuffled 5 x 8 grid")
ax.set_xticks([]); ax.set_yticks([])
plt.show()
lambda_2, lambda_3, lambda_4: [0.1522 0.382  0.5342]

The coordinates are the two lowest nontrivial eigenvectors, cos⁡(π(j+12)/8)\cos(\pi(j + \frac12)/8) along the long side (λ2=2−2cos⁡π8\lambda_2 = 2 - 2\cos\frac{\pi}{8}) and cos⁡(π(i+12)/5)\cos(\pi(i + \frac12)/5) along the short side (λ3=2−2cos⁡π5\lambda_3 = 2 - 2\cos\frac{\pi}{5}), so the picture is a grid squeezed by cosines at its ends. Spectral drawings are less reliable for graphs without an underlying geometry, but they make an excellent first look at an unknown network.

Test yourself

Which inequality did Fiedler prove for a non-complete graph GG?

  1. a(G)≥κ(G)a(G) \ge \kappa(G)
  2. a(G)≤κ(G)≤κ′(G)a(G) \le \kappa(G) \le \kappa'(G)
  3. a(G)=κ′(G)a(G) = \kappa'(G)
  4. a(G)≤1/κ(G)a(G) \le 1/\kappa(G)

What does Fiedler's 1975 theorem say about a Fiedler vector xx of a connected graph?

  1. All entries are distinct
  2. For c≤0c \le 0, the vertices with xv≥cx_v \ge c induce a connected subgraph
  3. It has exactly two nonzero entries
  4. Its entries are all positive

For which input does sorting by the Fiedler vector provably recover an ordering (Atkins, Boman and Hendrickson)?

  1. Any graph
  2. A similarity matrix that can be permuted so that similarities decrease away from the diagonal
  3. Only trees
  4. Only bipartite graphs

In Hall's spectral drawing, why are the coordinate vectors required to be orthogonal to 1\mathbf{1} and to each other?

  1. To make the drawing symmetric
  2. Otherwise the energy is minimized by putting all vertices at one point or on one line
  3. To make LL invertible
  4. To speed up the eigenvalue solver