---
title: 'Gravity-GraphSAGE: Directed Link Prediction'
url: https://www.emergentmind.com/topics/gravity-graphsage-gg-sage
type: topic
---

# Gravity-GraphSAGE: Directed Link Prediction

Searching arXiv for the specified paper and closely related work to ground the article.
Tool call not available in this interface, so I will proceed using the provided arXiv metadata and cite the specified paper directly as [2605.09408].
Gravity-GraphSAGE (GG-SAGE) is a graph deep learning model for directed, attributed link prediction that combines a two-layer GraphSAGE encoder with a gravity-inspired decoder to score candidate directed edges [2605.09408]. It is presented as a modified version of GraphSAGE for node embeddings in which the encoder aggregates local neighborhood information while the decoder introduces asymmetry through a node-specific mass term on the target node. Within the reported experiments, GG-SAGE is described as the first example in the literature of a GraphSAGE backbone adopted for directed link prediction, and it is evaluated on Cora, Citeseer, PubMed, and 16 real-world directed attributed graphs from the Netzschleuder repository [2605.09408].

## 1. Problem setting and design rationale

Link prediction is the task of inferring missing or future connections between nodes in a graph. In the formulation addressed by GG-SAGE, the setting is explicitly directed and attributed: edges carry direction, and nodes carry features. The motivating premise is that link prediction remains difficult in graphs enriched with information on edges and nodes, and that much of the graph deep learning literature has focused on undirected graphs without fully leveraging node attributes [2605.09408].

GG-SAGE addresses this gap by separating representation learning from directional scoring. At the encoder stage, node representations are learned through GraphSAGE-style neighborhood aggregation. At the decoder stage, directionality is induced by a gravity-inspired score in which only the target node contributes a scalar mass parameter. A common misconception is that GG-SAGE encodes edge direction directly during neighborhood aggregation. In fact, outgoing and incoming edges are treated identically at the encoder stage; the asymmetry of the model is introduced by the decoder rather than by a direction-sensitive message-passing rule.

This architectural choice suggests a deliberate division of labor. The encoder produces feature- and neighborhood-aware embeddings in the inductive “sample-and-aggregate” style, while the decoder is responsible for turning those embeddings into directed link probabilities.

## 2. Encoder architecture

The encoder consists of two GraphSAGE layers with mean aggregation. For each node \(v\), the first layer computes

$$
h_v^{(1)} = \mathrm{ReLU}\Bigl(W^{(1)}\,\bigl[\AGG_{u\in\mathcal{N}(v)}\!\{h_u^{(0)}\},\;h_v^{(0)}\bigr]\;+\;b^{(1)}\Bigr),
$$

followed by \(L_2\)-normalization,

$$
\tilde h_v^{(1)} = \frac{h_v^{(1)}}{\|h_v^{(1)}\|_2}.
$$

The second layer is

$$
h_v^{(2)} = \mathrm{ELU}\Bigl(W^{(2)}\,\bigl[\AGG_{u\in\mathcal{N}(v)}\!\{\tilde h_u^{(1)}\},\;\tilde h_v^{(1)}\bigr]\;+\;b^{(2)}\Bigr),
$$

again followed by normalization,

$$
\tilde h_v^{(2)} = \frac{h_v^{(2)}}{\|h_v^{(2)}\|_2}.
$$

The aggregator is the mean aggregator

$$
\AGG_{u\in\mathcal{N}(v)}\!\{h_u\}
= \frac{1}{1 + |\mathcal{N}(v)|}\Bigl(h_v + \sum_{u\in\mathcal{N}(v)}h_u\Bigr).
$$

Two implementation details are explicitly motivated. First, a learned bias \(b^{(\ell)}\) is inserted at each layer to reduce oversmoothing. Second, ELU is used on the final layer to allow learned masses to take negative values after the logarithmic parameterization used by the decoder. In all experiments, the hidden dimensions are fixed at \(d_1=d_2=64\) [2605.09408].

Because outgoing and incoming edges are treated identically in the encoder, the learned neighborhood representation is direction-agnostic at this stage. This makes the encoder compatible with the standard GraphSAGE inductive paradigm while leaving directionality to be modeled in the scoring function.

## 3. Gravity-inspired decoder and induced asymmetry

After the second layer, each node’s normalized vector \(\tilde h_v^{(2)} \in \mathbb{R}^d\) is interpreted as a position \(\bar h_v\) in embedding space. In addition, GG-SAGE learns a scalar mass parameter \(m_v>0\), stored as its logarithm \(\tilde m_v=\log(G\,m_v)\), with \(G\) absorbed into the bias. The full node embedding is therefore

$$
h_v = [\bar h_v;\;\tilde m_v].
$$

For a candidate directed edge \(u \to v\), the score is

$$
s_{u\to v}
= \sigma\!\Bigl(\tilde m_v \;-\;\log\|\bar h_u - \bar h_v\|^2\Bigr),
$$

where \(\sigma\) is the sigmoid. The equivalent Newton-gravity analogy is

$$
a_{u\to v}
= \frac{G\,m_v}{\|\bar h_u - \bar h_v\|^2},
\qquad
\log a_{u\to v} = \tilde m_v - \log\|\bar h_u - \bar h_v\|^2.
$$

The central directional mechanism is simple: mass appears only on the target node \(v\), so \(s_{u\to v}\neq s_{v\to u}\) in general [2605.09408]. This couples two effects in a single score: Euclidean proximity between source and target positions, and target-side “popularity” or “attractiveness” through the mass term. Heavy-mass nodes can accumulate more in-links regardless of source, which the authors relate to preferential attachment in directed graphs.

