A Visual Primer on Spectral Graph Theory

“When we try to pick out anything by itself, we find it hitched to everything else in the Universe.” - John Muir

Provide Context

Todo:

1. Start with the graph

three links per router, two links between groups

Our example has eight routers and twelve links. Every router has three links, yet only two links connect the two halves of the network. We want to understand that weakness and learn how to find similar ones in larger networks.

We draw the network as a graph: a circle, called a node, represents a router, and a line, called an edge, represents a link. Two nodes joined by an edge are neighbours. The nodes are numbered 1 to 8.

Start with the graph: eight nodes and twelve edgesCircles identify nodes 1 through 8. Lines identify the twelve undirected edges. Node 3 is circled in teal, and its three incident edges are highlighted. They connect it to nodes 1, 2, and 5. Where drawn lines cross without a circle, there is no additional node. Start with the wiring 8 nodes · 12 edges 1 2 3 4 5 6 7 8 Neighbours of node 3: 1, 2, 5 Only circles are nodes. A line crossing is not another node.
Start with the graph: eight nodes and twelve edgesCircles identify nodes 1 through 8. Lines identify the twelve undirected edges. Node 3 is circled in teal, and its three incident edges are highlighted. They connect it to nodes 1, 2, and 5. Where drawn lines cross without a circle, there is no additional node. Start with the wiring 8 nodes · 12 edges 1 2 3 4 5 6 7 8 Neighbours of node 3: 1, 2, 5 Crossing lines do not add a node. Only the circles are nodes.
Follow the connections at one node. Node 3 has neighbours 1, 2 and 5. Lines that cross in the drawing do not create a connection; a connection ends only at a numbered circle.

A node’s number identifies it. Its position on the page only helps us see the wiring. We could slide the circles around or bend the lines without changing a single connection.

The number of neighbours a node has is its degree. Node 3 has neighbours 1, 2 and 5, so its degree is three. Every other node also has degree three. When all nodes have the same degree, the graph is called regular; ours is 3-regular.

Look at nodes 1–4 as one group and nodes 5–8 as another. Only edges 3–5 and 4–6 connect the groups. All traffic between the halves must cross one of those two links.

Three links at every node, but only two links leave the left groupThe same eight-node, three-regular graph is used throughout. The chosen set S contains nodes 1 to 4. Its only edges to the other four nodes are 3–5 and 4–6, shown in orange. A dashed line marks the boundary of this proposed division. Choose the group S = {1, 2, 3, 4} 1 2 3 4 5 6 7 8 Every node has 3 links. Only 2 links leave this group.
Three links at every node, but only two links leave the left groupThe same eight-node, three-regular graph is used throughout. The chosen set S contains nodes 1 to 4. Its only edges to the other four nodes are 3–5 and 4–6, shown in orange. A dashed line marks the boundary of this proposed division. Choose the group S = {1, 2, 3, 4} 1 2 3 4 5 6 7 8 Every node has 3 links. Only 2 links leave this group.
Three neighbours each, but only two links out of the group. The orange edges are the only connections between the halves. Can we find weak boundaries like this one systematically, including the ones no drawing makes obvious?

Knowing that each router has three links does not tell us how well a whole group is connected to the rest. In a larger network, a weak division like this may be hard to spot in a drawing. We need a way to study it through calculations.

Label the two groups

Give nodes 1–4 the value +1 and nodes 5–8 the value −1. These are labels we choose to mark the groups. The wiring stays the same.

The labels let us recognize a crossing link by subtracting the values at its ends:

  • Same group: the values match, so their difference is zero.
  • Different groups: the difference is 2 or −2, depending on which value we subtract from which.

We can now identify links between the groups using arithmetic.

The values assigned to all the nodes form a pattern. List them in node-number order and we have a vector, x. Its third entry, x₃, is the value assigned to node 3: here, +1. The node number tells us which entry to read.

One value at each node becomes one entry of a vectorThe graph has not changed. We assign plus one to nodes 1 to 4 and minus one to nodes 5 to 8. The numbers inside circles identify nodes; the signed numbers below circles are assigned values. The column vector x lists those same values in node order. Node 3 and entry 3 are highlighted to show the correspondence. One value per node The wiring stays fixed. The values become entries of x. 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 Inside: node ID · below: value Node Value 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 x = Node 3 supplies entry 3.
One value at each node becomes one entry of a vectorThe graph has not changed. We assign plus one to nodes 1 to 4 and minus one to nodes 5 to 8. The numbers inside circles identify nodes; the signed numbers below circles are assigned values. The column vector x lists those same values in node order. Node 3 and entry 3 are highlighted to show the correspondence. One value per node The wiring stays fixed. The values become entries of x. 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 Inside: node ID · below: value Node Value 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 x = Node 3 supplies entry 3.
Two views of the same pattern. The signed numbers beside the nodes become the entries of x. The node numbers say which entry belongs where.

All our links work in both directions and count equally. No node links to itself, and no pair has more than one link. Next we will put the wiring into matrices that compare the assigned values at connected nodes.

2. Turn the wiring into A, D and L

one comparison, written for every node

Start with one node’s comparison

Node 3 holds +1. Its neighbours 1 and 2 also hold +1, while its neighbour 5 holds −1. Subtract each neighbour’s value from node 3’s value, then add the three differences:

(1 − 1) + (1 − 1) + (1 − (−1)) = 2

The two neighbours in the same group contribute zero. The neighbour in the other group contributes 2.

To see how a matrix can do this, regroup the same calculation. Collect the three copies of node 3’s value, then subtract the neighbours’ values together:

(1 − 1) + (1 − 1) + (1 − (−1))
= 3 × 1 − (1 + 1 + (−1))
= 3 − 1 = 2

There are two parts: the node’s own value counted once per neighbour, and the sum of its neighbours’ values. We will build a matrix for each part so we can do the calculation at every node.

A: add the neighbours’ values

Start by recording the wiring. Give every node a row and a column, in node-number order. Eight nodes give us an 8 × 8 table. Put a 1 where the row’s node and the column’s node share an edge, and a 0 everywhere else. This is the adjacency matrix, A. “Adjacent” means joined by an edge.

Multiplying A by x gives a new vector, Ax, with one result per node. The notation (Ax)₃ means its third entry: the result for node 3.

Row 3 has 1s in columns 1, 2 and 5, so it adds the values at those three neighbours. The zeros leave the other values out:

(Ax)₃ = x₁ + x₂ + x₅ = 1 + 1 + (−1) = 1

So node 3’s result in Ax is 1: the sum of its neighbours’ values.

One adjacency row lists one node’s neighboursThe same eight-node graph appears beside its complete eight-by-eight adjacency matrix A. Node 3 and row 3 are highlighted in teal. Node 3 is joined to nodes 1, 2, and 5. Those three neighbours, their incident edges, and the ones in columns 1, 2, and 5 of row 3 are blue. A one records an edge; a zero records no edge. Every diagonal entry is zero because there are no self-edges. Row and column labels are node IDs, not values assigned to the nodes. The graph and matrix are stacked on phones. One row, one node A records which nodes share an edge. Read the links at node 3. 1 2 3 4 5 6 7 8 Linked to nodes 1, 2, and 5. No edge from node 3 to itself. Adjacency matrix A Columns: node IDs Row 1 2 3 4 5 6 7 8 1 0 1 1 1 0 0 0 0 2 1 0 1 1 0 0 0 0 3 1 1 0 0 1 0 0 0 4 1 1 0 0 0 1 0 0 5 0 0 1 0 0 0 1 1 6 0 0 0 1 0 0 1 1 7 0 0 0 0 1 1 0 1 8 0 0 0 0 1 1 1 0 1: there is an edge 0: there is no edge
One adjacency row lists one node’s neighboursThe same eight-node graph appears beside its complete eight-by-eight adjacency matrix A. Node 3 and row 3 are highlighted in teal. Node 3 is joined to nodes 1, 2, and 5. Those three neighbours, their incident edges, and the ones in columns 1, 2, and 5 of row 3 are blue. A one records an edge; a zero records no edge. Every diagonal entry is zero because there are no self-edges. Row and column labels are node IDs, not values assigned to the nodes. The graph and matrix are stacked on phones. One row, one node A records which nodes share an edge. Read the links at node 3. 1 2 3 4 5 6 7 8 Linked to nodes 1, 2, and 5. No edge from node 3 to itself. Adjacency matrix A Columns: node IDs Row 1 2 3 4 5 6 7 8 1 0 1 1 1 0 0 0 0 2 1 0 1 1 0 0 0 0 3 1 1 0 0 1 0 0 0 4 1 1 0 0 0 1 0 0 5 0 0 1 0 0 0 1 1 6 0 0 0 1 0 0 1 1 7 0 0 0 0 1 1 0 1 8 0 0 0 0 1 1 1 0 1: there is an edge 0: there is no edge
One row lists one node's neighbours. Follow the highlighted edges to the three 1s in row 3. The row and column labels are node numbers. The zero on the diagonal says there is no edge from node 3 back to itself.

Every link works in both directions. Edge 3–5 therefore puts a 1 in row 3, column 5, and another in row 5, column 3. These matching entries make A symmetric across its main diagonal.

D: count the node’s own value once per neighbour

Now we need the other part: three copies of node 3’s own value. Its degree tells us how many copies to count.

Put each node’s degree on the main diagonal of a matrix called D, the degree matrix, and put zeros elsewhere. Each row multiplies that node’s value by its degree. For node 3:

(Dx)₃ = 3x₃ = 3
Degree multiplies each node’s own valueThe complete eight-by-eight degree matrix D has threes on its diagonal and zeros elsewhere. All eight nodes in this graph have degree three. Row 3 is highlighted, with its only nonzero entry in column 3. For input value x three equal to plus one, row 3 returns three copies of that same value, giving plus three. The node ID 3 remains unchanged. The seven off-diagonal zeros ensure that none of the other nodes’ values enter this output. Row and column labels are node IDs. Count each node’s own value D puts the degrees on the diagonal. Degree matrix D Columns: node IDs Row 1 2 3 4 5 6 7 8 1 3 0 0 0 0 0 0 0 2 0 3 0 0 0 0 0 0 3 0 0 3 0 0 0 0 0 4 0 0 0 3 0 0 0 0 5 0 0 0 0 3 0 0 0 6 0 0 0 0 0 3 0 0 7 0 0 0 0 0 0 3 0 8 0 0 0 0 0 0 0 3 Each node has degree 3. Keep node 3’s own value Input 3 +1 Output 3 +3 3 copies of x3​ Only the diagonal entry contributes. The other seven entries in row 3 are zero. No neighbours’ values are added.
Degree multiplies each node’s own valueThe complete eight-by-eight degree matrix D has threes on its diagonal and zeros elsewhere. All eight nodes in this graph have degree three. Row 3 is highlighted, with its only nonzero entry in column 3. For input value x three equal to plus one, row 3 returns three copies of that same value, giving plus three. The node ID 3 remains unchanged. The seven off-diagonal zeros ensure that none of the other nodes’ values enter this output. Row and column labels are node IDs. Count each node’s own value D puts the degrees on the diagonal. Degree matrix D Columns: node IDs Row 1 2 3 4 5 6 7 8 1 3 0 0 0 0 0 0 0 2 0 3 0 0 0 0 0 0 3 0 0 3 0 0 0 0 0 4 0 0 0 3 0 0 0 0 5 0 0 0 0 3 0 0 0 6 0 0 0 0 0 3 0 0 7 0 0 0 0 0 0 3 0 8 0 0 0 0 0 0 0 3 Each node has degree 3. Keep node 3’s own value Input 3 +1 Output 3 +3 3 copies of x3​ Only the diagonal entry contributes. The other seven entries in row 3 are zero. No neighbours’ values are added.
D keeps the nodes' values separate. Each diagonal 3 supplies three copies of that node's own value. If the degrees differed, these diagonal entries would differ too.

Every node in our graph has degree three, so D multiplies every entry of x by three. We can write D = 3I, where I is the identity matrix, which returns its input unchanged.

L = D − A: combine the two parts

Dx counts each node’s own value once per neighbour. Ax adds its neighbours’ values. Subtracting the two outputs performs our original comparison at every node:

Lx = Dx − AxAt node 3: (Lx)₃ = 3 − 1 = 2

The matrix L = D − A is called the graph’s Laplacian. Its diagonal entries are the degrees. Each neighbour’s column gets −1, and every other entry is zero.

At node 3, the Laplacian adds three signed differencesNode 3 has value plus one. Its neighbours are nodes 1, 2, and 5, with values plus one, plus one, and minus one. Subtracting each neighbour gives zero, zero, and two. Their sum, two, is entry 3 of Lx. Row 3 of L has 3 at node 3, minus one at its three neighbours, and zeros elsewhere. Look at node 3 and its neighbours 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 Node 3 holds +1. To node 1: +1 − (+1) = 0 To node 2: +1 − (+1) = 0 To node 5: +1 − (−1) = 2 Add the signed differences: (Lx)3​ = 0 + 0 + 2 = 2 Row 3 of L records that rule: 1 −1 2 −1 3 3 4 0 5 −1 6 0 7 0 8 0 Column numbers identify the nodes.
At node 3, the Laplacian adds three signed differencesNode 3 has value plus one. Its neighbours are nodes 1, 2, and 5, with values plus one, plus one, and minus one. Subtracting each neighbour gives zero, zero, and two. Their sum, two, is entry 3 of Lx. Row 3 of L has 3 at node 3, minus one at its three neighbours, and zeros elsewhere. Look at node 3 and its neighbours 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 Node 3 holds +1. To node 1: +1 − (+1) = 0 To node 2: +1 − (+1) = 0 To node 5: +1 − (−1) = 2 Add the signed differences: (Lx)3​ = 0 + 0 + 2 = 2 Row 3 of L records that rule: 1 −1 2 −1 3 3 4 0 5 −1 6 0 7 0 8 0 Column numbers identify the nodes.
The highlighted row records the local comparison. It takes three copies of node 3's value and subtracts the values at neighbours 1, 2 and 5. The row works for any values, not only +1 and −1.

For any node i, row i adds the differences between that node’s value and each neighbour’s value. The summation sign below means “add one term for each neighbour j”:

(Lx)ᵢ = ∑j neighbouring i (xᵢ − xⱼ)
Three machines at node 3Three copies of node 3 with its neighbours 1, 2 and 5. Nodes 1, 2 and 3 hold plus one; node 5 holds minus one. First panel, A: add the neighbours' values, 1 plus 1 plus minus 1, which is 1. Second panel, D: repeat node 3's own value once per link, 3 times 1, which is 3. Third panel, L equals D minus A: 3 minus 1 equals 2, the same as adding the three signed differences 0, 0 and 2 along the links. Three machines at node 3 Same input x: +1 on nodes 1–4, −1 on nodes 5–8 A: collect the neighbours a sum, not an average 1 +1 2 +1 5 −1 3 +1 (Ax)3​ = 1 + 1 + (−1) = 1 D: repeat the own value once per link 1 +1 2 +1 5 −1 3 +1 × 3 (Dx)3​ = 3 × 1 = 3 L = D − A: the difference one signed gap per link 0 0 2 1 +1 2 +1 5 −1 3 +1 (Lx)3​ = 3 − 1 = 0 + 0 + 2 = 2 The differences from node 3 to its neighbours add up to 2.
Three machines at node 3Three copies of node 3 with its neighbours 1, 2 and 5. Nodes 1, 2 and 3 hold plus one; node 5 holds minus one. First panel, A: add the neighbours' values, 1 plus 1 plus minus 1, which is 1. Second panel, D: repeat node 3's own value once per link, 3 times 1, which is 3. Third panel, L equals D minus A: 3 minus 1 equals 2, the same as adding the three signed differences 0, 0 and 2 along the links. Three machines at node 3 Same input x: +1 on nodes 1–4, −1 on nodes 5–8 A: collect the neighbours a sum, not an average 1 +1 2 +1 5 −1 3 +1 (Ax)3​ = 1 + 1 + (−1) = 1 D: repeat the own value once per link 1 +1 2 +1 5 −1 3 +1 × 3 (Dx)3​ = 3 × 1 = 3 L = D − A: the difference one signed gap per link 0 0 2 1 +1 2 +1 5 −1 3 +1 (Lx)3​ = 3 − 1 = 0 + 0 + 2 = 2 The differences from node 3 to its neighbours add up to 2.
Three machines at node 3. A collects what the neighbours hold: 1 + 1 + (−1) = 1. D repeats the node's own value once per link: 3 × 1 = 3. L = D − A takes the difference, 3 − 1 = 2, which is the same as adding the three signed gaps along the links: 0 + 0 + 2.

