Algorithm Search⌘K

Proofs: Reverse Cuthill-McKee algorithm

These are the human proofs of Reverse Cuthill-McKee algorithm, at full length.

Reverse Cuthill-McKee returns a permutation whose bandwidth is below twice the level width, and Cholesky fill stays in its envelope full

This proof shows: correctness, termination.

Let G=(V,E)G = (V, E) be the graph of a symmetric pattern, ∣V∣=n|V| = n, ∣E∣=m|E| = m. Line numbers refer to the pseudocode. Write π\pi for the list built by lines L1 to L8 (the Cuthill-McKee order) and πR\pi^R for its reverse, returned at line L10. For an ordering σ\sigma, fσ(v)f_\sigma(v) is the position of vv.

Lemma 1 (each vertex is appended exactly once). A vertex is appended only at lines L5 and L8, and only when it is not yet numbered, and it is marked as numbered at the same moment. So no vertex is appended twice. Every vertex ss is examined by the loop at line L2; if it is unnumbered then, line L4 picks a root rr in the component of ss (the pseudo-peripheral search only moves along BFS levels of that component), and the breadth-first search of lines L6 to L8 appends every vertex reachable from rr, which includes ss. Hence π\pi and πR\pi^R are permutations of VV. □\square

Termination. The pseudo-peripheral search of line L4 moves to a new root only when the eccentricity strictly increases; eccentricities are below nn, so it stops after at most nn breadth-first searches. The queue of line L6 receives each vertex at most once by Lemma 1, so each search ends. The loop of line L2 has nn iterations.

Lemma 2 (CM numbers by levels). Within one component with root rr, the breadth-first search appends the vertices in order of nondecreasing distance from rr, so the component occupies a contiguous block of π\pi, and within it the level LiL_i (vertices at distance ii) occupies a contiguous sub-block, after L0,…,Li−1L_0, \ldots, L_{i-1}.

Proof. Standard property of breadth-first search with a FIFO queue: the queue holds vertices of at most two consecutive distances, with the smaller first, so vertices are appended in nondecreasing distance. Components are processed one after another by the loop at line L2. □\square

Theorem 1 (bandwidth). Let ww be the largest level width over the level structures of the roots chosen at line L4. Then β(π)=β(πR)≤2w−1\beta(\pi) = \beta(\pi^R) \le 2w - 1.

Proof. Reversal maps positions k↦n−1−kk \mapsto n - 1 - k, which preserves every difference ∣f(v)−f(u)∣|f(v) - f(u)|, so the two bandwidths are equal. For an edge {v,u}\{v, u\}, both ends lie in one component and their distances from rr differ by at most 1, so by Lemma 2 both lie in the union of two consecutive level blocks Li∪Li+1L_i \cup L_{i+1}, a contiguous range of at most 2w2w positions. Hence ∣f(v)−f(u)∣≤2w−1|f(v) - f(u)| \le 2w - 1. □\square

Theorem 2 (fill stays in the envelope; any ordering). Let B=PAPTB = P A P^T be symmetric positive definite with Cholesky factor LL, and for row ii let ϕi=min⁡{j:bij≠0}\phi_i = \min\{j : b_{ij} \ne 0\} be the column of its first nonzero. Then lij=0l_{ij} = 0 for j<ϕij < \phi_i.

Proof. The Cholesky recurrence gives lij=(bij−∑k<jlikljk)/ljjl_{ij} = \big(b_{ij} - \sum_{k < j} l_{ik} l_{jk}\big)/l_{jj} for j<ij < i. Fix ii and use induction on j<ϕij < \phi_i: bij=0b_{ij} = 0 by the definition of ϕi\phi_i, and lik=0l_{ik} = 0 for every k<jk < j by the induction hypothesis, so lij=0l_{ij} = 0. □\square

Hence the nonzeros of LL lie in the envelope {(i,j):ϕi≤j≤i}\{(i, j) : \phi_i \le j \le i\}, which has Env(σ)+n\mathrm{Env}(\sigma) + n entries, and an envelope (profile) solver that stores exactly this set loses nothing. The same holds symbolically: the graph elimination used by the implementation adds an edge {i,k}\{i, k\} with i,k>ji, k > j only between later neighbours of an eliminated vertex jj, and such an edge has ϕi≤j<k\phi_i \le j < k.

Theorem 3 (envelope of the reversal; cited). For every Cuthill-McKee ordering π\pi, Env(πR)≤Env(π)\mathrm{Env}(\pi^R) \le \mathrm{Env}(\pi), and the work of envelope Cholesky in the order πR\pi^R is at most that in the order π\pi. This is the theorem of Liu and Sherman (1976); its proof compares, for each jj, the number of vertices among the first jj that still have an unnumbered neighbour with the number of unnumbered vertices adjacent to the first jj, using the breadth-first structure of π\pi. We do not reproduce it; the tests check the inequality on random graphs.

A useful identity behind it: for any ordering σ\sigma, an entry (v,j)(v, j) lies in the envelope exactly when vv is numbered after position jj and has a neighbour at a position ≤j\le j. Counting by jj,

Env(σ)=∑j∣{v:fσ(v)>j, ∃u∼v, fσ(u)≤j}∣,\mathrm{Env}(\sigma) = \sum_{j} \big|\{v : f_\sigma(v) > j,\ \exists u \sim v,\ f_\sigma(u) \le j\}\big|,

the sum of the wavefront sizes. Applied to πR\pi^R and rewritten in terms of π\pi, Env(πR)\mathrm{Env}(\pi^R) becomes the sum over jj of the number of vertices among the first jj of π\pi that have a neighbour after position jj.

Back to Reverse Cuthill-McKee algorithm