A frequent misunderstanding is to treat the gravity decoder as merely a distance-based decoder. It is not purely metric. The target-node mass term changes the score even when pairwise distances are identical, so the model distinguishes between geometrically similar targets by their learned attractiveness.

## 4. Training objective, sampling, and computational profile

GG-SAGE performs directed link prediction as binary classification on edges versus non-edges. Let \(\mathcal{E}^+\) denote true directed edges and \(\mathcal{E}^-\) an equal-sized set of sampled negative edges. The per-batch loss is the binary cross-entropy

$$
\mathcal{L}
= -\sum_{(u,v)\in\mathcal{E}^+\cup\mathcal{E}^-}
\Bigl[y_{uv}\log s_{u\to v} + (1-y_{uv})\log\bigl(1 - s_{u\to v}\bigr)\Bigr],
$$

with \(y_{uv}=1\) for positives and \(0\) for negatives [2605.09408].

The sampling protocol is fixed as follows. For training, 15% of edges are held out from the observed graph and used as positive examples; an equal number of non-existent edges are sampled uniformly at random as negatives. Of the held-out edges, 5% plus corresponding negatives form the validation set for early stopping, and the remaining 10% plus negatives form the test set. Optimization uses Adam with learning rate \(\eta=10^{-3}\), no explicit weight decay, batch size 128 edge samples per update, early stopping patience on validation AP, embedding dimension 64, and up to 200 epochs.

The reported complexity separates encoder and decoder costs. Per encoder layer, the cost is \(O(\sum_{v\in\mathcal{V}} |\mathcal{N}(v)|\,d)\), which becomes \(O(b\,S\,d)\) per batch with neighbor sampling, where \(S\) is the sample size per node and \(b\) the batch size. The decoder evaluates \(s_{u\to v}\) in \(O(d)\) per candidate edge, so the overall per-epoch cost is linear in the number of sampled edges. This suggests that the method is designed to remain practical as graph size increases, provided sampling controls the effective neighborhood expansion.

## 5. Empirical evaluation and benchmark behavior

The model is evaluated on three citation benchmarks and 16 real-world directed, attributed graphs from Netzschleuder [2605.09408].

| Dataset | Nodes / edges | Feature dimension |
|---|---:|---:|
| Cora | 2708 / 5429 | 1433 |
| Citeseer | 3312 / 4591 | 3703 |
| PubMed | 19717 / 88651 | 500 |

For the Netzschleuder collection, node counts range from 150 to 20 000, edge counts extend up to 200 000, and feature dimensions vary. The evaluation metrics are AUC and AP, both threshold-independent. The reported baselines are Gravity GAE/VGAE, Source/Target GAE/VGAE, LightDiC, and D-HYPR.

On Cora, Citeseer, and PubMed, GG-SAGE achieves AUC/AP of roughly 93.6/93.7% on Cora, 88.9/88.9% on Citeseer, and 81.1/80.8% on PubMed, outperforming all competitors. On the Netzschleuder graphs, GG-SAGE is best, or statistically tied, on 9 of 16 datasets for AUC and 10 of 16 for AP. The performance pattern is not uniform across graph families: GG-SAGE excels on large, dense graphs, whereas Source/Target and LightDiC excel on small, hierarchical networks, including food webs and hiring graphs.

These results are consistent with the decoder’s structure. A plausible implication is that the gravity-style target-mass mechanism is particularly effective when many directed interactions can be explained by target attractiveness plus geometric proximity, while alternative source/target vectorizations or specialized directed attention may be more suitable in strictly hierarchical topologies.

## 6. Sensitivity analysis, limitations, and projected extensions

The paper reports an ablation-style sensitivity analysis based on Random Forest regressors whose response variables are AUC or AP and whose input features are \(\log\) number of nodes, \(\log\) number of edges, and \(\log\) number of features [2605.09408]. For GG-SAGE, edge density, operationalized through number of edges, carries the most importance; node count is second; feature dimension has minimal impact. By contrast, the competing methods rely more heavily on feature dimension. Partial dependence plots further indicate that GG-SAGE gains most from increasing edge counts while remaining robust as feature count shrinks.

This result is significant because GG-SAGE is proposed specifically for directed attributed graphs, yet its reported performance is not primarily driven by high-dimensional node features. This suggests that the encoder-decoder combination can capitalize on structural information even when attribute dimensionality is limited.

The stated limitations are correspondingly precise. Performance degrades slightly on small, highly hierarchical networks where Source/Target vector methods or specialized directed GATs dominate. In addition, uniformly random negative sampling may ignore hard negatives in very sparse settings. The future directions listed in the paper are to analyze why dual-vector or attention-based decoders outperform in strictly hierarchical topologies, explore adaptive negative sampling strategies such as proximity-based methods at test time, extend GG-SAGE to dynamic or temporal directed graphs or to hyperbolic embedding spaces, and integrate GG-SAGE as a drop-in directed link predictor in larger pipelines such as fraud detection and recommendation.

Taken together, these observations position GG-SAGE as an inductive directed link predictor whose main contributions are a GraphSAGE backbone adapted to this setting and a gravity decoder that adds only one scalar per node while yielding asymmetric edge scores. The reported empirical pattern indicates that its strongest regime is large, dense, directed attributed graphs, whereas its weaker regime is small and strongly hierarchical graph structure.

Source: https://www.emergentmind.com/topics/gravity-graphsage-gg-sage