A, D and L depend only on the wiring. We can assign new values to the nodes by changing x, and the same matrices will compare those values. Each output entry still belongs to the same node.

The differences have signs, so they can cancel. Suppose we give node 3 the value 1 and its neighbours the values 0, 1 and 2. Its result is (1 − 0) + (1 − 1) + (1 − 2) = 0. Here, zero means the node’s value equals its neighbours’ average; the individual neighbours have different values.

We now have a matrix that compares values at connected nodes. Before combining those comparisons into one measurement, we need to decide how to judge whether a division of the network is weak.

3. Measure how weakly a group connects

crossing links relative to group size

Our graph is connected: you can follow edges from any node to any other. Yet removing just two links separates it into two groups of four nodes. We want to measure how weakly a group connects to the rest of the network.

Two links connecting a group of four nodes to the rest give us 2 ÷ 4 = 0.5 crossing links per node. The same two links would mean much less connectivity per node for a group of two hundred.

We call a division into two nonempty groups a cut. To compare cuts, divide the number of crossing links by the number of nodes on the smaller side:

crossing edgesnodes on the smaller side

A lower score means fewer links connect the smaller group to the rest, relative to its size. The crossing edges are also called the group’s boundary.

Why use the smaller side?

Separate node 1 from the other seven nodes. Three links cross that division, so its score is 3 ÷ 1 = 3.

If we divided by the seven nodes on the other side, we would get 3 ÷ 7 ≈ 0.43. The same division would appear much weaker just because we chose the larger group as the denominator. Always using the smaller side gives one answer for the cut, whichever side we name first.

Three groups, scored by handThree copies of the eight-node graph, each with a different group selected in blue and its crossing links in orange. The two halves: 2 crossing links divided by 4 nodes gives 0.5. Node 1 alone: 3 crossing links divided by 1 node gives 3. Nodes 7 and 8: 4 crossing links divided by 2 nodes gives 2. Three groups, scored by hand Score = crossing links ÷ nodes on the smaller side The two halves 1 2 3 4 5 6 7 8 2 crossing links ÷ 4 nodes on the smaller side = 0.5 One node alone 1 2 3 4 5 6 7 8 3 crossing links ÷ 1 node on the smaller side = 3 Two nodes, 7 and 8 1 2 3 4 5 6 7 8 4 crossing links ÷ 2 nodes on the smaller side = 2 Of these three cuts, the two halves have the lowest score. Fewer crossing links per node means a weaker connection.
Three groups, scored by handThree copies of the eight-node graph, each with a different group selected in blue and its crossing links in orange. The two halves: 2 crossing links divided by 4 nodes gives 0.5. Node 1 alone: 3 crossing links divided by 1 node gives 3. Nodes 7 and 8: 4 crossing links divided by 2 nodes gives 2. Three groups, scored by hand Score = crossing links ÷ nodes on the smaller side The two halves 1 2 3 4 5 6 7 8 2 crossing links ÷ 4 nodes on the smaller side = 0.5 One node alone 1 2 3 4 5 6 7 8 3 crossing links ÷ 1 node on the smaller side = 3 Two nodes, 7 and 8 1 2 3 4 5 6 7 8 4 crossing links ÷ 2 nodes on the smaller side = 2 Of these three cuts, the two halves have the lowest score. Fewer crossing links per node means a weaker connection.
The same graph, divided three ways. The two halves score 0.5, node 1 alone scores 3, and nodes 7 and 8 together score 2. Of these three cuts, the two halves have the lowest score.

Find the weakest division

Our four-against-four cut scores 0.5, the lowest of the three examples above. Another division might score even lower.

The lowest score across all cuts is the graph’s edge expansion, written h(G), where G names the graph. A small h(G) means that some group has few links to the rest for its size. Finding a cut with score 0.5 gives us a candidate for that minimum.

Scoring one group is easy. Searching for the lowest score is harder because there are so many groups to try. Checking all nonempty groups of up to half the nodes means 162 candidates for eight nodes, but more than 600 billion for forty.

Comic: checking every groupPanel 1: B sits at a desk with a clipboard and says: Group 161 of 162. Score 2. A asks: How many for forty routers? Panel 2: B says: About six hundred billion. A says: We'll need a matrix. B says: You said that last chapter. Group 161 of 162. Score 2. How many for forty routers? About six hundred billion. We'll need a matrix. You said that last chapter.
Comic: checking every groupPanel 1: B sits at a desk with a clipboard and says: Group 161 of 162. Score 2. A asks: How many for forty routers? Panel 2: B says: About six hundred billion. A says: We'll need a matrix. B says: You said that last chapter. Group 161 of 162. Score 2. How many for forty routers? About six hundred billion. We'll need a matrix. You said that last chapter.
Checking all groups of up to half the nodes means 162 candidates for eight routers and more than 600 billion for forty. We need a way to learn about weak boundaries without checking every group.

Our +1 and −1 labels already mark a proposed division. Next we will use those values to measure its crossing links. This will connect the cut calculation to the Laplacian and give us a way to search for useful divisions through node values.

4. Use node values to test a division

from crossing links to squared differences

Chapter 3 judged a division by its crossing links relative to group size. Our labels from Chapter 1 already tell us which links cross: +1 marks nodes 1–4, and −1 marks nodes 5–8. A crossing link joins opposite signs.

For each edge, subtract the value at one end from the value at the other, then square the difference:

  • Equal values: the difference is zero, so the contribution is zero.
  • Values +1 and −1: the difference is 2 or −2, depending on the reading direction. Either way, its square is 4.

Squaring makes each contribution nonnegative and independent of which way we read the edge. Positive and negative differences cannot cancel.

Add the contributions, counting each edge once. We call this total the pattern’s energy, written E(x). It measures how different the values are across the graph’s edges.

energy = sum of squared differences across edges

With our +1 and −1 labels, energy is four times the number of crossing links. Every crossing link contributes 4; every other link contributes zero.

Compare two divisions

In our two-halves pattern, only edges 3–5 and 4–6 join opposite signs. The energy is 2 × 4 = 8.

Now alternate the signs in node-number order: +1, −1, +1, −1, and so on. We still have four nodes of each sign, but six edges cross between the groups. The energy is 6 × 4 = 24.

The same values can agree with very different numbers of edgesTwo assignments use four plus ones and four minus ones on the same graph. Putting plus ones at nodes 1 to 4 crosses two edges, giving energy 8. Alternating the signs in node order crosses six edges, giving energy 24. Each edge joins equal values and contributes zero, or opposite values and contributes four. Keep each side together 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 2 crossing edges · energy 8 Mix the signs on both sides 1 +1 2 −1 3 +1 4 −1 5 +1 6 −1 7 +1 8 −1 6 crossing edges · energy 24 +1 +1 Gap 0 → square 0 +1 −1 Gap 2 → square 4
The same values can agree with very different numbers of edgesTwo assignments use four plus ones and four minus ones on the same graph. Putting plus ones at nodes 1 to 4 crosses two edges, giving energy 8. Alternating the signs in node order crosses six edges, giving energy 24. Each edge joins equal values and contributes zero, or opposite values and contributes four. Keep each side together 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 2 crossing edges · energy 8 Mix the signs on both sides 1 +1 2 −1 3 +1 4 −1 5 +1 6 −1 7 +1 8 −1 6 crossing edges · energy 24 +1 +1 Gap 0 → square 0 +1 −1 Gap 2 → square 4
Both patterns use four +1 values and four −1 values on the same graph. In the two-halves pattern, two links cross between signs, giving energy 8. Alternating the signs in node-number order gives six crossing links and energy 24. Each crossing link contributes 4.

Here is how energy connects to Chapter 3’s cut score:

Arrangement Crossing links Cut score Energy
Two halves 2 2 ÷ 4 = 0.5 2 × 4 = 8
Alternating signs 6 6 ÷ 4 = 1.5 6 × 4 = 24

Both divisions have four nodes on each side, so fewer crossing links means both a lower cut score and lower energy. For divisions with different group sizes, we must also account for size; energy alone does not do that.

Squared differences also work when node values are not limited to +1 and −1. They make large gaps especially costly: a gap of 3 contributes 9, while three gaps of 1 contribute only 3 in total. Later we will use this calculation to look for patterns that change more gently across the links.

Optional: three pictures explaining the squared differences
Three reasons to square the gapsThree small examples. One: a link between plus one and minus one read left to right gives plus two, read right to left gives minus two, and squaring gives four either way. Two: a node holding 5 between neighbours holding 3 and 7 has signed differences plus two and minus two, which add to zero, while the squares add to eight. Three: one gap of 3 squares to 9, while three gaps of 1 square to 1 plus 1 plus 1, which is 3. Three reasons to square the gaps Read it either way 1 −1 left to right: 1 − (−1) = +2 right to left: −1 − 1 = −2 squared: 4 either way The blind spot 3 5 7 signed gaps at the middle node: (5 − 3) + (5 − 7) = 0 looks peaceful; it isn't (5 − 3)2​ + (5 − 7)2​ = 8 One big gap costs more 0 3 one gap of 3: 32​ = 9 0 1 2 3 three gaps of 1: 1 + 1 + 1 = 3 same total drop, triple the bill Squares never cancel, and one big gap costs more than several small ones.
Three reasons to square the gapsThree small examples. One: a link between plus one and minus one read left to right gives plus two, read right to left gives minus two, and squaring gives four either way. Two: a node holding 5 between neighbours holding 3 and 7 has signed differences plus two and minus two, which add to zero, while the squares add to eight. Three: one gap of 3 squares to 9, while three gaps of 1 square to 1 plus 1 plus 1, which is 3. Three reasons to square the gaps Read it either way 1 −1 left to right: 1 − (−1) = +2 right to left: −1 − 1 = −2 squared: 4 either way The blind spot 3 5 7 signed gaps at the middle node: (5 − 3) + (5 − 7) = 0 looks peaceful; it isn't (5 − 3)2​ + (5 − 7)2​ = 8 One big gap costs more 0 3 one gap of 3: 32​ = 9 0 1 2 3 three gaps of 1: 1 + 1 + 1 = 3 same total drop, triple the bill Squares never cancel, and one big gap costs more than several small ones.
Reading an edge in either direction gives the same squared difference. Squaring also prevents positive and negative gaps from cancelling. A gap of 3 contributes 9, while three gaps of 1 contribute 3 in total.

The Laplacian computes the same energy

Chapter 2 gave us Lx: one result per node, found by adding its differences from its neighbours. Simply adding all the Lx entries gives zero. Each edge appears at both ends with opposite differences, so those contributions cancel.

Instead, multiply each node’s value by its own Lx result, then add. Multiplying matching entries and adding is a dot product. Here it is x · (Lx), also written xᵀLx. This is the input–output dot product from the linear algebra primer, with L as the matrix.

To see why this recovers the energy, follow just edge 3–5. It joins +1 to −1, so its squared gap is 4. In the dot product, this edge contributes at both ends:

  • At node 3: its value +1 multiplies the difference +2, giving (+1) × (+2) = 2.
  • At node 5: its value −1 multiplies the difference −2, giving (−1) × (−2) = 2.

Together, these give 2 + 2 = 4, exactly one squared gap for this edge. Edge 4–6 contributes another 4. Every other edge joins equal values and contributes zero.

Follow one edge from its squared gap into the dot productThe graph and its plus-one and minus-one assignment stay fixed. We isolate edge 3–5, which joins value plus one at node 3 to minus one at node 5. Its gap has magnitude two, giving one squared difference of four. In x transpose L x, this edge supplies a term at each endpoint. At node 3 the term is plus one times plus two, equal to two. At node 5 it is minus one times minus two, also equal to two. The two endpoint products add to four: they are two parts of the same squared difference, not two copies of it. Edge 4–6 gives the other four units of energy. All other edges join equal values and contribute zero, so the whole energy is eight. Follow the same edge Wiring and node values stay fixed. 1. Start with its squared gap +1 3 −1 5 Node IDs: 3 and 5 Gap: 1 − (−1) = 2 One edge energy: 22​ = 4 2. Read it from both ends +1 3 −1 5 Own value × signed difference (+1) × (+2) 2 (−1) × (−2) 2 + = 4 for the same edge 3. Add the edges of the whole graph Edge 3–5: 4 + Edge 4–6: 4 E(x) = xT​Lx = 8 All other edges join equal values.
Follow one edge from its squared gap into the dot productThe graph and its plus-one and minus-one assignment stay fixed. We isolate edge 3–5, which joins value plus one at node 3 to minus one at node 5. Its gap has magnitude two, giving one squared difference of four. In x transpose L x, this edge supplies a term at each endpoint. At node 3 the term is plus one times plus two, equal to two. At node 5 it is minus one times minus two, also equal to two. The two endpoint products add to four: they are two parts of the same squared difference, not two copies of it. Edge 4–6 gives the other four units of energy. All other edges join equal values and contribute zero, so the whole energy is eight. Follow the same edge Wiring and node values stay fixed. 1. Start with its squared gap +1 3 −1 5 Node IDs: 3 and 5 Gap: 1 − (−1) = 2 One edge energy: 22​ = 4 2. Read it from both ends +1 3 −1 5 Own value × signed difference (+1) × (+2) 2 (−1) × (−2) 2 + = 4 for the same edge 3. Add the edges of the whole graph Edge 3–5: 4 + Edge 4–6: 4 E(x) = xT​Lx = 8 All other edges join equal values.
Edge 3–5 has a squared gap of 4. In xᵀLx, its contributions at nodes 3 and 5 are each 2, adding to the same 4. Edge 4–6 contributes another 4, so the total energy is 8.

The full calculation, using one product per node, is:

Nodes Value Lx result Product at each node
1, 2, 7, 8 +1 or −1 0 0
3, 4 +1 +2 2
5, 6 −1 −2 2

The four nonzero products add to 8, the same energy we found from the edges. This equality works for any node values:

E(x) = xᵀLx = ∑edges {i, j} (xᵢ − xⱼ)²

The summation means to add one squared difference per edge. We can calculate energy directly from those gaps or through the Laplacian; both methods give the same nonnegative total.

Optional: the same edge calculation with any two values

For an edge joining nodes i and j, use their values xᵢ and xⱼ in place of +1 and −1. Its two contributions to the dot product are:

xᵢ(xᵢ − xⱼ) + xⱼ(xⱼ − xᵢ) = (xᵢ − xⱼ)²

The two endpoint contributions add to exactly one squared gap. Summing over all edges gives xᵀLx = E(x).

Next, let the values change

The labels +1 and −1 force each node into one of two groups. Allowing values between them, such as 0.3 or −0.6, lets us adjust a pattern gradually. We will look for a pattern with low energy, then use its values to suggest a division of the graph.

But shrinking every value also lowers the energy, even when the arrangement stays the same. Before searching, we need a way to compare patterns fairly. Chapter 5 sets that up.

5. Make the comparison fair

a better arrangement, or just smaller numbers?

Chapter 4 gave us energy: the total squared disagreement across the edges. We want to find node values that keep this total small. But first we need to distinguish a better arrangement from simply using smaller numbers.

Low energy alone is not enough

Give every node zero and the energy is zero. That works on any graph, so it tells us nothing about where the network might divide into groups.

Requiring different values does not solve the problem either. Our four +1 values and four −1 values give energy 8. Halve every value and the energy falls to 2: the gaps halve, so their squares become one quarter as large. We could keep shrinking the numbers without changing their arrangement.

We need to hold the overall spread fixed, then look for the arrangement with the least disagreement across edges.

Measure spread separately from energy

We will measure squared spread by subtracting the average from each node value, squaring each result, and adding them. This primer also calls that quantity variation. It measures how far the values lie from their average, regardless of which nodes are connected.

Energy uses the wiring: it adds the squared differences between values at the ends of each edge.

Rearranging the same values leaves their squared spread unchanged, but can change their energy. Chapter 4’s two patterns show the difference:

Same squared spread, different energyTwo copies of the graph with the two patterns of chapter 4. Left, grouped: plus 1 on nodes 1 to 4, minus 1 on nodes 5 to 8; mean 0, squared spread 8, energy 8, because only the two crossing edges join different values. Right, alternating: plus 1 on the odd nodes and minus 1 on the even ones; mean 0, squared spread 8 again, but energy 24, because six edges join different values. Same squared spread, different energy The two patterns of Chapter 4: four +1 values and four −1 values each time Grouped: +1 left, −1 right the hard split 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 mean 0 · squared spread 8 energy 8: 2 edges disagree Alternating the same eight values, placed differently 1 +1 2 −1 3 +1 4 −1 5 +1 6 −1 7 +1 8 −1 mean 0 · squared spread 8 energy 24: 6 edges disagree Squared spread uses only the values: 8 both times. Energy also looks at the edges: 8 8 for one pattern, 24 for the other.
Same squared spread, different energyTwo copies of the graph with the two patterns of chapter 4. Left, grouped: plus 1 on nodes 1 to 4, minus 1 on nodes 5 to 8; mean 0, squared spread 8, energy 8, because only the two crossing edges join different values. Right, alternating: plus 1 on the odd nodes and minus 1 on the even ones; mean 0, squared spread 8 again, but energy 24, because six edges join different values. Same squared spread, different energy The two patterns of Chapter 4: four +1 values and four −1 values each time Grouped: +1 left, −1 right the hard split 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 mean 0 · squared spread 8 energy 8: 2 edges disagree Alternating the same eight values, placed differently 1 +1 2 −1 3 +1 4 −1 5 +1 6 −1 7 +1 8 −1 mean 0 · squared spread 8 energy 24: 6 edges disagree Squared spread: 8 in both patterns. Energy also depends on the edges: 8 for one pattern, 24 for the other.
Both patterns have mean zero and squared spread 8. The same values produce different energies: 8 for the two halves and 24 for alternating signs. Squared spread depends on the values; energy also depends on which nodes are connected.

To compare any patterns fairly, we will prepare each one in two steps. Subtracting the average removes a level shared by all nodes. Rescaling fixes the squared spread, so shrinking cannot count as an improvement.

First, subtract the average

Suppose we add 10 to every value. The levels +1 and −1 become 11 and 9. Their gap is still 2, so the energy is unchanged. Their distances from the new average, 10, are also unchanged.

Subtract the average, 10, and we get +1 and −1 again. This is called centering. It gives every pattern mean zero while preserving every edge difference and the squared spread.

Mean zero means the values add up to zero. The numbers of positive and negative values need not be equal.

Then, make the squared spread equal to 1

After centering, the average is zero. Subtracting it leaves each value unchanged, so the squared spread is just the sum of the squared values.

Our eight values each have square 1, so their squares add to 8. Divide every value by √8. Each square becomes 1/8, and the eight squares now add to 8 × (1/8) = 1. The node values become approximately +0.354 and −0.354.

Every edge gap is divided by √8 too, so every squared gap is divided by 8. The grouped pattern’s energy changes from 8 to 1; the alternating pattern’s changes from 24 to 3. Both are now compared at squared spread 1.

We choose 1 for convenience; any fixed positive amount would work. It is the sum of the squares that equals 1. Each node can still have its own value.

The search now has two simple rules

mean of the node values = 0
sum of their squared values = 1

An all-equal pattern becomes all zeros when centered. Its squared spread is zero, so it cannot satisfy the second rule. Any pattern with some differences can be centered and rescaled to satisfy both.

We can now search for the lowest energy while holding the squared spread fixed. A lower energy must come from how the differences are arranged across the graph.

Optional: see shifting and shrinking side by side
Shifting values preserves gaps; shrinking values changes gapsEach point represents a level shared by four nodes. On the first number line, shifting minus one and plus one to nine and eleven leaves their gap equal to two, so energy remains eight. On the lower pair of number lines, halving the values moves minus one and plus one to minus one half and plus one half. The gap halves from two to one, so the energy falls from eight to two. Each comparison uses a common scale. Shift every value by the same amount Each dot: a level held by four nodes. Original Add 10 −1 1 9 11 Gap 2 Gap 2 Same gaps. Energy stays 8. Now halve every value x 0 −1 +1 x / 2 0 −½ +½ Half the gaps. One quarter the energy. Energy: 8 → 2
Shifting values preserves gaps; shrinking values changes gapsEach point represents a level shared by four nodes. On the first number line, shifting minus one and plus one to nine and eleven leaves their gap equal to two, so energy remains eight. On the lower pair of number lines, halving the values moves minus one and plus one to minus one half and plus one half. The gap halves from two to one, so the energy falls from eight to two. Each comparison uses a common scale. Shift every value by the same amount Each dot: a level held by four nodes. Original Add 10 −1 1 9 11 Gap 2 Gap 2 Same gaps. Energy stays 8. Now halve every value x 0 −1 +1 x / 2 0 −½ +½ Half the gaps. One quarter the energy. Energy: 8 → 2 Both lower lines use the same scale.
Adding 10 to every value leaves the gaps and energy unchanged. Halving every value halves each gap and quarters the energy. Centering removes the shared level; fixing the squared spread prevents shrinking from counting as an improvement.
Optional: the formulas and a shortcut

Let x̄ be the average of the node values, and V their squared spread:

V = ∑ᵢ (xᵢ − x̄)²

Subtracting the mean preserves V and every edge difference. If V > 0, dividing the centered values by √V makes their squared spread 1 and divides their energy by V.

So energy divided by squared spread gives the energy a pattern would have after centering and rescaling. The hard split gives 8/8 = 1. Halving its values gives 2/2 = 1. Shifting them from ±1 to 9 and 11 gives 8/8 = 1, because their squared distances from the average are still the same.

Four versions of the hard split: energy, squared spread and their ratioFour bead strips, one per version of the pattern, each drawn around its own mean. The hard split: beads at minus one and plus one, energy 8, squared spread 8, ratio 1. Halved: beads at minus one half and plus one half, energy 2, squared spread 2, ratio 1. Shifted by ten: beads at 9 and 11 around a mean of 10, energy 8, squared spread 8 (the sum of squares is 808 before centring), ratio 1. All equal: one bead at the mean, energy 0, squared spread 0, no ratio. Four versions of one pattern What the energy sees, and what centering and rescaling remove energy squared spread energy ÷ squared spread The hard split mean 0 −1 +1 gap 2 8 8 1 Halved mean 0 −½ +½ gap 1 2 2 1 Shifted by +10 mean 10 9 11 gap 2 8 8 1 raw sum of squares: 808 All equal mean 1 1 (all eight) 0 0 — no pattern to score Each strip is drawn around its own mean. The gaps are what the energy sees.
Four versions of the hard split: energy, squared spread and their ratioFour bead strips, one per version of the pattern, each drawn around its own mean. The hard split: beads at minus one and plus one, energy 8, squared spread 8, ratio 1. Halved: beads at minus one half and plus one half, energy 2, squared spread 2, ratio 1. Shifted by ten: beads at 9 and 11 around a mean of 10, energy 8, squared spread 8 (the sum of squares is 808 before centring), ratio 1. All equal: one bead at the mean, energy 0, squared spread 0, no ratio. Four versions of one pattern What the energy sees, and what centering and rescaling remove The hard split mean 0 −1 +1 gap 2 energy 8 · squared spread 8 · ratio 1 Halved mean 0 −½ +½ gap 1 energy 2 · squared spread 2 · ratio 1 Shifted by +10 mean 10 9 11 gap 2 energy 8 · squared spread 8 · ratio 1 (raw sum of squares: 808) All equal mean 1 1 (all eight) energy 0 · squared spread 0 · ratio — no pattern left to score Each strip is drawn around its own mean.
The first three patterns have the same energy divided by squared spread: 1. Shifting or rescaling the values preserves this ratio. A flat pattern has squared spread zero, so the ratio is undefined.

When x already has mean zero, its squared spread is xᵀx. We can then write the comparison as:

R(x) = xᵀLxxᵀxhere, x contains the centered values and is nonzero

This expression is the Rayleigh quotient. It is defined for any nonzero vector, but our comparison uses centered values. For the shifted pattern, the raw sum of squares is 808, while the squared spread around its average is 8. We must subtract the average before using xᵀx as our denominator.

Optional: can an allowed pattern ever have zero energy?

On our connected graph, zero energy requires every pair of neighbours to agree. That agreement travels through the whole graph, forcing a flat pattern. Our two rules exclude it.

If the graph has disconnected pieces, each piece can hold its own constant value. The pieces can have different levels without any edge disagreement. We can then have mean zero, squared spread 1, and zero energy. This will help explain the meaning of a zero second eigenvalue in Chapter 7.

Our starting candidate is the hard split: four values of about +0.354 and four of about −0.354, with energy 1. Chapter 6 will change those values while keeping the mean zero and squared spread 1.

6. Improve the first pattern

can a gentler boundary lower the total?

Our first pattern has energy 1. We will try to lower it by bringing the values closer together where the two groups meet. The wiring stays fixed. Every pattern we compare will have mean zero and squared spread 1.

Start by finding where the disagreement is

In the hard split, nodes 1–4 all have value about +0.354, and nodes 5–8 all have value about −0.354.

All ten edges within the groups join equal values, so they contribute no energy. The two edges between the groups carry all the disagreement. Each contributes 0.5, giving total energy 1.

We will start by reducing those two gaps.

Bring the boundary values closer to zero

The crossing edges join nodes 3 to 5 and nodes 4 to 6. Call these four nodes the boundary nodes. The other four—1, 2, 7 and 8—are the interior nodes.

Move the positive boundary values down toward zero and the negative boundary values up toward zero. The ends of each crossing edge become closer in value, so those edges contribute less energy.

But now the boundary nodes differ from the interior nodes in their own group. Eight internal edges that previously contributed zero begin to contribute energy.

This is the trade-off: we reduce disagreement between the groups by creating some disagreement inside them. Because energy squares the gaps, reducing a large gap can outweigh the cost of introducing several smaller ones. We have to add the contributions to find out.

Keep the comparison fair while the values change

Moving only the boundary values toward zero would also reduce the squared spread. To keep it at 1, we must rescale all eight values.

For a first trial, make each boundary value half as large as the interior value in its group. Before rescaling, we can write this as (1, 1, ½, ½, −½, −½, −1, −1). The mean is zero, and the squares add to 4 × 1 + 4 × ¼ = 5.

Divide every value by √5 to make the squares add to 1. Here are the resulting values compared with our starting pattern:

Pattern Interior values Boundary values Energy
Hard split ±0.354 ±0.354 1
Boundary values half as large ±0.447 ±0.224 0.8

The values shown are rounded. Positive values stay in the first group and negative values stay in the second. The boundary values move toward zero, while the interior values move farther from zero to keep the squared spread at 1. We are changing how the spread is distributed across the graph.

Use t to choose the relative size

The slider calls this boundary-to-interior ratio t:

  • t = 1: boundary and interior values have equal size. This is the hard split.
  • t = ½: each boundary value is half its group’s interior value.
  • t = 0: every boundary value is zero.

At t = ½, the rescaled boundary values are about ±0.224, not ±½. t describes a ratio, not a node’s value. Each slider setting rescales all eight values together, preserving that ratio and keeping the squared spread at 1. The matched positive and negative values keep the mean at zero.

Try the experiment

Start at the hard split, then try t = ½ and t = 0. Watch the total energy. Orange edges show disagreement between the groups; teal edges show disagreement inside them. The displayed values have already been rescaled.

Find the tradeoff between two kinds of edge disagreementEight node values have mean zero and squared spread one. Initially nodes 1 through 4 have value plus one over square root eight, and nodes 5 through 8 have the opposite value. Values are shown beside their nodes. The energy plot shows disagreement within the groups, disagreement between them, and their total. At boundary ratio one, within-group energy is zero and between-group energy is one. At ratio zero, the between-group energy is zero but within-group energy rises to two. Keep the wiring; adjust the values Mean 0 and squared spread 1 in every pattern. 1 +0.354 2 +0.354 3 +0.354 4 +0.354 5 −0.354 6 −0.354 7 −0.354 8 −0.354 Two effects, one total Energy at squared spread 1 0 1 2 0 0.5 1 Boundary ratio t Within the groups 0.000 Between the groups 1.000 Total energy 1.000
Find the tradeoff between two kinds of edge disagreementEight node values have mean zero and squared spread one. Initially nodes 1 through 4 have value plus one over square root eight, and nodes 5 through 8 have the opposite value. Values are shown beside their nodes. The energy plot shows disagreement within the groups, disagreement between them, and their total. At boundary ratio one, within-group energy is zero and between-group energy is one. At ratio zero, the between-group energy is zero but within-group energy rises to two. Keep the wiring; adjust the values Mean 0 and squared spread 1 in every pattern. 1 +0.354 2 +0.354 3 +0.354 4 +0.354 5 −0.354 6 −0.354 7 −0.354 8 −0.354 Two effects, one total Energy at squared spread 1 0 1 2 0 0.5 1 Boundary ratio t Within the groups 0.000 Between the groups 1.000 Total energy 1.000

t sets the boundary values relative to the interior values. At t = ½, they are half as large. All eight values are rescaled together to keep mean 0 and squared spread 1. The wiring stays fixed.

1.000
Energy1.000
Mean0.000
Squared spread1.000
The wiring stays fixed while the node values change. Teal edges show disagreement inside the original groups; orange edges show disagreement between them. Thicker edges have larger gaps. The plot adds both energy contributions, and its marker follows t.

Why moving partway helps

At t = ½, the energy on the crossing edges falls from 1 to 0.4. We have saved 0.6. The new disagreement inside the groups costs 0.4, so the total is 0.8.

