Graph rewiring is the practice of modifying the edge set of a graph before or during message passing, so that a graph neural network computes over a graph that differs from the one given as input. In graph learning, a field of artificial intelligence, rewiring is primarily used to mitigate over-squashing, the loss of information from distant nodes that must squeeze through narrow structural bottlenecks.
Rewiring rests on one idea: the input graph does not have to be the computation graph. The input graph describes the data, such as bonds in a molecule or links between web pages, while the computation graph decides which nodes exchange messages in each layer. Separating the two lets a model keep the meaning of the original structure while gaining better information flow.
Why graph rewiring is needed
Graph rewiring is needed because standard message passing neural networks propagate information only one hop per layer. A node that depends on a target many hops away needs many layers, and the number of nodes in its receptive field can grow exponentially with depth while its representation keeps a fixed size.
When an exponentially growing amount of information must pass through a few edges, the signal is compressed into a fixed-length vector and becomes nearly invisible. This effect, called over-squashing, can be measured by the sensitivity of one node’s output to another node’s input, which is bounded by powers of the normalized adjacency matrix. Edges with strongly negative curvature and graphs with a small spectral gap are associated with the worst bottlenecks.
Over-squashing is distinct from over-smoothing, in which node representations become indistinguishable after many layers. The two problems pull in opposite directions: adding edges improves connectivity but can accelerate smoothing, which is the central trade-off in every rewiring method.
Main families of rewiring methods
Rewiring methods differ in what signal guides the change and in whether they act once before training or adapt during the forward pass. The following table summarizes the principal families.
| Family | Guiding signal | Representative methods |
|---|---|---|
| Diffusion-based | Personalized PageRank or heat kernel scores | DIGL |
| Curvature-based | Discrete Ricci curvature of edges | SDRF, BORF |
| Spectral | Spectral gap of the graph Laplacian | FoSR, greedy spectral methods |
| Resistance-based | Effective resistance between nodes | Greedy total resistance rewiring |
| Expander-based | Fixed expander graph topology | Expander graph propagation |
| Global shortcuts | None, structural addition | Virtual node, fully adjacent layer |
| Dynamic rewiring | Layer depth or learned attention | DRew, graph transformers |
Diffusion-based rewiring replaces the adjacency matrix with a sparsified diffusion matrix, keeping only the highest-scoring neighbors of each node. It smooths the graph and was originally motivated by noisy edges rather than by over-squashing, so it tends to help on homophilous graphs and can hurt elsewhere.
Curvature-based methods identify edges with very negative curvature, which sit on bottlenecks, and add supporting edges around them. Several of them also remove edges with very positive curvature, which addresses over-smoothing at the same time. Spectral and resistance methods add a small budget of edges chosen to maximize the spectral gap or minimize total effective resistance, quantities that directly bound how quickly information mixes.
Graph rewiring compared with related techniques
Rewiring overlaps with other ways of extending the receptive field, and the practical difference lies in how much of the original topology survives. The comparison below places it among neighboring techniques in graph learning.
| Technique | Effect on topology | Main cost |
|---|---|---|
| Local rewiring | Adds or removes a few targeted edges | Preprocessing time for curvature or spectra |
| Virtual node | Adds one node connected to all others | Possible new bottleneck at the hub |
| Graph transformer | Effectively uses a complete graph | Quadratic attention cost |
| Deeper networks | No change | Over-smoothing and vanishing gradients |
| Graph structure learning | Learns a new adjacency end to end | Training instability, extra parameters |
A graph transformer can be viewed as the extreme of rewiring, since every node attends to every other node. Positional encodings such as Laplacian eigenvectors then reintroduce the original structure, whereas local rewiring keeps the sparsity and inductive bias of message passing at a fraction of the cost.
Applying rewiring in practice
Rewiring is most valuable when tasks depend on long-range interactions and the graph contains clear bottlenecks, such as trees, long chains or clusters joined by single edges. Several hyperparameters control its strength.
| Parameter | Typical range | Effect when increased |
|---|---|---|
| Edge budget | 1 to 20 percent of original edges | Better mixing, more smoothing |
| Number of iterations | Tens to hundreds of steps | Larger structural change |
| Curvature removal threshold | Dataset-dependent | Fewer redundant edges removed |
| Diffusion top-k | 8 to 128 neighbors | Denser, smoother graph |
| Separate edge type | On or off | Model can weigh new edges differently |
A reliable practice is to mark added edges with a separate edge type or relation, so the network learns how much to trust them. For molecular property prediction, rewiring is usually applied once as preprocessing on each graph, while for a single large graph its cost must be weighed against simpler fixes such as a virtual node.
Limitations and open questions
Rewiring is not a universal improvement, and benchmark gains are often modest and sensitive to tuning. The main risks are listed below.
- Loss of semantic meaning: added edges may connect atoms or users that have no real relationship, which can mislead the model.
- Over-smoothing: denser graphs make node embeddings converge faster, especially in deep networks.
- Computational overhead: curvature and spectral computations scale poorly on graphs with millions of edges.
- Weak evaluation: improvements may vanish against well-tuned baselines with residual connections and normalization.
- Task dependence: rewiring helps on long-range tasks but rarely on tasks solved by local neighborhoods.
Research continues on rewiring that is learned jointly with the task, on theory linking curvature to generalization, and on whether over-squashing is the main limitation in real benchmarks at all.
Explained without jargon
A graph neural network learns by letting connected points pass notes to each other. Sometimes a note must travel far. It passes through one narrow bridge with many other notes. Much of the message gets lost on the way.
Graph rewiring adds or removes a few connections so that notes travel more easily. It is like building a short bypass around a congested bridge. The map still shows the original roads. The model simply gets better routes for sending information.
A typical use case
A pharmaceutical research team predicts binding properties of drug-like molecules with a graph neural network. Atoms are nodes and chemical bonds are edges. Some properties depend on interactions between atoms at opposite ends of a molecule, often ten or more bonds apart.
With a standard six-layer network, accuracy on the long molecules stalls. The team applies curvature-based rewiring as preprocessing, adding about ten percent extra edges around the most negatively curved bonds. The new edges are given a separate edge type, so the model can learn that they are not chemical bonds.
On held-out molecules, the rewired model reduces prediction error on the long-range subset noticeably, while accuracy on small molecules stays the same. Training cost rises only slightly, because the rewiring is computed once for each molecule and cached.