How Spatial Heterophily Improves Urban Graph Neural Networks
Urban graphs often exhibit spatial heterophily, where neighboring nodes differ significantly, limiting traditional GNNs; this article introduces a Spatial Heterophily Aware GNN (SHGNN) that partitions neighborhoods by geographic proximity, employs rotation‑scaling aggregation and heterophily‑sensitive interaction, and demonstrates superior performance on three real city datasets.
Background
Graph Neural Networks (GNNs) are widely used for urban computing by representing city entities as nodes and their relationships as edges in an Urban Graph . Conventional GNNs assume homophily—adjacent nodes share similar features—but many urban graphs exhibit spatial heterophily , where neighboring nodes (e.g., residential and work zones) can have markedly different attributes.
Spatial Heterophily and Spatial Diversity
The authors define Spatial Heterophily as the phenomenon that the distribution of neighbor differences varies across geographic locations. To quantify this, they introduce a Spatial Diversity Score , which measures the spatial variation of heterophily across the graph.
Limitations of Existing Heterophilic GNNs
Current heterophilic GNNs typically handle only a small number of node types and ignore spatial diversity of neighbor differences. Synthetic experiments show that performance degrades as spatial heterophily increases, indicating the need for a model that explicitly accounts for geographic variation.
Proposed Architecture: SHGNN
The Spatial Heterophily Aware Graph Neural Network (SHGNN) consists of three key components:
Rotation‑Scaling Spatial Aggregation : Neighbors are partitioned into spatial groups based on two orthogonal views—direction (sectors) and distance (rings). Multi‑partitioning creates overlapping groups (rotation‑scaling) to mitigate boundary ambiguity.
Heterophily‑Sensitive Spatial Interaction : Two learnable kernel functions capture (a) commonality across groups and (b) discrepancy between groups and the central node.
Attention Gate & Dimension Fusion : An attentive gate learns task‑specific weights for the commonality and discrepancy signals, and a learnable scalar balances direction‑based and distance‑based representations before updating the central node.
Rotation‑Scaling Spatial Aggregation
Using Paddle Graph Learning (PGL), the workflow is:
Extract node coordinates and pairwise distances via PGL.Graph.
Assign each neighbor to a sector (based on azimuth) and a ring (based on Euclidean distance).
Generate sub‑graphs for each sector and each ring with PGL.sampling.subgraph.
Apply multi‑partitioning by rotating the sector boundaries and scaling the ring radii, producing several overlapping groupings.
Perform group‑wise aggregation (e.g., sum or mean) separately for each spatial group, preserving local heterophily.
Figure 1 illustrates the spatial grouping; Figure 2 shows the overall SHGNN pipeline.
Heterophily‑Sensitive Spatial Interaction
Two kernel functions are defined for each spatial group:
Commonality Kernel : Learns a shared representation across groups, encouraging the model to capture patterns that are common to neighboring regions.
Discrepancy Kernel : Models the difference between the central node and each group, as well as inter‑group differences, thereby preserving heterophilic signals.
Both kernels are implemented with Paddle tensor operations. For the direction view, the commonality kernel aggregates sector embeddings, while the discrepancy kernel computes a residual between the central node embedding and each sector embedding.
Attention Gate and Dimension Fusion
An attentive gate computes a soft weight for the commonality and discrepancy components:
alpha = sigmoid(Linear(commonality) + Linear(discrepancy))
combined = alpha * commonality + (1 - alpha) * discrepancyA learnable scalar beta then fuses the direction‑based and distance‑based combined representations:
final_rep = beta * combined_direction + (1 - beta) * combined_distanceExperiments
SHGNN was evaluated on three real‑world urban tasks: traffic speed prediction, POI (point‑of‑interest) classification, and crime forecasting. Baselines included homophilic GNNs (e.g., GCN, GraphSAGE), existing heterophilic GNNs (e.g., H2GCN, MixHop), and spatial GNNs (e.g., STGCN). Across all datasets, SHGNN achieved the highest accuracy/MAE scores, confirming the benefit of modeling spatial heterophily. Ablation studies demonstrated that:
Removing spatial grouping reduces performance, highlighting the importance of rotation‑scaling aggregation.
Omitting either kernel degrades results, showing that both commonality and discrepancy signals are necessary.
Disabling the attention gate or the dimension‑fusion scalar leads to further drops, indicating their role in adaptive feature weighting.
Conclusion
The paper introduces a quantitative metric for spatial heterophily, shows its adverse impact on conventional GNNs, and proposes SHGNN—a Paddle‑based architecture that partitions neighborhoods by geography, aggregates them separately, and jointly models common and discrepant information. Open‑source implementation and pretrained models are available at the following repository path:
https://github.com/PaddlePaddle/PaddleSpatial/tree/main/research/SHGNN
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Baidu Tech Salon
Baidu Tech Salon, organized by Baidu's Technology Management Department, is a monthly offline event that shares cutting‑edge tech trends from Baidu and the industry, providing a free platform for mid‑to‑senior engineers to exchange ideas.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