The saving is larger than the new cost. Because the squared spread is still 1, the lower energy comes from redistributing the values across the graph.

Why moving all the way to zero is worse

At t = 0, the two crossing edges join zeros, so their energy is zero. But the total energy has risen to 2.

To keep the squared spread at 1, the four interior values are now +0.5, +0.5, −0.5 and −0.5. Eight edges join one of these values to a boundary value of zero. Each has a squared gap of 0.25, and eight contributions of 0.25 add up to 2.

Eliminating all disagreement between the groups creates too much disagreement inside them. Every edge contributes to the same total.

Find the best balance

Moving partway helped; moving all the way to zero went too far. Now try “Best in this family.” The lowest total in this experiment occurs at t ≈ 0.618: boundary values about 62% as large as interior values. The energy is approximately 0.764.

The columns below separate the two sources of energy:

Boundary ratio t Inside groups Between groups Total energy
1: hard split 0 1 1
½ 0.4 0.4 0.8
0: boundary at zero 2 0 2
≈ 0.618: best here ≈ 0.211 ≈ 0.553 ≈ 0.764

What improved, and what stayed the same?

The pattern’s energy fell from 1 to about 0.764. Its positive nodes are still 1–4 and its negative nodes are still 5–8. Dividing by sign therefore gives the same cut: two crossing links for four nodes, with cut score 0.5.

We have found a smoother pattern on the same graph. Once the node values can differ within each group, energy accounts for those differences too; it no longer just counts crossing links. Later we will use the pattern’s values to suggest cuts.

The slider also explored only one family. It kept certain pairs of nodes equal and made the two halves mirror each other. Other patterns could give all eight nodes different values.

Could a pattern outside this family have energy below 0.764? The experiment alone cannot answer that. Chapter 7 will show why no allowed pattern can do better.

Optional: see the rescaling at t = ½
What t meansLeft: the graph before rescaling at t equals one half. The interior nodes 1, 2, 7 and 8 hold plus 1 and minus 1; the boundary nodes 3, 4, 5 and 6 hold plus one half and minus one half. The squared spread is 5, not yet 1. Right: the same pattern after dividing every value by the square root of 5: interior values plus and minus 0.447, boundary values plus and minus 0.224. The ratio is still one half, the squared spread is 1, and the energy is 0.4 between the groups plus 0.4 within them, 0.8 in total. What t means Choose how large a boundary value is compared with an interior value, then rescale Before rescaling: t = ½ interior ±1, boundary ±½ 1 +1 2 +1 3 +½ 4 +½ 5 −½ 6 −½ 7 −1 8 −1 boundary values = ½ × interior values squared spread: 4 × 1 + 4 × ¼ = 5 After rescaling: divide by √5 every value ÷ 2.236 1 +0.447 2 +0.447 3 +0.224 4 +0.224 5 −0.224 6 −0.224 7 −0.447 8 −0.447 boundary values = ½ × interior values energy: between 0.4 + within 0.4 = 0.8 The ratio stays ½, but every value changed, the interior ones too. Mean 0, squared spread 1, energy 0.8.
What t meansLeft: the graph before rescaling at t equals one half. The interior nodes 1, 2, 7 and 8 hold plus 1 and minus 1; the boundary nodes 3, 4, 5 and 6 hold plus one half and minus one half. The squared spread is 5, not yet 1. Right: the same pattern after dividing every value by the square root of 5: interior values plus and minus 0.447, boundary values plus and minus 0.224. The ratio is still one half, the squared spread is 1, and the energy is 0.4 between the groups plus 0.4 within them, 0.8 in total. What t means Choose how large a boundary value is compared with an interior value, then rescale Before rescaling: t = ½ interior ±1, boundary ±½ 1 +1 2 +1 3 +½ 4 +½ 5 −½ 6 −½ 7 −1 8 −1 boundary values = ½ × interior values squared spread: 4 × 1 + 4 × ¼ = 5 After rescaling: divide by √5 every value ÷ 2.236 1 +0.447 2 +0.447 3 +0.224 4 +0.224 5 −0.224 6 −0.224 7 −0.447 8 −0.447 boundary values = ½ × interior values energy: between 0.4 + within 0.4 = 0.8 The ratio stays ½, but every value changed, the interior ones too. Mean 0, squared spread 1, energy 0.8.
At t = ½, boundary values are half the interior values. Before rescaling, the squared spread is 5. Dividing every value by √5 makes it 1 while preserving the ratio. The rescaled pattern has energy 0.8.
Optional: compare the four settings visually
Four slider settings, one scaleFour copies of the graph, one per slider setting, with the rescaled values beside the nodes, orange crossing edges and teal interior edges drawn thicker for bigger gaps, and the two energy parts under each. t = 1: the hard split: values plus or minus 0.354 at the interior nodes and 0.354 at the boundary nodes, crossing gap 0.707, interior gap 0, energy 1 between the groups plus 0 within them, total 1. t = 0.618: the best in this family: values plus or minus 0.425 at the interior nodes and 0.263 at the boundary nodes, crossing gap 0.526, interior gap 0.162, energy 0.553 between the groups plus 0.211 within them, total 0.764. t = ½: values plus or minus 0.447 at the interior nodes and 0.224 at the boundary nodes, crossing gap 0.447, interior gap 0.224, energy 0.4 between the groups plus 0.4 within them, total 0.8. t = 0: boundary nodes at zero: values plus or minus 0.5 at the interior nodes and 0 at the boundary nodes, crossing gap 0, interior gap 0.5, energy 0 between the groups plus 2 within them, total 2. Four settings, one scale Every value shown has been rescaled: mean 0, squared spread 1 t = 1: the hard split 1 +0.354 2 +0.354 3 +0.354 4 +0.354 5 −0.354 6 −0.354 7 −0.354 8 −0.354 crossing gap 0.707 · interior gap 0 energy: between 1 + within 0 = 1 t = 0.618: the best in this family 1 +0.425 2 +0.425 3 +0.263 4 +0.263 5 −0.263 6 −0.263 7 −0.425 8 −0.425 crossing gap 0.526 · interior gap 0.162 energy: between 0.553 + within 0.211 = 0.764 t = ½ 1 +0.447 2 +0.447 3 +0.224 4 +0.224 5 −0.224 6 −0.224 7 −0.447 8 −0.447 crossing gap 0.447 · interior gap 0.224 energy: between 0.4 + within 0.4 = 0.8 t = 0: boundary nodes at zero 1 +0.500 2 +0.500 3 0 4 0 5 0 6 0 7 −0.500 8 −0.500 crossing gap 0 · interior gap 0.5 energy: between 0 + within 2 = 2 As t falls, the orange crossing edges thin and the teal interior edges thicken. The total falls to 0.764 and then rises again.
Four slider settings, one scaleFour copies of the graph, one per slider setting, with the rescaled values beside the nodes, orange crossing edges and teal interior edges drawn thicker for bigger gaps, and the two energy parts under each. t = 1: the hard split: values plus or minus 0.354 at the interior nodes and 0.354 at the boundary nodes, crossing gap 0.707, interior gap 0, energy 1 between the groups plus 0 within them, total 1. t = 0.618: the best in this family: values plus or minus 0.425 at the interior nodes and 0.263 at the boundary nodes, crossing gap 0.526, interior gap 0.162, energy 0.553 between the groups plus 0.211 within them, total 0.764. t = ½: values plus or minus 0.447 at the interior nodes and 0.224 at the boundary nodes, crossing gap 0.447, interior gap 0.224, energy 0.4 between the groups plus 0.4 within them, total 0.8. t = 0: boundary nodes at zero: values plus or minus 0.5 at the interior nodes and 0 at the boundary nodes, crossing gap 0, interior gap 0.5, energy 0 between the groups plus 2 within them, total 2. Four settings, one scale Every value shown has been rescaled: mean 0, squared spread 1 t = 1: the hard split 1 +0.354 2 +0.354 3 +0.354 4 +0.354 5 −0.354 6 −0.354 7 −0.354 8 −0.354 crossing gap 0.707 · interior gap 0 energy: between 1 + within 0 = 1 t = 0.618: the best in this family 1 +0.425 2 +0.425 3 +0.263 4 +0.263 5 −0.263 6 −0.263 7 −0.425 8 −0.425 crossing gap 0.526 · interior gap 0.162 energy: between 0.553 + within 0.211 = 0.764 t = ½ 1 +0.447 2 +0.447 3 +0.224 4 +0.224 5 −0.224 6 −0.224 7 −0.447 8 −0.447 crossing gap 0.447 · interior gap 0.224 energy: between 0.4 + within 0.4 = 0.8 t = 0: boundary nodes at zero 1 +0.500 2 +0.500 3 0 4 0 5 0 6 0 7 −0.500 8 −0.500 crossing gap 0 · interior gap 0.5 energy: between 0 + within 2 = 2 As t falls, the orange crossing edges thin and the teal interior edges thicken. The total falls to 0.764 and then rises again.
Every pattern has mean zero and squared spread 1. Moving the boundary values toward zero reduces the crossing gaps but increases gaps inside the groups. The total energy falls from 1 to about 0.764, then rises to 2.
Optional: the formula behind the experiment

Before rescaling, write the pattern as (1, 1, t, t, −t, −t, −1, −1). Its squared spread is 4 + 4t².

Eight internal edges have gap 1 − t, so their combined energy is 8(1 − t)². Two crossing edges have gap 2t, giving combined energy 8t². The other two edges, 1–2 and 7–8, join equal values and contribute zero.

Divide the energy by the squared spread to get the energy after rescaling:

E(t) = 8(1 − t)² + 8t²4 + 4t²

The numerator adds the two sources of disagreement. The denominator keeps the comparison at squared spread 1. The minimum over the slider’s settings occurs at t = (√5 − 1)/2 ≈ 0.618, with energy 3 − √5 ≈ 0.764.

7. Can any pattern do better?

why the second eigenvector wins

The slider found energy about 0.764 while keeping pairs of nodes equal and the two halves as mirror images. Could a pattern outside that family do better? We need an argument that covers every possible assignment of node values.

The key is to describe every pattern using the Laplacian’s eigenvectors. We will see why every allowed pattern’s energy is an average of their energies, and why that average cannot fall below about 0.764.

First, remember what we are comparing

A pattern assigns one value to each node. Its energy adds the squared differences across the edges. We compare patterns that follow Chapter 5’s two rules:

  • Mean zero: remove the level shared by all nodes.
  • Squared values adding to 1: fix the squared spread, so shrinking cannot count as an improvement.

The hard split has energy 1. The slider reached about 0.764. We want the minimum among all patterns obeying these rules.

Eigenvectors give us eight building blocks

In the linear algebra primer, our vectors had two entries. Here a vector has eight entries, one value per node. The eigenvector idea is the same: apply L, and every entry is multiplied by the same number. The pattern is an eigenvector; that multiplier is its eigenvalue.

Our edges are undirected, so L is symmetric. The spectral theorem from linear algebra tells us that we can choose eight mutually perpendicular eigenvectors and use them to describe every pattern. Each eigenvector is a whole eight-node pattern. Multiplying these patterns by coefficients and adding their matching entries lets us build any assignment of values.

We scale each eigenvector to unit length, meaning its squared entries add to 1. We name them u₁, u₂, …, u₈, ordered by their eigenvalues λ₁, λ₂, …, λ₈ from smallest to largest. The subscript identifies a pattern in this list, not a node.

For example, u₂ is the pattern we found with the slider. Applying L multiplies all its values by λ₂ ≈ 0.764:

Applying L scales every value in an eigenvector patternInput u2 has node values approximately 0.425, 0.425, 0.263, 0.263, minus 0.263, minus 0.263, minus 0.425, minus 0.425. The output L u2 multiplies every one by lambda2, approximately 0.764. The two plots have the same vertical scale. Their horizontal axis is node ID; it does not show positions in the network. L changes the size, not the pattern Every node value is multiplied by the same number: λ2​ ≈ 0.764. Input: u2​ One value for each of the eight nodes. Node value +0.5 0 −0.5 1 2 3 4 5 6 7 8 Node ID Output: L u2​ The same pattern, scaled by 0.764. Node value +0.5 0 −0.5 1 2 3 4 5 6 7 8 Node ID These axes show node values. They do not show positions in the network.
Applying L scales every value in an eigenvector patternInput u2 has node values approximately 0.425, 0.425, 0.263, 0.263, minus 0.263, minus 0.263, minus 0.425, minus 0.425. The output L u2 multiplies every one by lambda2, approximately 0.764. The two plots have the same vertical scale. Their horizontal axis is node ID; it does not show positions in the network. L keeps this pattern Every node value is multiplied by the same number: λ2​ ≈ 0.764. Input: u2​ One value for each of the eight nodes. Node value +0.5 0 −0.5 1 2 3 4 5 6 7 8 Node ID Output: L u2​ The same pattern, scaled by 0.764. Node value +0.5 0 −0.5 1 2 3 4 5 6 7 8 Node ID These axes show values, not graph positions.
Applying L to u₂ multiplies every entry by λ₂ ≈ 0.764. Both plots use the same scale. The horizontal axis gives node numbers; the vertical axis gives their values.

Why a unit eigenvector’s energy equals its eigenvalue

Chapter 4 wrote energy as the dot product of a pattern and its output. For an eigenvector u, that output is λu. Its energy is therefore λ times the sum of its squared entries. We chose that sum to be 1:

E(u) = u · (λu)
= λ(u · u) = λ × 1 = λ

u₂ is a pattern with eight entries. λ₂ is one number: its multiplier under L and, at unit length, its energy. Here are all eight eigenvalues for our graph:

Unit eigenvector Eigenvalue and energy
u₁: every node has the same value λ₁ = 0
u₂ λ₂ ≈ 0.764
u₃ λ₃ = 2
u₄ through u₇ 4 each
u₈ λ₈ ≈ 5.236

These numbers come from L, which records the graph’s wiring. Different eigenvectors can have the same eigenvalue, as the four entries with energy 4 show.

Why the zero-energy pattern is set aside

The first eigenvector, u₁, is flat: every node holds the same value. Every edge joins equal values, giving energy zero.

Center it and every value becomes zero. Its squared spread is then zero, so it cannot satisfy our two rules.

The other seven eigenvectors are perpendicular to u₁. Since u₁ has the same entry everywhere, a dot product with u₁ is just a constant times the sum of the other pattern’s entries. Perpendicularity makes that dot product zero, so each of the other eigenvectors has entries that add to zero.

Adding any amount of u₁ would add a shared level. The mean-zero rule requires its coefficient to be zero, leaving u₂ through u₈ as the building blocks for allowed patterns. The lowest energy among them is about 0.764.

What happens when we mix the remaining patterns?

We still need to check whether combining these patterns could lower the energy further. Take this example:

x = 0.6u₂ + 0.8u₃

The numbers 0.6 and 0.8 are coefficients. Each multiplies a whole eight-node pattern. Since these unit eigenvectors are perpendicular, their contributions to squared spread add:

Pattern Coefficient Share of squared spread
u₂ 0.6 0.6² = 0.36, or 36%
u₃ 0.8 0.8² = 0.64, or 64%

The shares add to 1, so the mixture has squared spread 1. It also has mean zero because both building blocks do.

L only rescales each eigenvector, so the pieces remain perpendicular after applying L. Their contributions to the energy dot product add too: each squared coefficient multiplies that eigenvector’s energy.

E(x) ≈ 0.36 × 0.764 + 0.64 × 2
≈ 1.555

