Methods › Graphs › Graph Models › GAP-Layer
Spectral Gap Rewiring Layer
GAP-Layer
Introduced by Adrian Arnaiz-Rodriguez et al. in DiffWire: Inductive Graph Rewiring via the Lovász Bound
archive 2025-07-28 Description, source and code snippet are the archive's method entry.
TL;DR: GAP-Layer is a GNN Layer which is able to rewire a graph in an inductive an parameter-free way optimizing the spectral gap (minimizing or maximizing the bottleneck size), learning a differentiable way to compute the Fiedler vector and the Fiedler value of the graph.
Summary
GAP-Layer is a rewiring layer based on minimizing or maximizing the spectral gap (or graph bottleneck size) in an inductive way. Depending on the mining task we want to perform in our graph, we would like to maximize or minimize the size of the bottleneck, aiming to more connected or more separated communities.
GAP-Layer: Spectral Gap Rewiring
Loss and derivatives using 𝐋 or 𝐋
For this explanation, we are going to suppose we want to minimize the spectral gap, i.e. make the graph bottleneck size smaller. For minimizing the spectral GAP we minimize this loss:
L_(Fiedler) = 𝐀̃-𝐀 _F + α(λ₂)²
The gradients of this cost function w.r.t each element of 𝐀 are not trivial. Depending on if we use the Laplacian, 𝐋, or the normalized Laplacian, L, the derivatives are going to be different. For the former case (𝐋), we will use the derivatives presented in Kang et al. 2019. In the latter scenario (L), we present the Spectral Gradients: derivatives from the spectral gap w.r.t. the Normalized Laplacian. However, whatever option we choose, λ₂ can seen as a function of 𝐀̃ and , hence, ∇_(𝐀̃)λ₂, the gradient of λ₂ wrt each component of 𝐀̃ (how does the bottleneck change with each change in our graph?), comes from the chain rule of the matrix derivative Tr[(∇_(𝐋̃)λ₂)ᵀ·∇_(𝐀̃)𝐋̃] if using the Laplacian or Tr[(∇_(𝐋̃)λ₂)ᵀ·∇_(𝐀̃)𝐋̃] if using the normalized Laplacian. Both of this derivatives, relies on the Fiedler vector (2nd eigenvector: 𝐟₂ if we use 𝐋 and 𝐠₂ if using 𝐋 instead). For more details on those derivatives, and for the sake of simplicity in this blog explanation, I suggest go to the original paper.
Differentiable approximation of 𝐟₂ and λ₂
Once we have those derivatives, the problem is still not that trivial. Note that our cost function L_(Fiedler), relies on an eigenvalue λ₂. In addition, the derivatives also depends on the Fiedler vector 𝐟₂ or 𝐠₂, which is the eigenvector corresponding to the aforementioned eigenvalue. However, we DO NOT COMPUTE IT SPECTRALLY, as its computation has a complexity of O(n³) and would need to be computed in every learning iteration. Instead, we learn an approximation of 𝐟₂ and use its Dirichlet energy E(𝐟₂) to approximate the λ₂. 𝐟₂(u) = [ +1/√(n) if u belongs to the first cluster; -1/√(n) if u belongs to the second cluster ] In addition, if using 𝐋, since 𝐠₂=𝐃^(1/2)𝐟₂, we first approximate 𝐠₂ and then approximate λ₂ from E(𝐠₂). With this approximation, we can easily compute the node belonging to each cluster with a simple MLP. In addition, such as the Fiedler value must satisfy orthogonality and normality, restrictions must be added to that MLP Clustering.
GAP-Layer
To sum up, GAP-Layer can be defined as the following. Given the matrix 𝐗_(n×F) encoding the features of the nodes after any message passing (MP) layer, 𝐒_(n×2)=Softmax(MLP(𝐗)) learns the association 𝐗→𝐒 while 𝐒 is optimized according to the loss:
L_(Cut) = -(Tr[𝐒ᵀ𝐀𝐒])/(Tr[𝐒ᵀ𝐃𝐒]) + 𝐒ᵀ𝐒/𝐒ᵀ𝐒_F - 𝐈ₙ/(√(2))_F Then, the 𝐟₂ is approximated from 𝐒 using 𝐟₂(u) equation. Once calculated 𝐟₂ and λ₂ we consider the loss:
L_(Fiedler) = 𝐀̃-𝐀_F + α(λ₂)² Ã = 𝐀 - μ∇_Ãλ₂ returning 𝐀̃. Then the GAP diffusion 𝐓ᴳᴬᴾ = 𝐀̃(𝐒) ⊙𝐀 results from minimizing
L_(GAP)= L_(Cut) + L_(Fiedler)
References (Kang et al. 2019) Kang, J., & Tong, H. (2019, November). N2n: Network derivative mining. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management (pp. 861-870).
Papers archive 2025-07-28
1 shown of 1, newest first. Repository counts are the archive's code-links table. A Syntology line states what Syntology ran from that paper's harvested code; it is per sample and not a correctness claim.
-
DiffWire: Inductive Graph Rewiring via the Lovász Bound 15 Jun 2022 · 2 repositories · arXiv:2206.07369
Tasks archive 2025-07-28
2 tasks the archive attaches to papers tagged with this method, by distinct papers. A task without a page in the catalog is plain text.
| Task | Papers |
|---|---|
| Graph Classification | 1 |
| Node Classification | 1 |
Usage over time archive 2025-07-28
Components: the archive holds no method-to-method composition, so PwC's Components table cannot be rebuilt; the Papers list carries no Results column for the same reason (the archive does not join its leaderboard rows to method tags).
Categories archive 2025-07-28
Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections