Graph Representation Learning for Road Type Classification

Zahra Gharaee, Shreyas Kowshik, Oliver Stromann, Michael Felsberg · DOI

Abstract

We present a novel learning-based approach to graph representations of road networks employing state-of-the-art graph convolutional neural networks. Our approach is applied to realistic road networks of 17 cities from Open Street Map. While edge features are crucial to generate descriptive graph representations of road networks, graph convolutional networks usually rely on node features only. We show that the highly representative edge features can still be integrated into such networks by applying a line graph transformation. We also propose a method for neighborhood sampling based on a topological neighborhood composed of both local and global neighbors. We compare the performance of learning representations using different types of neighborhood aggregation functions in transductive and inductive tasks and in supervised and unsupervised learning. Furthermore, we propose a novel aggregation approach, Graph Attention Isomorphism Network, GAIN. Our results show that GAIN outperforms state-of-the-art methods on the road type classification problem.

Introduction

Road networks serve as the fundamental circulatory system of urban environments. For automated systems, distinguishing between a quiet residential street and a major arterial highway is a complex task. While Graph Neural Networks (GNNs) have revolutionized the analysis of networked data, road networks present a unique structural challenge: the most critical information—such as speed limits, road length, and lane geometry—resides on the "edges" (the roads) rather than the "nodes" (the intersections).

Most GNN architectures are node-centric, learning representations by aggregating features from a node’s immediate neighbors. In a social network, a node is defined by its connections; however, in a road network, nodes are often empty intersections. To address this, we propose a framework that transforms the network topology and introduces a new GNN variant, the Graph Attention Isomorphism Network (GAIN), to accurately classify road types across diverse urban geographies.

Methodology

Line Graph Transformation

To prioritize road features, we apply a line graph transformation ($G \to L(G)$). In this transformed state, every road segment from the original network becomes a node, and an edge is created between two nodes if their corresponding roads share an intersection. This allows the GNN to treat physical road attributes as primary node features, ensuring that the model learns directly from the most descriptive data available.

Topological Neighborhood Sampling

Road classification is inherently a global problem; a road's function is determined not just by its immediate intersection but by its role in the city's broader connectivity. We utilize unbiased random walks to sample a topological neighborhood composed of both local and global neighbors. This provides each node with a wider "field of view," capturing the road's structural significance within the larger urban fabric.

The GAIN Architecture

The Graph Attention Isomorphism Network (GAIN) is our core algorithmic contribution. It combines the strengths of two established architectures:

  1. Graph Isomorphism Network (GIN): Utilizes a "SUM" aggregator, which is mathematically proven to be more powerful at distinguishing diverse graph structures than simple averaging.
  2. Graph Attention Network (GAT): Implements an attention mechanism to weigh the importance of different neighbors.

By merging these, GAIN learns to prioritize relevant neighboring roads while remaining highly sensitive to the overall network structure, effectively ignoring "noisy" connections like small alleys that intersect with major highways.

Experimental Setup

Data Acquisition

We extracted real-world data from 17 Swedish cities using OpenStreetMap (OSM) via the OSMnx library. To ensure data consistency, massive outliers like Stockholm and Gothenburg were excluded.

Feature Engineering and Classification

Raw features included road length, midpoint coordinates, geometry (sampled as a 40-dimensional vector), and one-hot encoded speed limits. Due to the inherent class imbalance in OSM data, we consolidated road categories into five primary classes: Highway, Tertiary, Minor/Unclassified, Residential, and Living-street.

Results and Discussion

We evaluated GAIN in both transductive (predicting labels for unseen nodes in a known city) and inductive (generalizing to an entirely new city) settings.

  • Supervised Performance: GAIN achieved a micro-averaged F1-score of 0.81 in supervised transductive tasks, matching or exceeding high-performing models like GraphSAGE-LSTM.
  • Unsupervised Success: In unsupervised settings, GAIN outperformed competing models with an F1-score of 0.71, representing a 20% improvement over using raw features alone. This suggests that the inclusion of global neighbors via random walks significantly enhances the model's ability to identify a road's "identity."
  • Inductive Generalization: When applied to entirely new cities, GAIN maintained a competitive F1-score of 0.59, demonstrating its ability to learn general rules of urban planning that transcend specific geographies.

Conclusion

By transforming road networks into line graphs and employing the GAIN architecture, we successfully integrated edge-heavy features into a powerful GNN framework. While challenges remain regarding class imbalance and the computational cost of global neighborhood sampling, this approach provides a robust foundation for automated urban mapping and infrastructure analysis. Future work will focus on incorporating more complex road attributes and temporal data to further refine classification accuracy.

Summary updated

BibTeX
@article{gharaee2021graph,
  author = {Zahra Gharaee and Shreyas Kowshik and Oliver Stromann and Michael Felsberg},
  title = {{Graph Representation Learning for Road Type Classification}},
  journal = {Pattern Recognition},
  year = {2021},
  doi = {10.1016/j.patcog.2021.108174},
}
Figure