The coefficients are 0.6 and 0.8; the energy weights are their squares, 0.36 and 0.64. These percentages describe shares of squared spread. Each building block still assigns a value to every node.

This is a weighted average: 36% at energy about 0.764 and 64% at energy 2. Mixing in the higher-energy pattern has raised the total above 0.764.

The same rule applies to any allowed mixture of u₂ through u₈. Its coefficients can be positive or negative, but their squares are nonnegative and add to 1. The energy is the weighted average of the corresponding eigenvalues.

An average cannot be smaller than the smallest number being averaged. Here that smallest energy is about 0.764. This reasoning covers every allowed pattern, because every one is a mixture of these building blocks.

There are two parts to the conclusion. No allowed pattern can go lower than the energy of u₂. And u₂ itself is allowed and reaches that energy. Together, these facts establish the minimum.

The minimum is λ₂

The smallest eigenvalue left after removing the flat pattern is λ₂. It gives the minimum energy under our two rules:

λ₂ = 3 − √5 ≈ 0.764the lowest energy of any mean-zero pattern with total squared spread 1

What does u₂ look like? It is the slider’s winning pattern from Chapter 6, at t ≈ 0.618. Its values, rounded to three decimal places, are:

Nodes Value at each node
1 and 2: left interior +0.425
3 and 4: left boundary +0.263
5 and 6: right boundary −0.263
7 and 8: right interior −0.425

The boundary values sit closer to zero than the interior values. That is the compromise we saw in Chapter 6: it reduces disagreement between the groups while allowing some disagreement inside them.

An eigenvector for λ₂ is called a Fiedler vector, and λ₂ is called the graph’s algebraic connectivity. Reversing every sign gives an equally good pattern, since squared differences do not change.

The slider found the best pattern because this particular family included u₂. A different restricted family might miss it. The eigenvector argument is what lets us rule out a better answer anywhere else.

Optional: the weighted-average formula for all seven patterns

Write an allowed pattern as a mixture of the seven available building blocks:

x = c₂u₂ + ⋯ + c₈u₈

The coefficients c₂ through c₈ multiply whole patterns. Perpendicularity makes their squared-length contributions add. Every pattern here has mean zero, so squared length is also squared spread. Our fixed-spread rule says:

c₂² + ⋯ + c₈² = 1

Chapter 4 wrote energy as x · Lx. L multiplies each eigenvector uᵢ by its own eigenvalue λᵢ. When we expand the dot product, terms involving two different eigenvectors vanish because those vectors are perpendicular. What remains is:

E(x) = λ₂c₂² + ⋯ + λ₈c₈²

The weights cᵢ² are nonnegative and add to 1. Every λᵢ here is at least λ₂, giving E(x) ≥ λ₂. Choosing x = u₂ gives equality.

Optional: what if the graph has more nodes, or is disconnected?

The same reasoning works for an undirected graph of any size. With 100,000 nodes, there are 100,000 building blocks. Removing the shared level leaves 99,999. The weighted-average argument still gives the minimum immediately once the eigenvalues are ordered; it does not require trying every possible pattern.

On a connected graph, zero energy forces every pair of neighbours to agree. That agreement travels through the graph until all nodes have the same value. So the flat direction is the only zero-energy direction, and λ₂ is positive.

If the graph has two disconnected pieces, each piece can hold its own constant value. One can sit above zero and the other below, chosen so the overall mean is zero. No edge connects the pieces, so no edge sees a difference. After rescaling, this is an allowed pattern with energy zero. A second zero eigenvalue appears, and λ₂ becomes zero.

Zero energy means equal neighboursTwo copies of the graph. Left, connected: every node carries the same letter c, because zero energy means both ends of every link agree, and following links from node to node makes all eight equal. Right, with the two links 3–5 and 4–6 removed and drawn as faint dashes: the left four nodes carry the letter a and the right four carry b. The two levels can differ and the energy is still zero. Zero energy means equal neighbours Energy 0 means both ends of every link agree Connected: one level 1 2 3 4 5 6 7 8 c c c c c c c c 1 agrees with 3, 3 with 5, 5 with 7, and so on. All eight share any one common value. Two pieces: two levels 1 2 3 4 5 6 7 8 a a a a b b b b a and b can differ. The energy is still 0. Each half can choose its own level. Connected nodes must share one level to have zero energy. Remove the two links, and the halves can have different levels.
Zero energy means equal neighboursTwo copies of the graph. Left, connected: every node carries the same letter c, because zero energy means both ends of every link agree, and following links from node to node makes all eight equal. Right, with the two links 3–5 and 4–6 removed and drawn as faint dashes: the left four nodes carry the letter a and the right four carry b. The two levels can differ and the energy is still zero. Zero energy means equal neighbours Energy 0 means both ends of every link agree Connected: one level 1 2 3 4 5 6 7 8 c c c c c c c c 1 agrees with 3, 3 with 5, 5 with 7, and so on. All eight share any one common value. Two pieces: two levels 1 2 3 4 5 6 7 8 a a a a b b b b a and b can differ. The energy is still 0. Each half can choose its own level. Connected nodes must share one level to have zero energy. Remove the two links, and each half can have its own level.
Zero energy requires equal values at the ends of every edge. On the connected graph, all eight nodes must share one common value. Removing the two links lets each half have its own value while keeping energy zero.

We now have the node values that minimize energy. Chapter 8 asks how to use those values to propose a division into two groups. Finding the best real-valued pattern and finding the best cut are separate steps.

8. Turn the answer back into a cut

use the values to propose two groups

The minimum-energy pattern is a list of numbers. To make a cut, we still have to decide which nodes belong on each side. We will use the numbers to propose cuts, then count the original graph’s crossing edges to judge them.

Put the nodes in order by their values

An edge with a large gap between its endpoint values contributes a lot of energy. The Fiedler pattern minimizes total energy, so it tends to keep connected nodes close in value. Sorting the nodes by these values gives us a useful place to look for a division.

Sort the nodes from the most negative value to the most positive:

Nodes, in increasing value order Value at each node
7 and 8 −0.425
5 and 6 −0.263
3 and 4 +0.263
1 and 2 +0.425

The values are rounded here. In this graph, the two nodes in each pair have exactly equal values.

Choose a number between two different node values. This number is the threshold: put every node whose value is below it into one group, and the remaining nodes into the other. Moving the threshold changes group membership while the wiring and node values stay fixed.

Zero is one possible threshold. The best cut may come from another gap, so we will try each gap and compare the cut scores.

Try one threshold completely

Choose −0.34, which lies between −0.425 and −0.263. Nodes 7 and 8 have value −0.425, below the threshold. Every other node has a higher value. The chosen group is therefore {7, 8}, with nodes 1–6 on the other side.

Look back at the original graph. Four edges leave {7, 8}: 5–7, 5–8, 6–7 and 6–8. The smaller group has two nodes, so the cut score is:

cut score = 4 crossing edges2 nodes on the smaller side = 2

That is one complete candidate: the threshold proposes the groups, and the original edges determine the score.

Move it once and see what changes

Move the threshold to 0, between −0.263 and +0.263. Nodes 5 and 6 now fall below it and join the chosen group: {5, 6, 7, 8}.

The four edges we just counted no longer cross the cut. Both ends of each now lie inside the chosen group. Only edges 3–5 and 4–6 leave it.

We now have two crossing edges and four nodes on each side. The score is 2/4 = 0.5, an improvement over 2.

From the first threshold to the secondTwo copies of the graph. Left: the group is nodes 7 and 8; the four edges 5–7, 5–8, 6–7 and 6–8 cross, score 4 over 2 equals 2. Right: the group is nodes 5, 6, 7 and 8; those four edges now lie inside the group and are drawn teal, while the two bridge edges 3–5 and 4–6 cross, score 2 over 4 equals 0.5. From the first threshold to the second Adding nodes 5 and 6 to the group changes which edges cross Group {7, 8} 1 2 3 4 5 6 7 8 crossing: 5–7, 5–8, 6–7, 6–8 4 crossing ÷ 2 nodes = 2 Group {5, 6, 7, 8} 1 2 3 4 5 6 7 8 crossing: 3–5, 4–6 teal: 5–7, 5–8, 6–7, 6–8 now inside 2 crossing ÷ 4 nodes = 0.5 The four edges that crossed now join members of the group. Only the two bridge edges cross. Four became two while the group doubled.
From the first threshold to the secondTwo copies of the graph. Left: the group is nodes 7 and 8; the four edges 5–7, 5–8, 6–7 and 6–8 cross, score 4 over 2 equals 2. Right: the group is nodes 5, 6, 7 and 8; those four edges now lie inside the group and are drawn teal, while the two bridge edges 3–5 and 4–6 cross, score 2 over 4 equals 0.5. From the first threshold to the second Adding nodes 5 and 6 to the group changes which edges cross Group {7, 8} 1 2 3 4 5 6 7 8 crossing: 5–7, 5–8, 6–7, 6–8 4 crossing ÷ 2 nodes = 2 Group {5, 6, 7, 8} 1 2 3 4 5 6 7 8 crossing: 3–5, 4–6 teal: 5–7, 5–8, 6–7, 6–8 now inside 2 crossing ÷ 4 nodes = 0.5 The four edges that crossed now join members of the group. Only the two bridge edges cross. Four became two while the group doubled.
At threshold −0.34, the group {7, 8} has four crossing edges. Moving the threshold to 0 adds nodes 5 and 6. Those four edges become internal, shown in teal, and only edges 3–5 and 4–6 cross the new cut.

Adding nodes has reduced the number of crossing edges. We find the score by checking the wiring for each proposed group.

Check the remaining gap

Choose +0.34, between +0.263 and +0.425. Nodes 3 and 4 join the chosen group, giving {3, 4, 5, 6, 7, 8}, with {1, 2} on the other side.

Four edges cross this division. Although the chosen group has six nodes, the smaller group has two. The score is therefore 4/2 = 2.

Example threshold Nodes below it Cut score
−0.34 {7, 8} 4 ÷ 2 = 2
0 {5, 6, 7, 8} 2 ÷ 4 = 0.5
+0.34 {3, 4, 5, 6, 7, 8} 4 ÷ 2 = 2

Try the three positions below. Follow which nodes change sides and which original edges become crossing edges.

Turn a Fiedler ordering into an actual cutThe graph carries a highlighted set of nodes. Crossing edges are orange. In the numerical placement each node’s horizontal position is its Fiedler-vector value. Equal values are stacked vertically for legibility, without changing their horizontal position. A dashed threshold selects every node to its left. The initial threshold sits in the first gap and selects nodes 7 and 8, with four crossing edges, a smaller side of two nodes, and cut score four divided by two, which is two. Values suggest an order; a cut picks a side Orange edges cross the chosen boundary. 1 2 3 4 5 6 7 8 Horizontal position = Fiedler value Choose every node left of the line. 1 2 3 4 5 6 7 8 −0.425 −0.263 0.263 0.425 0 Equal values stay together when we move the threshold.
Turn a Fiedler ordering into an actual cutThe graph carries a highlighted set of nodes. Crossing edges are orange. In the numerical placement each node’s horizontal position is its Fiedler-vector value. Equal values are stacked vertically for legibility, without changing their horizontal position. A dashed threshold selects every node to its left. The initial threshold sits in the first gap and selects nodes 7 and 8, with four crossing edges, a smaller side of two nodes, and cut score four divided by two, which is two. Values give an order. A cut chooses a side. Orange edges cross the chosen boundary. 1 2 3 4 5 6 7 8 Horizontal position = Fiedler value Choose every node left of the line. 1 2 3 4 5 6 7 8 −0.425 −0.263 0.263 0.425 0 Equal-valued nodes stay together.

Choose one of the three gaps. Nodes below the threshold form the blue group; orange edges cross to the other group. The wiring and node values stay fixed. The threshold readout is rounded.

≈ −0.34
Crossing edges4
Smaller side2
Cut score2.000

Selected nodes: 7, 8.

Horizontal position shows each node’s Fiedler value. Nodes below the dashed threshold form the selected group. Equal values are stacked vertically for readability and always stay on the same side of the threshold.

Why are there only three candidates?

There are four distinct values, leaving three gaps between them. Any threshold within the same gap selects the same nodes. For example, −0.34 and −0.35 both select {7, 8}.

A threshold also cannot separate two nodes with exactly equal values. They stay together. Moving beyond all the values would put every node on one side, which is not a valid cut.

Trying the gaps in order and comparing their scores is called a sweep. With n nodes, there are at most n − 1 threshold cuts. Here we check three, out of the graph’s 127 possible cuts.

What did the sweep establish?

The second threshold gives the best cut among these three candidates, with score 0.5.

Chapter 7 proved the lowest possible pattern energy, about 0.764. The sweep found a cut score of 0.5 by checking only the cuts from this ordering. That does not establish the best score across all cuts.

We therefore have a good candidate and a new question: could a cut outside this list score much lower? Chapter 9 uses λ₂ to limit how much better an unseen cut could be.

Optional: see all three candidate cuts side by side
Three thresholds, three candidate cutsThree rows, one per threshold. In each, the eight nodes sit on a number line at their Fiedler values, 0.425 for nodes 1 and 2, 0.263 for 3 and 4, minus 0.263 for 5 and 6, minus 0.425 for 7 and 8, with a dashed threshold in one of the three gaps; the nodes left of it form the group S, shown filled on a copy of the graph with the crossing edges in orange. After the first pair: S is 7, 8; crossing edges 5–7, 5–8, 6–7, 6–8; smaller side min of 2 and 6, which is 2; score 4 over 2 equals 2. After the second pair: S is 5, 6, 7, 8; crossing edges 3–5 and 4–6; smaller side 4; score 2 over 4 equals 0.5. After the third pair: S is 3, 4, 5, 6, 7, 8; crossing edges 1–3, 1–4, 2–3, 2–4; smaller side min of 6 and 2, which is 2; score 4 over 2 equals 2. Three thresholds, three candidate cuts Horizontal position is the Fiedler value; equal values share a position and move together. After the first pair 1 2 3 4 5 6 7 8 −0.425 −0.263 0.263 0.425 threshold −0.34 1 2 3 4 5 6 7 8 S = {7, 8} crossing edges: 5–7, 5–8, 6–7, 6–8 smaller side: min(2, 6) = 2 score 4 ÷ 2 = 2 After the second pair 1 2 3 4 5 6 7 8 −0.425 −0.263 0.263 0.425 threshold 0 1 2 3 4 5 6 7 8 S = {5, 6, 7, 8} crossing edges: 3–5, 4–6 smaller side: min(4, 4) = 4 score 2 ÷ 4 = 0.5 After the third pair 1 2 3 4 5 6 7 8 −0.425 −0.263 0.263 0.425 threshold 0.34 1 2 3 4 5 6 7 8 S = {3, 4, 5, 6, 7, 8} crossing edges: 1–3, 1–4, 2–3, 2–4 smaller side: min(6, 2) = 2 score 4 ÷ 2 = 2 Four distinct values leave three gaps, so the sweep has three candidates. The second threshold gives the lowest score of the three.
Three thresholds, three candidate cutsThree rows, one per threshold. In each, the eight nodes sit on a number line at their Fiedler values, 0.425 for nodes 1 and 2, 0.263 for 3 and 4, minus 0.263 for 5 and 6, minus 0.425 for 7 and 8, with a dashed threshold in one of the three gaps; the nodes left of it form the group S, shown filled on a copy of the graph with the crossing edges in orange. After the first pair: S is 7, 8; crossing edges 5–7, 5–8, 6–7, 6–8; smaller side min of 2 and 6, which is 2; score 4 over 2 equals 2. After the second pair: S is 5, 6, 7, 8; crossing edges 3–5 and 4–6; smaller side 4; score 2 over 4 equals 0.5. After the third pair: S is 3, 4, 5, 6, 7, 8; crossing edges 1–3, 1–4, 2–3, 2–4; smaller side min of 6 and 2, which is 2; score 4 over 2 equals 2. Three thresholds, three candidate cuts Horizontal position is the Fiedler value; equal values share a position. After the first pair 1 2 3 4 5 6 7 8 −0.425 −0.263 0.263 0.425 threshold −0.34 1 2 3 4 5 6 7 8 S = {7, 8} crossing edges: 5–7, 5–8, 6–7, 6–8 smaller side: min(2, 6) = 2 score 4 ÷ 2 = 2 After the second pair 1 2 3 4 5 6 7 8 −0.425 −0.263 0.263 0.425 threshold 0 1 2 3 4 5 6 7 8 S = {5, 6, 7, 8} crossing edges: 3–5, 4–6 smaller side: min(4, 4) = 4 score 2 ÷ 4 = 0.5 After the third pair 1 2 3 4 5 6 7 8 −0.425 −0.263 0.263 0.425 threshold 0.34 1 2 3 4 5 6 7 8 S = {3, 4, 5, 6, 7, 8} crossing edges: 1–3, 1–4, 2–3, 2–4 smaller side: min(6, 2) = 2 score 4 ÷ 2 = 2 Four distinct values leave three gaps, so the sweep has three candidates. The second threshold gives the lowest score of the three.
Each row shows one threshold, the nodes it selects, and the resulting cut score. In the last row, six nodes are selected but the smaller side has two nodes, so the score is 4 ÷ 2 = 2.
Optional: signs, scale, and group sizes

