Request node labels, an undirected edge list, nonnegative weights and the meaning of an edge. Draw the supplied relationship graph and compare positive-weight connected components and lambda 2 before and after a proposed edge removal; relate lambda-tilde 2 to the weakest cut. For propagation request node features, normalization, self-loops and depth; return the resulting values and the degree-weighted limiting pattern only when its hypotheses hold. Report edge curvature and propagation coefficients between distant nodes as bottleneck diagnostics, not guarantees. Treat WL label agreement as a limited local test, and state the filter polynomial degree for spectral filters.
“Which supplied relationship keeps two groups connected?”
Use mathllms-ch09-graphs with the companion's AI skill package. The illustrations below also work on their own.
A weak bridge lowers graph connectivity
From Chapter 9, 9.1.2 The Graph Laplacian and Its Spectrum
Two groups of three nodes are joined by one bridge. How much connectivity is lost when the bridge is weakened?
The Laplacian charges every disagreement between neighbors. A signal that is -1 on one group and +1 on the other disagrees only across the bridge, so its energy is 4b. Divide by the size of the signal, 6, to get 4b/6. Lambda 2 is the smallest such ratio over all mean-zero signals, so it is at most 4b/6.
Predict first: If the bridge weight is halved from 1 to 0.5, does lambda 2 halve too?
Bridge weight (b): 1
What happens: No. Lambda 2 falls from 0.438 to 0.268, so it keeps 61% of its value while the bridge keeps only 50%. On the plot the real curve sits above the dashed line of strict proportion.
With bridge weight 1, lambda 2 is 0.438. Halve the bridge and compare: the dashed line shows what strict proportion would predict, and the real curve lies above it.
- Connectivity score (lambda 2)
- 0.438
- Separate groups
- 1
- Energy of the two-group signal
- 4
- Energy divided by size (an upper limit for lambda 2)
- 0.667
A sparse attention pattern is a graph on tokens, and a small lambda 2 means only weak links join its groups, so information crosses between those groups slowly.
Show the calculation
Only the bridge joins a -1 node to a +1 node, so the signal f = (-1, -1, -1, 1, 1, 1) has energy f^T L f = b x (1 - (-1))^2 = 4b. Here 4 x 1 = 4. The signal has size f^T f = 6, so energy over size is 4 / 6 = 0.667. Lambda 2 is the smallest such ratio over all mean-zero signals, so it is at most this: 0.438 <= 0.667.
The equations and symbols
- A
- adjacency matrix: edge weights between nodes
- D
- diagonal matrix of each node's total edge weight
- L
- graph Laplacian, D minus A
- f
- a number attached to each node (a signal)
- lambda 2
- connectivity score: second smallest eigenvalue of L; 0 exactly when the graph splits
- b
- weight of the bridge between nodes 2 and 3
Two triangles with unit edges joined by one bridge of weight b >= 0. Positive weights determine connectivity. The half factor counts every pair in both orders; a single edge counted once has no half. Weights and signals are dimensionless.
Check your understanding: If the bridge weight is 0.5 and the group signals are -2 and +2, what is the energy f^T L f?
Book source: Chapter 9, 9.1.2 The Graph Laplacian and Its Spectrum. Illustration C09-D01. Illustration. Book equation with companion toy graphs stated in the assumptions; every plotted value and worked calculation is recomputed. v39 EPUB / v43 print.
Two ways to normalize, one constant signal
From Chapter 9, 9.2.3 GCN: Graph Convolutional Network
If every node holds the same value, does one round of neighbor mixing leave them all equal?
Each node replaces its value with a weighted sum over itself and its neighbors. Row weights sum to 1 for the row-average rule, so equal inputs stay equal. The symmetric rule divides by both end counts, so a node with many neighbors collects a different total.
Predict first: Start with 1 at every node. After many rounds, which rule still has every node at exactly 1?
Rounds of mixing: 1 · Rule shown on the graph: symmetric
What happens: Only the row-average rule. Its bars stay at exactly 1, because averaging equal numbers gives that number. The symmetric rule has drifted to 0.946 on nodes with 2 neighbors and 1.09 on nodes 2 and 3, which have 3.
After 1 round the nodes hold values from 0.955 to 1.08. The symmetric rule is not an average, so the equal signal drifts toward 0.946 on nodes with 2 neighbors and 1.09 on nodes with 3.
- Smallest node value
- 0.955
- Largest node value
- 1.08
- Gap between them
- 0.122
- Weight node 0 sends to node 2 each round
- 0.289
Attention weights are a softmax whose rows sum to 1, which is the row-average rule; a layer built from symmetric normalization can change the overall scale of a signal instead.
Show the calculation
Count each node together with its neighbors. Node 2 has 3 neighbors, so its count is 4; nodes 0 and 1 have count 3; node 3 has count 4. Row rule: node 2 averages its four entries, each weight 1/4, and 4 x 1/4 = 1. Symmetric rule: weight from node 0 or 1 is 1/sqrt(4 x 3) = 0.289, from node 3 it is 1/sqrt(4 x 4) = 0.25, from itself 0.25. These add to 1.08, not 1, so a constant signal grows at node 2 in one round. After 1 round node 2 holds 1.08 under the symmetric rule and 1 under the row rule.
The equations and symbols
- H
- one number per node (here every node starts at 1)
- A + I
- adjacency plus a self-link at each node
- D-tilde
- each node's link count including its self-link
- A-hat
- symmetric rule, used by the GCN
- P
- row-average rule: each row of weights sums to 1
The same two-triangle graph with unit bridge and unit self-links. Weights W = 1, no bias and identity activation, so only the normalization acts. Every node starts at 1.
Check your understanding: In a graph where every node has the same number of neighbors, do the two rules differ?
Book source: Chapter 9, 9.2.3 GCN: Graph Convolutional Network. Illustration C09-D02. Illustration. Book equation with companion toy graphs stated in the assumptions; every plotted value and worked calculation is recomputed. v39 EPUB / v43 print.
Many rounds erase differences
From Chapter 9, 9.7.1 The Depth-Smoothness Trade-off
If a signal is mixed with its neighbors over and over, do all node values become equal?
Every mixing round shrinks all parts of the signal except one. The part that survives follows the square root of each node's link count. Distinctions that depend on the shrinking parts fade by about a factor rho per round.
Predict first: After 32 rounds, will all six values be equal?
Mixing rounds (L): 8 · Bridge weight: 1
What happens: No. The values are within 0.00367 of the limiting pattern, but that pattern is 0.15 on nodes with 2 neighbors and 0.173 on nodes 2 and 3, which have 3.
After 8 rounds the values are 0.136 away from the limiting pattern, under the bound 0.277. That pattern is not equal across nodes: it is 0.15 at nodes with 2 neighbors and 0.173 at nodes with 3. A weaker bridge keeps rho closer to 1, so the fade is slower.
- Slowest shrink factor per round (rho)
- 0.86
- Distance to the limit now
- 0.136
- Upper bound
- 0.277
- Limit at nodes 0 and 2
- 0.15 and 0.173
Token representations in a deep stack of mixing layers can become too alike; here the same pull toward a common pattern is exact and its speed is a number, rho.
Show the calculation
The slowest shrink factor is rho = 0.8604 and the starting distance is 0.922. After 8 rounds the bound rho^L x (starting distance) is 0.277. The measured distance 0.136 is below it. The limiting value at each node is proportional to the square root of (neighbors + 1), which is not the same for every node, so raw values stay unequal.
The equations and symbols
- L
- number of mixing rounds
- H(0)
- starting values: 1 at node 0, 0 elsewhere
- v
- unit vector proportional to the square root of each node's link count
- H*
- limiting pattern the values approach
- rho
- slowest shrink factor per round (0 to 1)
Connected undirected graph, positive bridge weight, unit self-links, identity activation and unit weights. The computed rho is below 1, and the Euclidean norm of the one-feature signal equals the Frobenius norm.
Check your understanding: If rho = 0.8 and the starting distance is 2, what does the bound guarantee after three rounds?
Book source: Chapter 9, 9.7.1 The Depth-Smoothness Trade-off. Illustration C09-D03. Illustration. Book equation with companion toy graphs stated in the assumptions; every plotted value and worked calculation is recomputed. v39 EPUB / v43 print.
Local labels can miss global structure
From Chapter 9, 9.3.1 The 1-WL Test
Can the Weisfeiler-Lehman (WL) test, which relabels each node from its neighbors' labels, tell a six-cycle from two triangles?
Every node starts with the same label and sees two neighbors with that label, so its signature never changes. Marking one node gives the test something to spread, and the two graphs spread it differently.
Predict first: Starting from identical labels, will extra rounds ever tell the cycle from the triangles? What if one node is marked?
Relabeling rounds: 2 · Starting labels: all the same
What happens: With identical labels the answer is never: both graphs keep one class. With one marked node, round 2 splits the cycle into classes of sizes 1, 1, 2, 2 but the triangles into 1, 2, 3, so the test now tells them apart.
After 2 rounds both graphs still have one class: every node sees two neighbors with the same label as its own. The test cannot tell one connected loop from two separate triangles.
- Classes in the six-cycle
- 1
- Classes in the two triangles
- 1
- Class sizes agree
- yes
- Connected pieces
- 1 and 2
Message-passing layers cannot separate nodes that this test cannot, which is why graph transformers add positional information; a marked node here plays the role of a position.
Show the calculation
Each node reads its own label and the sorted labels of its neighbors, then all signatures are renamed with one shared list. Every node in both graphs reads (own label, [same, same]), so all twelve nodes get one shared new label and the counts agree at every round.
The equations and symbols
- c_t(v)
- label (color class) of node v after t rounds
- N(v)
- the neighbors of v
- {{ }}
- a multiset: repeats are kept, order is ignored
- HASH
- a shared lookup that gives equal signatures the same new label
Both six-node graphs are unweighted and start with the same labels. One shared relabeling is used for both graphs. Stable means the partition into classes stops changing, not that the color names match.
Check your understanding: If every node of both graphs gets its own unique ID, can the test tell them apart?
Book source: Chapter 9, 9.3.1 The 1-WL Test. Illustration C09-D04. Illustration. Book equation with companion toy graphs stated in the assumptions; every plotted value and worked calculation is recomputed. v39 EPUB / v43 print.
A small eigenvalue guarantees a bottleneck
From Chapter 9, 9.1.5 The Cheeger Inequality and Graph Expansion
The weakest cut of a graph is hard to find. What does an easy eigenvalue tell us about it?
The cut score asks, for the weakest way to split the graph, how much edge weight crosses compared with the smaller side. The eigenvalue is quick to compute and always sits within a fixed band of that score. In this graph the best cut is one triangle against the other.
Predict first: As the bridge gets very weak, does the weakest-cut score stay nearer the lower end or the upper end of the band the theorem allows?
Bridge weight (b): 1
What happens: Nearer the lower end here. At bridge weight 0.05 the weakest cut scores 0.00826, almost on the lower end (0.00809) and far below the upper end (0.18). Both ends shrink toward 0, so the bottleneck is real.
With bridge weight 1, the weakest cut scores 0.143. The theorem puts it between 0.102 and 0.64; here it sits inside the band. The eigenvalue is not small here, so the band is wide and the bottleneck is mild.
- Second eigenvalue (lambda-tilde 2)
- 0.205
- Weakest-cut score h(G)
- 0.143
- Lower end of the band
- 0.102
- Upper end of the band
- 0.64
Spectral clustering of embedding vectors uses this link: the second eigenvector finds a cut that the inequality says is nearly as good as the best one.
Show the calculation
Best cut: one triangle on each side. Crossing weight = b = 1. Each side has volume 2 + 2 + (2 + b) = 6 + b = 7. So h(G) = 1 / 7 = 0.143. Half of lambda-tilde 2 is 0.102 and the square root of 2 x lambda-tilde 2 is 0.64, so lower <= h(G) <= upper.
The equations and symbols
- S
- one side of a cut (a group of nodes)
- vol(S)
- sum of the degrees of the nodes in S
- h(G)
- cut score of the weakest cut: crossing weight over the smaller volume
- lambda-tilde 2
- second smallest eigenvalue of the normalized Laplacian
Two unit triangles joined by one bridge of weight b, no self-links. The normalized Laplacian is I - D^(-1/2) A D^(-1/2). The cut score uses every nonempty proper subset and the smaller of the two volumes.
Check your understanding: A graph has lambda-tilde 2 = 0.02. Between what values must its weakest-cut score lie?
Book source: Chapter 9, 9.1.5 The Cheeger Inequality and Graph Expansion. Illustration C09-D05. Identity. Book equation with companion toy graphs stated in the assumptions; every plotted value and worked calculation is recomputed. The cut score is found by trying all 62 ways to split the six nodes. v39 EPUB / v43 print.
Curvature finds the bottleneck edge
From Chapter 9, 9.11.3 Computing Ollivier-Ricci Curvature: Path Graph P4 (with 9.4.3)
Can a single number per edge show which links are bottlenecks and which sit inside tight groups?
Each node spreads probability evenly over its neighbors. If the two spreads overlap a lot, little has to move and curvature is high. If they are far apart, a lot moves and curvature drops, below zero once the cost exceeds the edge length.
Predict first: In the path graph P4, which edge is the most curved?
Graph: two triangles + bridge · Edge to inspect: 1
What happens: None. The middle edge of P4 has curvature 0: reshaping the spread of node 1 onto that of node 2 costs exactly 1. The same holds for all three edges, as in the book. Compare the bridge of two triangles, at -2/3.
Edge 2-3 has curvature -2/3, negative: the two neighborhoods are far apart, the signature of a bottleneck.
- Curvature of this edge
- -2/3
- Cost to reshape one cloud into the other
- 5/3
- Lowest curvature in this graph
- -2/3
- Edges with negative curvature
- 1 of 7
Rewiring methods add links where curvature is most negative; the same idea of adding shortcuts where information is squeezed motivates global tokens and long-range links in sparse-attention models.
Show the calculation
Node 2 spreads its probability evenly over its neighbors: 1/3 at node 0, 1/3 at node 1, 1/3 at node 3. Node 3: 1/3 at node 2, 1/3 at node 4, 1/3 at node 5. The cheapest way to reshape one into the other moves mass a total distance of 5/3. Curvature = 1 - 5/3 = -2/3, since the edge length is 1.
The equations and symbols
- mu_i
- spread of probability evenly over the neighbors of node i
- W1
- cheapest total distance to reshape one spread into the other
- kappa
- edge curvature: positive if the spreads overlap, negative if far apart
- d
- shortest-path distance between two nodes
Small unweighted graphs, no lazy step, hop distance. Curvature is a diagnostic: the book stresses that it does not by itself give a sensitivity bound. Edges are numbered in the order of the plot labels (1) to (3); nodes are numbered from 0, as in the other demos.
Check your understanding: In the complete graph K4 each pair of connected nodes shares two neighbors. Is its curvature positive, zero or negative?
Book source: Chapter 9, 9.11.3 Computing Ollivier-Ricci Curvature: Path Graph P4 (with 9.4.3). Illustration C09-D06. Illustration. Book equation with companion toy graphs stated in the assumptions; every plotted value and worked calculation is recomputed. W1 is solved exactly as a small transport problem. v39 EPUB / v43 print.
Over-squashing: distant inputs barely arrive
From Chapter 9, 9.4.2 Formal Sensitivity Analysis
At the same distance, how much more of a far-away input reaches a node on a grid than on two cliques joined by a thin chain?
The coefficient adds up weights over all routes of exactly L steps. A grid has many routes of the same length. The barbell has one, and each step through a big clique is divided by that clique's size.
Predict first: At the same distance L, does the barbell pass more or less of the source signal than the grid?
Distance and layers (L): 5 · Clique size: 6
What happens: Much less. At distance 8 with cliques of 8, the barbell coefficient is 0.00000635 against the grid's 0.000336, so the grid passes 53 times more. Every path must squeeze through the chain.
At distance 5 the grid passes 15.5 times more than the barbell: 0.00584 against 0.000378. The barbell has one narrow chain that every route must use, so a far-away input barely reaches the target. Most of the steps are chain steps, each weighted 1/3.
- Coefficient on the barbell
- 0.000378
- Coefficient on the grid
- 0.00584
- Grid divided by barbell
- 15.5x
- Nodes in the barbell
- 14
Long-range information is hard to carry through a narrow path; in sequence models a fixed-size state or a thin chain of layers faces the same squeeze.
Show the calculation
The coefficient is the (target, source) entry of A-hat^L with L = 5. Only one shortest route exists on the barbell, and each step is weighted by 1/sqrt(a x b) for the entry counts at its two ends. Computed: barbell 0.000378, grid 0.00584, ratio 15.5.
The equations and symbols
- h_i(L)
- representation of node i after L layers
- x_s
- input at the source node s
- alpha, beta
- bounds on the layer's slopes (taken as 1 here)
- [A-hat^L]_is
- propagation coefficient: row i, column s of the L-th power of the symmetric rule
Barbell: two cliques joined through a chain, with source and target at the far corners, L steps apart. Grid: 6 by 6, the target L steps from a corner. Self-links added, symmetric normalization. The coefficient is a propagation coefficient, not generally a probability, and it bounds sensitivity only under the lemma's assumptions.
Check your understanding: On a path graph where every inner node has 2 neighbors (count 3 with the self-link), what factor does one extra chain step multiply the coefficient by?
Book source: Chapter 9, 9.4.2 Formal Sensitivity Analysis. Illustration C09-D07. Illustration. Book equation with companion toy graphs stated in the assumptions; every plotted value and worked calculation is recomputed. This is the coefficient in the book's upper bound, not a measured sensitivity. v39 EPUB / v43 print.
A filter built from repeated multiplication
From Chapter 9, 9.5.2 ChebNet (with 9.1.4)
How can a graph network apply a frequency filter without computing any eigenvectors?
Multiplying by the Laplacian mixes neighbors once. A polynomial of degree K in the Laplacian therefore mixes up to K hops, yet equals a filter on the frequencies. The Chebyshev recurrence builds each term from the previous two, so no eigenvectors are ever needed.
Predict first: How many matrix-vector products does the smooth filter exp(-lambda) need to be accurate within 1% on this graph?
Polynomial degree (K): 2 · Wanted filter: sharp low-pass
What happens: Four. At degree 4 the response is within 0.00496 of the wanted one at all six frequencies (the frequency 3 occurs three times, so the plot shows four dots), and the filtered signal is off by 0.767%. Degree 3 is still off by 3.1%.
At the graph's own six frequencies the degree 2 response is off by at most 0.19, and the filtered signal is off by 5.32%. Only those few frequencies matter, not the whole curve. A sharp cutoff needs many terms and wiggles.
- Polynomial degree (K)
- 2
- Matrix-vector products used
- 2
- Largest error at the six frequencies
- 0.19
- Error in the output signal
- 5.32%
Each extra degree is one more hop of message passing, so a degree-K filter is a K-hop layer; this ties spectral filtering to the local update rule in GCNs.
Show the calculation
The filter is the sum from k = 0 to 2 of theta_k T_k(L-tilde), where L-tilde = 2L/4.56 - I. It is applied with the recurrence T_k = 2 L-tilde T_(k-1) - T_(k-2), which takes 2 matrix-vector products and never finds eigenvectors. The weights theta_k here are the first Chebyshev series coefficients of the wanted filter (a trained ChebNet learns them instead): 0.418, -0.616, 0.157.
The equations and symbols
- lambda
- graph frequency: an eigenvalue of the Laplacian L
- g(lambda)
- response of the wanted filter at frequency lambda
- T_k
- Chebyshev polynomial of degree k
- theta_k
- weight on T_k (learned in ChebNet; set from the wanted filter here)
- K
- polynomial degree = number of matrix-vector products
The two-triangle graph with unit bridge (Laplacian eigenvalues 0, 0.438, 3, 3, 3, 4.56). Wanted filters: exp(-lambda), or 1 up to lambda = 1.7 and 0 above. A trained ChebNet would learn theta_k from data. Only the six eigenvalues matter for this graph.
Check your understanding: With degree K = 0, what does the filter do to a signal?
Book source: Chapter 9, 9.5.2 ChebNet (with 9.1.4). Illustration C09-D08. Illustration. Book equation with companion toy graphs stated in the assumptions; every plotted value and worked calculation is recomputed. Fixed signal: (-1, -1, -1, 1, 1, 1) plus a small jitter. Weights are the leading Chebyshev series coefficients of the wanted filter. v39 EPUB / v43 print.
Bring the idea to a question of your own
Request node labels, an undirected edge list, nonnegative weights and the meaning of an edge. Draw the supplied relationship graph and compare positive-weight connected components and lambda 2 before and after a proposed edge removal; relate lambda-tilde 2 to the weakest cut. For propagation request node features, normalization, self-loops and depth; return the resulting values and the degree-weighted limiting pattern only when its hypotheses hold. Report edge curvature and propagation coefficients between distant nodes as bottleneck diagnostics, not guarantees. Treat WL label agreement as a limited local test, and state the filter polynomial degree for spectral filters.
The chapter skill can adapt the calculations to your inputs. It should identify the assumptions, explain what the result supports, and show what still needs evidence.