Towards AI Can Help your Team Adopt AI: Corporate Training, Consulting, and Talent Solutions.


Traffic Forecasting: The Power of Graph Convolutional Networks on Time Series

Traffic Forecasting: The Power of Graph Convolutional Networks on Time Series

Last Updated on February 13, 2023 by Editorial Team

Author(s): Barak Or

Originally published on Towards AI.

The Graph Convolutional Network (GCN) has revolutionized the field of deep learning by showcasing its versatility in solving real-world problems, including traffic prediction, which is a critical issue in transportation.


The Graph Convolutional Network (GCN) is a revolutionary development in the field of deep learning, demonstrating its versatility and potential for application in addressing real-world problems. One such challenge is traffic prediction, which is a critical issue in transportation. The ability to adapt GCN algorithms for traffic prediction purposes holds immense promise and has the potential to significantly impact the transportation industry.

It is important to note that this post assumes a prior understanding of GCN. For those who require an introduction to GCN, I strongly recommend exploring Michael Bronstein’s post, “Do we need deep GNN,” as well as Tobias Skovgaard Jepsen's hands-on introductory post.

The power of Graph Neural Networks (GNN) [1], particularly GCN, lies in their ability to model complex relationships between entities, as demonstrated through examples such as chemical bonds between atoms or traffic speeds between road segments. With its capability for feature learning through graph convolutional operations, GCN has seen wide research in vision and text data, yet there is still much potential for exploring its application in the time-series domain, unlocking new frontiers for innovation.

Image by author

Exploring Time-Series Tasks with Temporal GCN

The advent of GCN has opened up new possibilities for analyzing and understanding graph-structured data, including time-series data. Time-series data presents unique challenges compared to other forms of data, such as images. It is often less intuitive, lacks clear visual representations, and requires a deep understanding of causality to be analyzed effectively.

To address these challenges, a new field of research known as Temporal GCN (TGCN) has emerged, which combines the strengths of GCN with those of Recurrent Neural Networks (RNN), Long-Short Term Memory (LSTM), or Gated Recurrent Units (GRU). This allows TGCN to capture both the spatial and temporal aspects of time-series data, making it a powerful tool for analyzing complex and dynamic systems.

Next, we will explore the potential of TGCN for traffic prediction [2], which is a critical issue in transportation. By analyzing traffic patterns and dependencies between different road segments over time, TGCN can provide insights and make accurate predictions about future traffic conditions. Through this example, we aim to demonstrate the versatility and potential of TGCN for solving real-world problems and improving our understanding of time-series data.

Temporal GCN For Traffic Prediction

Traffic prediction is a critical issue in transportation, and finding an accurate solution is crucial for optimizing traffic flow and reducing congestion. Traditional methods of predicting traffic speed only consider the past values of the same time series, but with the advent of GCN and GRU, a more comprehensive approach is possible.

In a recent study [2], a new approach to traffic prediction was proposed that leverages the strengths of GCN and GRU. The researchers modeled the traffic network as a graph, with each road segment being a node and the connections between segments being the edges. The traffic speed was then represented as a signal on this graph, allowing the model to capture both the spatial and temporal features of the data.

The architecture included a graph convolution layer and a GRU layer, which enabled the model to effectively capture the relationships between different road segments and predict future traffic speed. By taking into account the dependencies between road segments, this solution provides a more accurate and comprehensive traffic prediction than traditional methods.

Image by author

Exploring the Road Segments Dataset

In order to understand if there is any dependency between different road segments, we need to analyze the correlations between them. To do this, we selected 26 roads out of the 228 available in the dataset and created a correlation map.

By visualizing the correlations, we can see if there is any relationship between the traffic speed of different road segments. If there is a strong relationship, this provides a clear justification for the use of a GCN to model the dependencies.

It’s important to note that capturing these relationships is crucial in accurately predicting traffic speed. By using a GCN, we can consider not only the individual traffic speed of each road segment but also the interdependencies between segments. This holistic approach allows for a more accurate and robust prediction of traffic speed.

Image by author

To understand if there are any dependencies between different road segments in the dataset, we calculated the correlations. The results showed that segments 4–5–6–7 and 19–20–21 have a high correlation, highlighting the importance of incorporating spatial features. In their research, Ling Zhao and their team proposed a TGCN architecture that utilizes both spatial and temporal features, with a graph convolution layer for the former and a GRU layer for the latter. We played with their code [3] and made it accessible through a Google Colab notebook, providing an opportunity for you to easily experiment with it [4]. The results were promising, and we encourage you to further test and improve the model by adjusting the parameters and increasing the number of epochs. Time-series traffic forecasting Tutorial


The graph convolutional network (GCN) is a highly innovative and impactful development in deep learning. It has numerous applications in the time-series domain, where it is adapted to include temporal features. To showcase the capabilities of TGCN, the example of traffic speed prediction was used and the correlation map was shown to highlight the need for the inclusion of spatial features.

follow me on Medium for more posts

About the Author

Barak Or is an Entrepreneur and AI & navigation expert; Ex-Qualcomm. Barak holds M.Sc. and B.Sc. in Engineering and B.A. in Economics from the Technion. Winner of Gemunder prize. Barak finished his Ph.D. in the fields of AI and Sensor Fusion. Author of several papers and patents. He is the founder and CEO of ALMA Tech. LTD, an AI & advanced navigation company.

Further reading and comments

[1] GCNs were first introduced in “Spectral Networks and Deep Locally Connected Networks on Graphs” (Bruna et al, 2014).

[2] A paper named “T-GCN: A Temporal Graph Convolutional Network for Traffic Prediction” by Ling Zhao et al was published in IEEE, 2020.

[3] The accompanied code can be found on the tutorial page of Keras. on the website. Arash Khodadadi is the author of the Keras tutorial for this paper. Data in [6].

[4] Colab implementation: Timeseries_Traffic_Forecasting. The dataset is from [3].

[5] Do we need deep graph neural networks — by Michael Bronstein

[6] The data can be found at the Keras website at the following link:

Traffic Forecasting: The Power of Graph Convolutional Networks on Time Series was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