Reversing every sign reverses the ordering and swaps the sides of the sweep cuts. Their scores do not change. Multiplying all values by a positive number stretches the value axis while leaving the ordering and the candidate groups unchanged.

Mean zero does not require equal numbers of positive and negative entries. A few large positive values can balance many small negative ones. The balanced winning cut here comes from this graph’s symmetry.

Optional: does a sweep need to recount every edge for every cut?

No. When a node moves into the chosen group, only its incident edges can change crossing status. An edge to a node already inside stops crossing; an edge to a node still outside starts crossing. The sweep can update its crossing count as it moves.

Nodes with equal values move together, and we score the cut after the whole group has moved.

9. What the eigenvalue says about unseen cuts

could another cut be much better?

Chapter 8 found a cut with two crossing edges and four nodes on each side, giving a score of 2/4 = 0.5. Recall that h(G) is the lowest score among all cuts. We want to know how much lower an unseen cut could score.

Chapter 7 found the lowest pattern energy, λ₂ ≈ 0.764. Energy adds squared differences across edges; a cut score counts crossing edges and divides by the smaller group size. To connect the two measurements, we will turn a cut into a pattern.

A cut can be turned into a pattern

Imagine someone hands us a proposed cut. Give every node on one side the same value, and every node on the other side a different value.

Every edge within a group joins equal values, so it contributes zero energy. Only edges crossing between the groups contribute energy.

We must still follow Chapter 7’s rules. Subtract the mean, then rescale the values so their squares add up to 1. The result is an allowed pattern, so its energy cannot be below λ₂.

After centering and rescaling, the pattern’s energy can be written as two terms:

rescaled pattern energy
= crossing edgesnodes in smaller group
+ crossing edgesnodes in larger group

The first term is the cut score. The second counts the same crossing edges but divides by the larger group size, so it cannot be greater than the first. Adding the two terms gives at most twice the cut score. The optional calculation below derives this energy formula.

For our two halves, the terms are equal: 2/4 + 2/4 = 1. This is Chapter 6’s hard-split energy. Its cut score is 0.5, and its energy is exactly twice that. With unequal group sizes, the second term is smaller, so the energy is less than twice the score.

Every cut therefore gives us an allowed pattern satisfying:

energy of the pattern made from a cut
≤ 2 × that cut’s score

Try an impossibly good cut

Suppose someone claims to have found a cut scoring 0.1. Our construction would turn it into an allowed pattern with energy at most 0.2.

But Chapter 7 proved that every allowed pattern has energy at least about 0.764. The proposed cut would produce a pattern below that proven minimum. Therefore, that cut cannot exist.

The same argument applies to every cut. Since the pattern’s energy is at least λ₂ and at most twice the cut score, we get:

every cut score ≥ λ₂2for our graph, this lower limit is approximately 0.382

This is the lower bound. It applies even to cuts we never examine. A sufficiently low-scoring cut would contradict the minimum energy we already know.

How close is our cut to the best possible score?

Every cut scores at least about 0.382. We also have an actual cut scoring 0.5, so the best score cannot be above 0.5. Together, these facts give:

λ₂2 ≤ h(G) ≤ 0.5the lower limit is about 0.382; the upper limit comes from our cut

This answers our opening question: no unseen cut can improve on 0.5 by more than about 0.118. We obtained that guarantee without checking every cut.

Does low energy also guarantee a low-scoring cut?

So far, we have gone from a cut to a pattern. The other direction asks: if λ₂ is small, must a low-scoring cut exist?

The answer is yes. The pattern’s values may change gradually across the graph, so we use a threshold sweep to look for a cut, as in Chapter 8.

An edge crosses the cut only when the threshold lies between its two endpoint values. Low energy keeps the sum of squared gaps small, and a small gap leaves only a narrow interval of thresholds that separate that edge’s endpoints.

That is the intuition. A full proof must also account for group sizes. It establishes that at least one threshold cut has a score no greater than √(2dλ₂), where d is the number of links at each node. A smaller λ₂ makes this guarantee stronger.

Cheeger’s inequality puts both directions together

For our kind of graph—undirected, with every node having the same degree d—the two guarantees can be written as:

λ₂2 ≤ h(G) ≤ √(2dλ₂)h(G) is the lowest cut score; λ₂ comes from L = D − A

This is a form of Cheeger’s inequality. Read its two sides separately:

  • The left side limits every cut. No cut scores below λ₂/2.
  • The right side guarantees that a cut exists. At least one cut scores no more than √(2dλ₂). Other cuts can score much higher.

Here d = 3. Using λ₂ ≈ 0.764, the theorem alone gives a range from about 0.382 to 2.141. Our actual cut provides the tighter upper bound of 0.5. The theorem’s upper bound is a general guarantee; a cut we find can do much better.

What establishes the exact answer?

Our range leaves open whether some cut scores between about 0.382 and 0.5. For this small graph, we can check all 127 distinct cuts. That check finds none below 0.5, establishing h(G) = 0.5 exactly.

Three sources of knowledge about the weakest cutThree rows use the same horizontal scale for edge expansion h. First, Cheeger alone gives an interval from 0.382 to 2.141. Second, the cut actually found by the sweep gives the tighter upper bound 0.5, leaving the interval 0.382 to 0.5. This combines a lower bound that covers every cut with an upper bound from one candidate. Third, checking every cut in this small graph establishes the exact value h=0.5. Neither of the first two steps establishes that exact equality. Three levels of evidence Each row is about the same quantity: h(G). 1. The theorem 0.382 ≤ h(G) ≤ 2.141 0 1 2 2. Add the cut we found 0.382 ≤ h(G) ≤ 0.5 0 1 2 3. Check every cut h(G) = 0.5 0 1 2 Scale: boundary edges per node
Three sources of knowledge about the weakest cutThree rows use the same horizontal scale for edge expansion h. First, Cheeger alone gives an interval from 0.382 to 2.141. Second, the cut actually found by the sweep gives the tighter upper bound 0.5, leaving the interval 0.382 to 0.5. This combines a lower bound that covers every cut with an upper bound from one candidate. Third, checking every cut in this small graph establishes the exact value h=0.5. Neither of the first two steps establishes that exact equality. Three levels of evidence Each row is about h(G). 1. The theorem 0.382 ≤ h(G) ≤ 2.141 0 1 2 A broad interval from λ2​. 2. Add the cut we found 0.382 ≤ h(G) ≤ 0.5 0 1 2 A much narrower interval. 3. Check every cut h(G) = 0.5 0 1 2 An exact answer for this graph. Scale: boundary edges per node
The theorem gives a range for the best cut score. Our actual cut narrows that range. Checking all 127 cuts confirms the exact answer for this small graph. The plotted limits are rounded.
Optional: see how cuts and node values connect

The first panel starts with our cut into two halves. The +1 and −1 values already have mean zero; the panel shows how rescaling changes their energy from 8 to 1. The second panel starts with Fiedler values and shows which edges a threshold separates.

Cuts and node values suggest each otherTwo conceptual steps use the same eight-node graph. First, assign plus one to vertices 1 through 4 and minus one to vertices 5 through 8. All edges within a side have zero value difference. Only boundary edges 3–5 and 4–6 contribute energy, four each, giving total energy eight. The squared spread is also eight. Dividing every node value by the square root of eight gives squared spread one and energy one. Second, inspect two edges using the unit Fiedler vector’s values. Edge 3–5 spans approximately minus 0.263 to plus 0.263. Edge 1–3 spans plus 0.263 to plus 0.425. A threshold at zero separates the endpoints of edge 3–5, but not those of edge 1–3. Both rows use the same value scale. An edge crosses a threshold cut only when the threshold is between its endpoint values. This illustrates the sweep mechanism; the full Cheeger guarantee also accounts for the sizes of the resulting sides. Cuts and values Each helps us find the other. 1. Start with a cut Give each side one value. 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 Within each side, the gap is zero. Each orange edge has a gap of 2. Before: squared spread 8; energy 8. Divide every value by √8. After: squared spread 1; energy 1. 2. Start with varying values Try a threshold between values. Two edges from the Fiedler pattern: Threshold 0 5 −0.263 3 +0.263 Edge 3–5 3 +0.263 1 +0.425 Edge 1–3 The threshold splits edge 3–5. Both ends of edge 1–3 stay together. Only thresholds inside an edge’s value interval can split its endpoints.
Cuts and node values suggest each otherTwo conceptual steps use the same eight-node graph. First, assign plus one to vertices 1 through 4 and minus one to vertices 5 through 8. All edges within a side have zero value difference. Only boundary edges 3–5 and 4–6 contribute energy, four each, giving total energy eight. The squared spread is also eight. Dividing every node value by the square root of eight gives squared spread one and energy one. Second, inspect two edges using the unit Fiedler vector’s values. Edge 3–5 spans approximately minus 0.263 to plus 0.263. Edge 1–3 spans plus 0.263 to plus 0.425. A threshold at zero separates the endpoints of edge 3–5, but not those of edge 1–3. Both rows use the same value scale. An edge crosses a threshold cut only when the threshold is between its endpoint values. This illustrates the sweep mechanism; the full Cheeger guarantee also accounts for the sizes of the resulting sides. Cuts and values Each helps us find the other. 1. Start with a cut Give each side one value. 1 +1 2 +1 3 +1 4 +1 5 −1 6 −1 7 −1 8 −1 Within each side, the gap is zero. Each orange edge has a gap of 2. Before: squared spread 8; energy 8. Divide every value by √8. After: squared spread 1; energy 1. 2. Start with varying values Try a threshold between values. Two edges from the Fiedler pattern: Threshold 0 5 −0.263 3 +0.263 Edge 3–5 3 +0.263 1 +0.425 Edge 1–3 The threshold splits edge 3–5. Both ends of edge 1–3 stay together. Only thresholds inside an edge’s value interval can split its endpoints.
The two-level pattern has squared spread 8 and energy 8. Dividing its values by √8 brings both to 1. In the threshold example, an edge crosses the cut only when the threshold lies between its endpoint values.
Optional: derive the cut-pattern energy

Let the graph have n nodes. Suppose the smaller group contains s nodes, the other group contains n − s nodes, and b edges cross between them. The cut score is b/s.

Start with value 1 on the smaller group and 0 on the other group. The mean is s/n. Subtracting it gives value 1 − s/n on the smaller group and −s/n on the other. The mean is now zero, and every crossing edge still has a gap of 1.

The energy is therefore b. The total squared spread is the sum of s copies of (1 − s/n)² and n − s copies of (s/n)². This simplifies to s(n − s)/n. To find the energy after rescaling that spread to 1, divide energy by squared spread:

rescaled pattern energy
= bns(n − s) = bs + bn − s

This is the two-term formula used above. Since s ≤ n − s, the second term is no greater than b/s, the cut score. Combining this with Chapter 7’s minimum gives λ₂ ≤ rescaled pattern energy ≤ 2 × cut score.

A larger λ₂ raises the lower bound on every cut score. That makes it useful for network design: it can certify that no group has a very sparse connection to the rest. Chapter 10 explores how changing the wiring can improve that guarantee.

10. Rewire the graph to improve expansion

stronger boundaries with the same link budget

So far, we have searched a fixed graph for low-scoring cuts to find its bottlenecks. When designing a network, we want even its lowest cut score to be high. Every group containing up to half the nodes should have substantial connections to the rest, relative to its size.

The same change in perspective applies to λ₂. Within one graph, it is the lowest allowed pattern energy. When we change the wiring, a larger λ₂ raises the guaranteed lower bound on every cut score. We will compare two designs with the same number of links per router.

Keep the hardware budget fixed

Our original graph has eight routers, three links per router, and twelve links in total. Its weakest cut has two crossing links for four nodes, giving h(G) = 0.5.

Connecting every router to every other would provide more ways out, but it would also require more ports and cables. A fair comparison keeps the number of routers and links fixed, and changes which routers are connected.

Changing edges improves the weakest boundary at the same degreeBoth graphs have eight vertices, twelve edges, and degree three. In the original graph the weakest cut separates vertices 1,2,3,4 from the rest: two boundary edges divided by four vertices gives expansion 0.5, and lambda two is approximately 0.764. In the rewired graph one weakest cut selects vertices 1,2,5,6: four boundary edges divided by four vertices gives expansion 1, and lambda two is 2. Selected vertices are blue; boundary edges are orange. Lambda two is the lowest energy among patterns with mean zero and squared spread one. All cuts were checked. This comparison does not establish an expander family as graphs grow. Same links, stronger boundary 8 vertices · 12 edges · 3 links per vertex Original graph 1 2 3 4 5 6 7 8 2 boundary edges / 4 vertices Weakest ratio h = 0.5 Lowest allowed energy λ2​ ≈ 0.764 Rewired graph 1 2 3 4 5 6 7 8 4 boundary edges / 4 vertices Weakest ratio h = 1 Lowest allowed energy λ2​ = 2 Selected vertices Edges leaving the selection Allowed patterns: mean zero and squared spread 1.
Changing edges improves the weakest boundary at the same degreeBoth graphs have eight vertices, twelve edges, and degree three. In the original graph the weakest cut separates vertices 1,2,3,4 from the rest: two boundary edges divided by four vertices gives expansion 0.5, and lambda two is approximately 0.764. In the rewired graph one weakest cut selects vertices 1,2,5,6: four boundary edges divided by four vertices gives expansion 1, and lambda two is 2. Selected vertices are blue; boundary edges are orange. Lambda two is the lowest energy among patterns with mean zero and squared spread one. All cuts were checked. This comparison does not establish an expander family as graphs grow. Same links, stronger boundary 8 vertices · 12 edges · 3 links per vertex Original graph 1 2 3 4 5 6 7 8 2 boundary edges / 4 vertices Weakest ratio h = 0.5 Lowest allowed energy λ2​ ≈ 0.764 Rewired graph 1 2 3 4 5 6 7 8 4 boundary edges / 4 vertices Weakest ratio h = 1 Lowest allowed energy λ2​ = 2 Selected vertices Edges leaving the selection Allowed patterns have mean zero and squared spread 1.
Both graphs have eight nodes, three links per node and twelve links in total. The highlighted groups are {1, 2, 3, 4} in the original and {1, 2, 5, 6} in the rewired graph. Each shows a weakest cut. Rewiring raises h(G) from 0.5 to 1 and λ₂ from about 0.764 to 2.

