Edge Expansion and Conductance
A graph is "well connected" if every set of vertices has many edges leaving it, relative to its size. Two numbers make this precise. Edge expansion measures the boundary against the number of vertices, conductance against the number of edge endpoints (the volume). They are the combinatorial quantities that Cheeger's inequality ties to , and graphs where they stay bounded away from 0 are expanders. Conductance and the Cheeger Bound met conductance for Markov chains; this lesson sets up the graph version used for the rest of the course and fixes its normalization.
Definitions
Let be a weighted graph, , and . Write
Edge expansion (also the isoperimetric number, or Cheeger constant of the graph):
Conductance (the normalization used in this course):
(with weights, ), so the minimum in the denominator picks the side with at most half the volume, and . Conductance is the natural measure for the normalized Laplacian and the random walk: is the probability that one step of the walk started from the stationary distribution restricted to (the smaller side) leaves .
Relations.
- For a -regular graph , so .
- The lazy-walk conductance of the randomized-algorithms course equals : laziness halves every transition probability.
- Shi and Malik's normalized cut satisfies , so minimizing either is the same problem up to a factor 2.
- Sparsity is divided by , so it is within a factor 2 of .
Computing conductance is hard
Computing or exactly is NP-hard (it contains the minimum bisection-type problems; see Matula and Shahrokhi, 1990, for sparsest cut). The best polynomial-time approximations are by multicommodity flows (Leighton and Rao, 1988, 1999) and by semidefinite programming (Arora, Rao and Vazirani, 2004). Spectral methods give something different: not a constant or logarithmic factor, but a square-root guarantee that is excellent when is large (expanders) and weak when it is tiny, computed in nearly linear time. For small graphs we can simply try every subset.
import numpy as np
def all_cut_stats(n, edges):
"""phi(G) and h(G) by trying all 2^n - 2 proper subsets (vectorized over subsets)."""
masks = np.arange(1, 2 ** n - 1)
S = ((masks[:, None] >> np.arange(n)) & 1).astype(bool)
deg = np.zeros(n)
for u, v in edges:
deg[u] += 1; deg[v] += 1
cut = np.zeros(len(masks))
for u, v in edges:
cut += S[:, u] != S[:, v]
vol = S @ deg
size = S.sum(axis=1)
phi = cut / np.minimum(vol, deg.sum() - vol)
h = np.where(size <= n / 2, cut / size, np.inf)
return float(phi.min()), float(h.min())
graphs = {
"path P_12": (12, [(i, i + 1) for i in range(11)]),
"cycle C_12": (12, [(i, (i + 1) % 12) for i in range(12)]),
"complete K_8": (8, [(i, j) for i in range(8) for j in range(i + 1, 8)]),
"hypercube Q_4": (16, [(x, x ^ (1 << i)) for x in range(16) for i in range(4) if x < x ^ (1 << i)]),
"barbell 2 x K_6": (12, [(a + s, b + s) for s in (0, 6) for a in range(6) for b in range(a + 1, 6)] + [(5, 6)]),
}
print("graph phi(G) h(G)")
for name, (n, edges) in graphs.items():
phi, h = all_cut_stats(n, edges)
print(f"{name:16} {phi:7.4f} {h:6.4f}")graph phi(G) h(G)
path P_12 0.0909 0.1667
cycle C_12 0.1667 0.3333
complete K_8 0.5714 4.0000
hypercube Q_4 0.2500 1.0000
barbell 2 x K_6 0.0323 0.1667
The cycle's best cut is two opposite edges: , . The hypercube's best cuts are the "dimension cuts" with 8 crossing edges, and . That no set does better is the edge-isoperimetric inequality of the hypercube (Harper, 1964; Bernstein, 1967): every with has . The barbell's single bridge gives , since each side has volume .
Expander families
A sequence of -regular graphs with is an expander family if (equivalently ) for a constant independent of . Paths, cycles and grids are not: their expansion decays like or . Hypercubes are not either (with growing degree, ). Complete graphs have huge expansion but degree . The interesting fact, proved later in the course, is that constant-degree expander families exist, and in fact almost every random -regular graph with is a good expander (Constructing Expanders).
Exhaustive search in C++
For later lessons we need the true conductance of graphs with about 20 vertices to compare heuristics against. A Gray-code walk over the subsets that exclude the last vertex (each cut is counted once) updates the cut size and the volume in time when one vertex changes sides.
#include <algorithm>
#include <bit>
#include <cstdint>
#include <cstdio>
#include <vector>
struct Best { double phi; std::uint32_t set; };
// Exact conductance by a Gray-code walk over all subsets S of {0, ..., n-2}.
Best min_conductance(const std::vector<std::vector<int>>& adj) {
int n = (int)adj.size();
long total = 0;
for (auto& nb : adj) total += (long)nb.size();
std::vector<char> in(n, 0);
long cut = 0, vol = 0;
std::uint32_t set = 0;
Best best{2.0, 0};
for (std::uint32_t g = 1; g < (1u << (n - 1)); ++g) {
int v = std::countr_zero(g); // vertex v switches sides
int inside = 0;
for (int u : adj[v]) inside += in[u];
int deg = (int)adj[v].size();
if (!in[v]) { cut += deg - 2 * inside; vol += deg; }
else { cut -= deg - 2 * inside; vol -= deg; }
in[v] ^= 1;
set ^= 1u << v;
double phi = double(cut) / double(std::min(vol, total - vol));
if (phi < best.phi) best = {phi, set};
}
return best;
}
int main() {
// a 4 x 5 grid: 20 vertices
const int R = 4, C = 5, n = R * C;
std::vector<std::vector<int>> adj(n);
auto add = [&](int a, int b) { adj[a].push_back(b); adj[b].push_back(a); };
for (int i = 0; i < R; ++i)
for (int j = 0; j < C; ++j) {
if (j + 1 < C) add(i * C + j, i * C + j + 1);
if (i + 1 < R) add(i * C + j, (i + 1) * C + j);
}
Best b = min_conductance(adj);
std::printf("%u subsets checked, phi(G) = %.4f\n", (1u << (n - 1)) - 1, b.phi);
for (int i = 0; i < R; ++i) {
for (int j = 0; j < C; ++j) std::printf("%c", (b.set >> (i * C + j)) & 1 ? 'S' : '.');
std::printf("\n");
}
}524287 subsets checked, phi(G) = 0.1613
SSSSS
SSSSS
.....
.....
The optimum cuts the 5 vertical edges between the second and third rows, and each half has volume 31, so . Cutting across the long side between the second and third columns would cross only 4 edges, but the sides would be unbalanced (volumes 24 and 38) and is worse. Conductance rewards balance as well as a small boundary. The search took steps; at it would take about half a trillion, which is why the next lessons look for a spectral shortcut.
Test yourself
What is the conductance of a set in this course?
For a -regular graph, how are and related?
Why are hypercubes not an expander family in the sense of this lesson?
- They are disconnected
- Their degree grows, and their conductance tends to 0
- Their edge expansion tends to 0
- They are not regular
What is the conductance of two copies of joined by a single edge?