Algebraic Connectivity and the Fiedler Vector
In 1973 Miroslav Fiedler named 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 . By Eigenvalue Zero and Connected Components, iff is connected, and by the monotonicity of Courant-Fischer, adding edges never decreases it. Fiedler (1973) related it to the classical connectivities. Let be the vertex connectivity (fewest vertices whose removal disconnects ) and the edge connectivity (fewest edges whose removal disconnects it).
Theorem (Fiedler, 1973). For every graph other than the complete graph, .
The second inequality is classical (Whitney, 1932). For the first, the key step is that removing a vertex and its edges lowers by at most 1: . Removing a separating set of vertices therefore leaves a disconnected graph with . (The vertex-removal step uses an interlacing argument and is not proved here.)
The inequality has a two-line proof by a test vector, worth knowing because it is the template for Cheeger's inequality. Let be a minimum edge cut, with . The vector is orthogonal to , and
Since for , this gives ; the extra factor disappears in Fiedler's sharper argument.
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 sharing a vertex have a cut vertex, so , and meets Fiedler's bound with equality. For the cube, while . The cycle shows how loose the bound can be: its connectivity is 2 everywhere, but 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 of . If is simple it is unique up to scaling.
Theorem (Fiedler, 1975). Let be connected and a Fiedler vector. For every , the vertices induce a connected subgraph. (By symmetry, so do for .)
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 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.
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 of the vertices in the plane that keeps adjacent vertices close: minimize . Without constraints the answer is to put every vertex at one point. Requiring to be unit vectors, orthogonal to (centred) and to each other (not on one line), Courant-Fischer gives the minimum at the eigenvectors . 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 grid and still draws it as a grid.
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, along the long side () and along the short side (), 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 ?
What does Fiedler's 1975 theorem say about a Fiedler vector of a connected graph?
- All entries are distinct
- For , the vertices with induce a connected subgraph
- It has exactly two nonzero entries
- Its entries are all positive
For which input does sorting by the Fiedler vector provably recover an ordering (Atkins, Boman and Hendrickson)?
- Any graph
- A similarity matrix that can be permuted so that similarities decrease away from the diagonal
- Only trees
- Only bipartite graphs
In Hall's spectral drawing, why are the coordinate vectors required to be orthogonal to and to each other?
- To make the drawing symmetric
- Otherwise the energy is minimized by putting all vertices at one point or on one line
- To make invertible
- To speed up the eigenvalue solver