In the rewired graph, the highlighted group is {1, 2, 5, 6}. Four links leave it: 1–8, 2–3, 4–5 and 6–7. There are four nodes on each side, giving a cut score of 4/4 = 1.

This cut shows that the rewired graph’s minimum score is no greater than 1. We still need to rule out a weaker boundary elsewhere.

How do we know another group is not hiding a weak boundary?

Improving one visible cut is not enough. We need a guarantee about every group. This is where Chapter 9’s lower bound becomes useful.

The rewired graph has λ₂ = 2. Therefore:

every cut score ≥ λ₂/2 = 1

We have a cut scoring 1, and the eigenvalue proves that no cut scores below 1. Together, these establish h(G) = 1. The weakest cut score has doubled from 0.5 to 1, with twelve links in each design.

What does that guarantee mean for a group of routers? Take any group containing k nodes, up to half the network. Its crossing-edge count divided by k is at least 1, so at least k links leave that group.

For example, every group of four nodes has at least four outward links in total. Those links can be distributed unevenly among the group’s nodes.

Now ask whether the advantage survives as the network grows

A good eight-router design is useful, but real networks grow. We now keep the number of links per router fixed while increasing the number of routers. The total number of links grows with the network.

Could a large group’s outward connections fail to keep up with its size?

A ring shows how that can happen. Each router has two neighbours, whatever the ring’s size. Choose a consecutive half of an even-sized ring. Only two links leave that half:

Routers in the ring Nodes in the chosen half Crossing links Cut score
8 4 2 0.5
16 8 2 0.25
32 16 2 0.125

The group gets larger while its outward connections stay at two. Its cut score keeps falling. Having the same number of neighbours at each router does not, by itself, protect against this problem.

An expander family keeps the boundary guarantee as it grows

We want every group containing up to half the nodes to retain a number of outward links proportional to its size, even as the network grows.

For example, suppose we guarantee at least half as many outward links as nodes in each such group. A group of 100 nodes would have at least 50 links out; a group of 1,000 would have at least 500. The same guarantee would hold for every graph in the growing sequence. In symbols, h(G) ≥ 0.5 throughout.

An expander family is a sequence of increasingly large graphs with the same fixed degree and this kind of guarantee: h(G) stays above one fixed positive number. The number need not be 0.5. What matters is that it does not shrink toward zero as the graphs grow.

Chapter 9 gives us a way to establish that guarantee. If λ₂ stays above a fixed positive number, then h(G) ≥ λ₂/2 gives a fixed positive lower bound on every cut score. The optional section below explains the connection in both directions.

What does this provide for a network?

With equal-capacity links, a lower bound on every group’s number of outward links also gives a lower bound on its total outward link capacity. The guarantee covers all groups, including ones that were not obvious in a drawing.

Routing still has to use those links effectively. Traffic patterns, shared paths, and forwarding choices affect the throughput that is actually achieved. Expansion tells us something about the connections the topology makes available.

Next we will see how the same spectral information appears when a paper uses adjacency eigenvalues instead of Laplacian eigenvalues.

Optional: see the group-size and ring examples
The escape problemLeft: two rooms. In our graph, the room holding routers 1 to 4 has two doors out, so h is 0.5. In the rewired graph, the room holding routers 1, 2, 5 and 6 has four doors out, so h is 1. Right: two rings. A ring of 8 nodes with half of them selected has two exit links, score 0.5. A ring of 16 with half selected still has two exits, score 0.25. The score is at most 4 over n and shrinks as the ring grows. The escape problem A group needs ways out in proportion to its size Doors per router Our graph: routers 1–4 1 2 3 4 2 doors 4 routers, 2 doors out: h = 0.5 Rewired: routers 1, 2, 5, 6 1 2 5 6 4 doors 4 routers, 4 doors out: h = 1 Rings lose expansion as they grow 4 of 8 nodes, 2 exits score 2 ÷ 4 = 0.5 8 of 16 nodes, 2 exits score 2 ÷ 8 = 0.25 a bigger ring, the same two exits: h ≤ 4/n Good expansion means every group of up to half the nodes has at least h times its own size in links out.
The escape problemLeft: two rooms. In our graph, the room holding routers 1 to 4 has two doors out, so h is 0.5. In the rewired graph, the room holding routers 1, 2, 5 and 6 has four doors out, so h is 1. Right: two rings. A ring of 8 nodes with half of them selected has two exit links, score 0.5. A ring of 16 with half selected still has two exits, score 0.25. The score is at most 4 over n and shrinks as the ring grows. The escape problem A group needs ways out in proportion to its size Doors per router Our graph: routers 1–4 1 2 3 4 2 doors 4 routers, 2 doors out: h = 0.5 Rewired: routers 1, 2, 5, 6 1 2 5 6 4 doors 4 routers, 4 doors out: h = 1 Rings lose expansion as they grow 4 of 8 nodes, 2 exits score 2 ÷ 4 = 0.5 8 of 16 nodes, 2 exits score 2 ÷ 8 = 0.25 a bigger ring, the same two exits: h ≤ 4/n Good expansion means every group of up to half the nodes has at least h times its own size in links out.
The highlighted four-node group has two links out in the original graph and four in the rewired graph. In a growing ring, a consecutive half always has just two links out. Its score, 4/n, falls as the number of nodes n grows.

For an even ring with n nodes, a consecutive half contains n/2 nodes and has two crossing links. Its score is 2/(n/2) = 4/n, which tends toward zero as n grows.

Optional: why both sides of Cheeger matter for growing graphs

If λ₂ ≥ a for some fixed a > 0, then h(G) ≥ a/2. Conversely, if h(G) ≥ c for some fixed c > 0, the inequality h(G) ≤ √(2dλ₂) implies λ₂ ≥ c²/(2d). When d is fixed, both statements give a positive bound independent of the number of nodes.

This is what “bounded away from zero” means: there is one positive lower limit that works for the whole family, even as its graphs get larger.

11. Recognize the gap in another matrix

follow the same pattern through A and L

For our original graph, the second Laplacian eigenvalue is about 0.764. A paper using the adjacency matrix would instead report a second eigenvalue of about 2.236. Both numbers describe the same graph. We need to know which matrix a number belongs to before using it.

Because every node here has three neighbours, one subtraction translates between the two descriptions.

Recall what the two matrices do

A adds up the neighbours’ values. L takes three times the node’s own value and subtracts that sum.

Every node here has degree three, so:

Lx = 3x − Ax

Both matrices receive the same input pattern x. Once we know one output, this equation gives the other.

Try the flat pattern first

Give every node the value 1. A adds three neighbouring ones at every node, returning 3 everywhere. It multiplies the whole flat pattern by 3.

L subtracts those neighbour sums from three times each node’s own value: 3 − 3 = 0 everywhere. Its multiplier for the flat pattern is 0.

Rescaling this flat pattern to the unit vector u₁ leaves its multipliers unchanged: 3 under A and 0 under L.

Now try the winning pattern from Chapter 7

Chapter 7 found that L multiplies every entry of u₂ by about 0.764. Rearrange our rule to find what A does:

Au₂ = 3u₂ − Lu₂
≈ (3 − 0.764)u₂ = 2.236u₂

A also leaves the pattern’s proportions unchanged, multiplying every entry by about 2.236. So u₂ is an eigenvector of both matrices, with a different eigenvalue for each.

Here are the first three patterns from Chapter 7 and their multipliers:

Input pattern A multiplies it by L multiplies it by
Flat pattern u₁ 3 0
Winning pattern u₂ ≈ 2.236 ≈ 0.764
Next pattern u₃ 1 2

In every row, the two multipliers add up to three. The figure connects the paired values for these same three patterns:

Adjacency and Laplacian give different multipliers to the same eigenvectorsFor this degree-three graph L equals 3I minus A. The same eigenvector has adjacency eigenvalue alpha and Laplacian eigenvalue lambda equals 3 minus alpha. Three matching eigenvectors are shown. The flat pattern u1 has adjacency multiplier 3 and Laplacian multiplier 0. Pattern u2 has adjacency multiplier approximately 2.236 and Laplacian multiplier approximately 0.764. Pattern u3 has adjacency multiplier 1 and Laplacian multiplier 2. Both axes have a common scale; adjacency values decrease as Laplacian values increase. One pattern, two multipliers For degree 3: λ = 3 − α Adjacency eigenvalue α Laplacian eigenvalue λ 3 0 2.236 0.764 1 2 u1​ (flat) u2​ u3​ Three matching patterns are shown. A larger α gives a smaller λ.
Adjacency and Laplacian give different multipliers to the same eigenvectorsFor this degree-three graph L equals 3I minus A. The same eigenvector has adjacency eigenvalue alpha and Laplacian eigenvalue lambda equals 3 minus alpha. Three matching eigenvectors are shown. The flat pattern u1 has adjacency multiplier 3 and Laplacian multiplier 0. Pattern u2 has adjacency multiplier approximately 2.236 and Laplacian multiplier approximately 0.764. Pattern u3 has adjacency multiplier 1 and Laplacian multiplier 2. Both axes have a common scale; adjacency values decrease as Laplacian values increase. One pattern, two multipliers For degree 3: λ = 3 − α Adjacency eigenvalue α Laplacian eigenvalue λ 3 0 2.236 0.764 1 2 u1​ (flat) u2​ u3​ Three matching patterns are shown. A larger α gives a smaller λ.
Each dotted line follows one pattern from its multiplier under A to its multiplier under L. These three pairs match the table: their values add to 3. Decimal labels are rounded.

Which number is the spectral gap?

The adjacency value 2.236 is a multiplier. To get the spectral gap used here, subtract it from the largest adjacency eigenvalue, 3:

3 − 2.236 ≈ 0.764the exact gap is λ₂ = 3 − √5

For A, the gap runs from its largest eigenvalue down to its second largest. For L, it runs from zero up to λ₂. Both gaps are about 0.764.

The same rule works at any fixed degree

If every node has degree d, then L = dI − A. Here I is the identity matrix, which returns its input unchanged. A pattern with adjacency multiplier α has Laplacian multiplier d − α.

We use α for an adjacency eigenvalue and λ for a Laplacian eigenvalue. List the adjacency values from largest to smallest. The largest is α₁ = d; the second largest is α₂. Subtracting each from d reverses that order, giving the Laplacian values from smallest to largest.

d − α₂ = λ₂α₂: second-largest adjacency eigenvalue
λ₂: second-smallest Laplacian eigenvalue

For the rewired graph in Chapter 10, d = 3 and λ₂ = 2. Its second adjacency eigenvalue is therefore α₂ = 3 − 2 = 1. At the same degree, a smaller α₂ gives a larger λ₂ and a stronger lower bound on every cut score.

When a paper reports an eigenvalue, identify the matrix and its scale first. For an adjacency eigenvalue on a regular graph, subtract from d before applying Chapter 9’s Laplacian bounds. The optional sections cover other conventions you may encounter.

Optional: why some papers divide the gap by the degree

L adds a node’s differences from its d neighbours. Dividing by d turns that sum into an average. For a regular graph, the matrix L/d is called the normalized Laplacian. Here we are rescaling the matrix; the node pattern stays the same.

Dividing a matrix by d divides each eigenvalue by d. If we call the second normalized eigenvalue μ₂, then:

μ₂ = λ₂/d ≈ 0.764/3 ≈ 0.255

So 0.764 and 0.255 can both describe this graph’s gap, on different scales. Check whether a reported gap has been divided by the degree before comparing numbers.

Optional: conductance measures the fraction of connections leading out

Our group of four nodes has two links leading out. Its cut score is 2/4 = 0.5 outward links per node.

We can instead measure the fraction of the group’s connections that lead outside. Count each end of a link attached to a node in the group. Four nodes with three connections each give 4 × 3 = 12 connection ends.

Five links are internal, using two ends each: ten ends in total. The two crossing links use one end each inside the group. Only those two ends lead outside.

Two of the group’s twelve connection ends lead outsideNodes 1 to 4 form the same selected group as before. Each node has three connection ends, shown as small dots beside its circle. Five internal edges use ten blue ends: both ends of each internal edge are inside the group. The edges from node 3 to node 5 and from node 4 to node 6 use two orange ends inside the group. Those are the only ends that lead out. There are twelve ends in total, and the fraction leading out is two twelfths, or one sixth. Small dots mark edge ends, not extra graph nodes. Count connection ends inside the group 4 nodes, with 3 connection ends each The same group: nodes 1–4 to 5 to 6 1 2 3 4 10 ends of internal edges An internal edge uses two ends: one at each node. 2 ends lead out Count only the end in this group. The other end is outside. Fraction of ends leading out 2 / 12 = 1 / 6 Small dots mark connection ends. Numbered circles are the graph’s nodes.
Two of the group’s twelve connection ends lead outsideNodes 1 to 4 form the same selected group as before. Each node has three connection ends, shown as small dots beside its circle. Five internal edges use ten blue ends: both ends of each internal edge are inside the group. The edges from node 3 to node 5 and from node 4 to node 6 use two orange ends inside the group. Those are the only ends that lead out. There are twelve ends in total, and the fraction leading out is two twelfths, or one sixth. Small dots mark edge ends, not extra graph nodes. Count connection ends inside the group 4 nodes · 3 ends per node The same group: nodes 1–4 to 5 to 6 1 2 3 4 10 ends of internal edges An internal edge uses two ends: one at each node. 2 ends lead out Count only the end in this group. The other end is outside. Fraction of ends leading out 2 / 12 = 1 / 6 Small dots are connection ends.
Of the twelve connection ends inside the group, ten belong to internal links and two lead outside. The outgoing fraction is 2/12 = 1/6. An internal link uses two ends in the group; a crossing link uses one.

The outward fraction is 2/12 = 1/6. For each cut, use the group with fewer connection ends. The lowest fraction across all cuts is the graph’s conductance, written φ(G).

When every node has degree d, counting connection ends multiplies each group’s node count by d. So φ(G) = h(G)/d. In our graph, φ(G) = 0.5/3 = 1/6.

The change is in the denominator: h(G) counts outward links per node; φ(G) counts the fraction of connection ends leading out. Write μ₂ = λ₂/d for the normalized eigenvalue. Dividing Chapter 9’s bounds by d gives:

μ₂/2 ≤ φ(G) ≤ √(2μ₂)

We have changed both measurements to a scale relative to degree. The relationship between cuts and eigenvalues remains.

Optional: what changes when nodes have different degrees?

L = D − A and the energy formula still hold. But there is no single degree d to subtract from every adjacency eigenvalue, so our simple translation no longer works.

For conductance, count a group’s connection ends by adding its node degrees. This sum is called its volume. A cut’s conductance is its crossing-edge count divided by the smaller of the two group volumes.

The matching pattern calculation gives each node weight equal to its degree. A node with six links counts twice as much as one with three. With dᵢ denoting node i’s degree, the two constraints become:

∑ᵢ dᵢxᵢ = 0
∑ᵢ dᵢxᵢ² = 1

The first removes the degree-weighted mean. The second fixes the degree-weighted squared spread. This calculation can be expressed using the symmetric normalized Laplacian:

D−1/2 L D−1/2

Assuming no isolated nodes, D−1/2 is a diagonal matrix with entry 1/√dᵢ at node i. Multiplying on both sides scales the corresponding rows and columns. When all degrees equal d, the result is just L/d. Spielman’s text, §10.5 explains the change of coordinates behind this formula.

Optional: what the name Ramanujan adds

The gap above uses only the second-largest adjacency eigenvalue. Ramanujan is a stronger spectral condition: for a connected d-regular graph, every nontrivial adjacency eigenvalue must have absolute value at most 2√(d − 1). Absolute value means ignoring the sign, so negative eigenvalues count too. Exclude the flat pattern’s eigenvalue d; if the graph is bipartite, also exclude −d.

For degree three, the limit is 2√2 ≈ 2.828. Our original graph’s nontrivial adjacency values are √5, 1, four copies of −1, and −√5. Their absolute values all lie below that limit, so this small graph meets the condition. Its expansion is still h(G) = 0.5: the label does not mean that every cut has a high score at every size.

The limit is an important benchmark for large graphs at fixed degree. Friedman’s result allows an arbitrarily small positive amount above it, with probability tending to one as a random regular graph grows. That does not establish the exact Ramanujan condition for every sampled graph.

Chapter 12 returns to the practical goal: using well-connected graphs in a network.

12. Bring the ideas back to RNG

connect the cut guarantee to cabling and routing

RNG is a flat data-center network design that mixes planned and randomized router connections. Its use of expander graphs connects to Chapter 10’s goal: keep groups well connected with limited links per router. RNG §§1–2

What does a cut mean for traffic?

Our node values were a mathematical tool for finding weak cuts. To interpret a cut as capacity, give each link a transmission rate.

Suppose the two links between our example’s halves each carry 100 Gb/s in each direction. Traffic leaving either half has at most 2 × 100 = 200 Gb/s of boundary capacity available. Every route to the other half must cross that boundary.

Expansion measures how much boundary a group has relative to its size. A lower bound on h(G) therefore guarantees outward link capacity for every group of up to half the nodes, when links have equal capacity. The spectral gap helps establish that guarantee across the graph.

Boundary capacity sets a limit on outgoing traffic. The throughput actually achieved also depends on the routes used and the traffic sharing them.

Random-like wiring has to fit real cabling

The graph records which routers connect. A physical installation must also get the fibres between those routers.

RNG calls its wiring quasi-random. Its ShuffleBoxes map fibre pairs through passive hardware. They connect fibres without forwarding packets, so a router-to-router connection through them remains one logical link. RNG §6

One logical router link can cross passive optical hardwareEducational schematic, not an AWS cabling diagram. The upper drawing shows one logical link between Router A and Router B. The lower drawing represents the same link as a continuous fiber path through two passive ShuffleBoxes. The boxes do not forward packets and are not extra routing hops. This is one possible physical path, not every RNG link or the full network. One link, two ways to draw it Logical graph Router A Router B One router-to-router link One possible physical path Router A ShuffleBox passive ShuffleBox passive Router B Continuous fiber path The boxes do not forward packets or add routing hops. Educational schematic, not an AWS cabling plan.
One logical router link can cross passive optical hardwareEducational schematic, not an AWS cabling diagram. The upper drawing shows one logical link between Router A and Router B. The lower drawing represents the same link as a continuous fiber path through two passive ShuffleBoxes. The boxes do not forward packets and are not extra routing hops. This is one possible physical path, not every RNG link or the full network. One link, two ways to draw it Logical graph Router A Router B One router-to-router link One possible physical path Router A ShuffleBox passive ShuffleBox passive Router B Continuous fiber path The boxes do not forward packets. Schematic, not an AWS cabling plan.
Both drawings represent one router-to-router link. Passive ShuffleBoxes add no forwarding hops. This is a teaching schematic, not an exact RNG wiring diagram.

The authors report that their construction retains the spectral gap of unconstrained random graphs in their analysis. RNG §6 The relevant test is whether a graph built under cabling constraints still has a strong spectral gap.

A good graph still needs a routing method

The drawing below has two routes from a to b: through p or through q. If forwarding always chooses p, the links through q carry none of that traffic. Their presence in the graph alone does not make them useful.

Two routes offered, one usedLeft: a diamond of four routers a, p, q and b. Links join a to p, p to b, a to q and q to b, so there are two routes from a to b. Right: the same diamond with the route through p drawn thick and the route through q faint and dashed: one routing rule sends all the traffic one way. Two routes offered, one used Routing determines which paths carry traffic The wiring a p q b two routes from a to b One routing rule a p q b traffic uses p; the route through q is unused The wiring provides possible routes. Forwarding rules decide which are used.
Two routes offered, one usedLeft: a diamond of four routers a, p, q and b. Links join a to p, p to b, a to q and q to b, so there are two routes from a to b. Right: the same diamond with the route through p drawn thick and the route through q faint and dashed: one routing rule sends all the traffic one way. Two routes offered, one used Routing determines which paths carry traffic The wiring a p q b two routes from a to b One routing rule a p q b traffic uses p; the route through q is unused The wiring provides possible routes. Forwarding rules decide which are used.
The links allow routes a–p–b and a–q–b. A forwarding rule that sends all traffic through p leaves the route through q unused. Both panels have the same wiring.

RNG’s routing scheme, Spraypoint, makes all source neighbours eligible first hops. Later forwarding rules guide traffic through selected intermediate routers called waypoints toward the destination. This spreads traffic across departures from the source and approaches to the destination. RNG §5

In that section of the paper, h counts eligible next hops after the first step; this primer’s h(G) means edge expansion.

What can we conclude from each result?

The spectral calculation answers a question about the wiring. To assess the complete network, we also need evidence about how traffic uses that wiring:

  • Spectral gap: gives bounds on the graph’s cut scores.
  • Routing analysis: estimates what the routing method achieves under its graph and traffic assumptions.
  • Measurements: show performance for the configurations and traffic that were tested.

RNG develops routing models and evaluates fabrics built under practical port and forwarding-memory limits. RNG §7, §9 Those results address questions beyond the cut guarantee.

Comic: a good graph still needs a mapPanel 1: A stands by a whiteboard with the rewired graph and says: The graph has many ways out of every group. B says: Great. The packets will find them. Panel 2: A says: Packets follow routing. Routing has to be told. B says: So the graph is the map and routing is the driver. A says: And the paper is about both. The graph has many ways out of every group. Great. The packets will find them. Packets follow routing. Routing has to be told. So the graph is the map and routing is the driver. And the paper is about both.
Comic: a good graph still needs a mapPanel 1: A stands by a whiteboard with the rewired graph and says: The graph has many ways out of every group. B says: Great. The packets will find them. Panel 2: A says: Packets follow routing. Routing has to be told. B says: So the graph is the map and routing is the driver. A says: And the paper is about both. The graph has many ways out of every group. Great. The packets will find them. Packets follow routing. Routing has to be told. So the graph is the map and routing is the driver. And the paper is about both.
The graph provides possible routes. The routing scheme determines which of those routes packets actually use.

We began with two links joining two groups of routers. Node values let us measure that weakness, eigenvectors found the lowest-energy pattern, and Cheeger’s inequality connected its energy to cut scores. These tools help us assess the wiring. Cabling and routing turn that wiring into a working network.

Review

  1. A graph is nodes and edges; a pattern is one value per node. A collects the neighbours’ values, D repeats a node’s own value once per link, and L = D − A asks how far a node stands above its neighbourhood.
  2. A cut’s score is crossing edges divided by the smaller side. The lowest score over all groups is the edge expansion h(G), and checking every group is hopeless.
  3. The energy E(x) = ∑(xᵢ − xⱼ)² = xᵀLx counts squared disagreement across links. With +1 and −1 group labels, it is 4 times the crossing edges. It is never negative.
  4. Two conditions make the comparison fair: mean zero removes a shared level, and squared spread 1 prevents shrinking from counting as an improvement. Squared spread is the sum of squared distances from the mean. For a centered, nonzero pattern, dividing energy by squared spread gives the Rayleigh quotient xᵀLx / xᵀx.
  5. Letting values bend helps. One number, t, moves the four boundary nodes toward zero, with a rescaling after every move. The energy falls from 1 to 0.764 at t = 0.618 and climbs to 2 at t = 0, because the interior edges start to disagree.
  6. The reference patterns are the eigenvectors of L, the patterns L only rescales, and a length-1 eigenvector’s energy is its eigenvalue. Every pattern with mean zero and squared spread 1 is a mixture of u₂ to u₈ whose shares add to 1, so its energy is a weighted average of their eigenvalues and cannot fall below the smallest, λ₂. u₂, the Fiedler vector, reaches it. Here λ₂ = 3 − √5 ≈ 0.764.
  7. Sort the nodes by Fiedler value, sweep a threshold through the gaps, score each cut by crossing edges over the smaller side. Four distinct values give three gaps; the second one gives 0.5. A sweep tests the prefixes of one ordering, not every group.
  8. Cheeger: λ₂/2 ≤ h(G) ≤ √(2dλ₂). A cheap cut gives a cheap pattern, and a cheap pattern gives a cheap cut. Here 0.382 ≤ h(G) ≤ 0.5, and checking all 127 cuts gives exactly 0.5.
  9. Expansion bounds the links leaving every group of up to half the nodes, relative to its size. Our rewiring raised h(G) from 0.5 to 1 and λ₂ from about 0.764 to 2, with twelve links in each design. For a regular graph, an adjacency eigenvalue α corresponds to a Laplacian eigenvalue λ = d − α. The topology supplies possible routes; forwarding rules determine which carry traffic.

Sources and further reading

  1. Bernardi et al., RNG: Flat Datacenter Networks at Scale, version 3, 21 May 2026. The network discussion above follows this version.
  2. Daniel Spielman, Spectral and Algebraic Graph Theory. A fuller development of Laplacians, the minimum argument, and graph partitioning.
  3. Hoory, Linial and Wigderson, Expander Graphs and Their Applications. Expansion, spectral bounds, and the equal-degree form of Cheeger’s inequality used here.
  4. Joel Friedman, A Proof of Alon’s Second Eigenvalue Conjecture and Related Problems. The near-Ramanujan behaviour of random regular graphs.
  5. A Primer on Linear Algebra. Dot products, projection, eigenvectors, and the Rayleigh quotient, using a running example with one vector and one 2 × 2 matrix.

Footnotes

  1. Nothing to do with charts. The word was borrowed in 1878 by J. J. Sylvester, who was drawing molecules as dots and lines and wanted a name for the drawings. ↩
  2. Named after Laplace because it is the wiring-diagram cousin of his operator from physics, which also measures how far a value sits from the average of its surroundings. Books that want to be precise call this one the combinatorial Laplacian; Chapter 11 meets a cousin that divides by degree. ↩
  3. For eight nodes, the nonempty groups of size at most four number 8 + 28 + 56 + 70 = 162. A four-versus-four cut appears twice in that list, once for each side, so these groups describe 127 distinct cuts. In general, n nodes have 2^(n − 1) − 1 nontrivial cuts when swapping the sides is counted as the same cut. For forty nodes, there are 618,679,078,297 groups of size at most twenty, representing 549,755,813,887 distinct cuts. ↩
  4. The name comes from physics: an ideal spring stores energy proportional to the square of its stretch. Here, energy is a mathematical measure of the differences between values at connected nodes. ↩
  5. A symmetric matrix whose energy is never negative is called positive semidefinite. L is symmetric because every edge runs both ways. Both facts matter in Chapter 7, where the eigenvectors take over. ↩
  6. Centering removes the component along the all-equal direction. Subtracting the mean does this one value at a time. ↩
  7. A centered pattern rescaled so its squared values add to 1 is called normalized. We will mostly say “rescaled”. ↩
  8. Here, each undirected edge is counted once: E(x) = ∑{i,j} (xᵢ − xⱼ)² = xᵀLx. With mean zero, the squared spread is ∑ᵢ xᵢ². These are the same energy and squared spread used in Chapters 4–6. ↩
  9. “Eigen” is German for “own”: a pattern the matrix treats as its own. Primer 1 drew eigenvectors as arrows that a matrix only stretched. Here each arrow has eight entries, so we read those entries as values on eight nodes. ↩
  10. This is the spectral theorem, drawn in Primer 1's Chapter 8 for a 2 × 2 matrix. For eight nodes the picture has eight perpendicular directions instead of two, and nothing else changes. ↩
  11. When an eigenvalue repeats, any nonzero mixture of eigenvectors belonging to it is another eigenvector with that eigenvalue. We choose perpendicular, length-1 building blocks within that space. If λ₂ repeats, several independent directions achieve the same minimum. ↩
  12. The slider's pattern is an eigenvector exactly when t² + t − 1 = 0, which gives t = (√5 − 1)/2 ≈ 0.618, one over the golden ratio. The eigenvalue that comes with it is 2 − 2t = 3 − √5. ↩
  13. After Miroslav Fiedler, who studied λ₂ in a 1973 paper and showed that it is zero exactly when the graph is disconnected, and that bigger values go with graphs that are harder to split. ↩
  14. More generally, the number of zero Laplacian eigenvalues is the number of connected components. Each component can hold its own constant value without any edge disagreement. Centering removes one shared-level direction; if the graph is disconnected, other zero-energy directions remain. ↩
  15. A threshold can be placed between consecutive distinct values. With k distinct values, there are k − 1 nontrivial threshold cuts, and k is at most the number of nodes n. These are only the cuts obtained from one ordering. Equal values stay together; reversing the ordering gives the same divisions with their sides swapped. ↩
  16. Jeff Cheeger proved the original version in 1970 for curved surfaces, where it bounds the smallest vibration frequency by how thin the surface's narrowest neck is. Jozef Dodziuk, and Noga Alon with Vitali Milman, carried it over to graphs in the mid-1980s. The form used here is the one in the survey by Hoory, Linial and Wigderson, linked below. ↩
  17. Early work by Leonid Bassalygo and Mark Pinsker connected expanders to sparse communication networks. In 1973, Pinsker used a probabilistic argument to show their existence, and Grigory Margulis gave the first explicit construction. See the survey by Hoory, Linial and Wigderson in Sources and further reading. ↩
  18. The name is a joke that stuck: the first explicit constructions, by Lubotzky, Phillips and Sarnak and independently by Margulis in 1988, relied on a conjecture of Ramanujan's about number theory. The graphs themselves have nothing to do with him. ↩

The stick figures, comics and charts are original drawings, made in the general style of xkcd as a tribute. This page is not affiliated with or endorsed by xkcd or Randall Munroe. Every figure from the original primer has been redrawn with the same coordinates and data, and the figures new to this edition use the same eight-node graph, with every number computed from it and checked in code; the wobble moves the middle of each line, never its endpoints. The two eight-node graphs and the three-node path are teaching examples, not sampled RNG topologies.

Lettering: Humor Sans by Michael Ciuffo and Playpen Sans by TypeTogether, both under the SIL Open Font License 1.1.

Written on October 20, 2026