2026 Volume 35 Issue 7
Article Contents

Xiaolong Fan, Jialin He. MGTTP: A multi-graph transformer model for traffic flow forecasting via bidirectional spatio-temporal interaction[J]. Chinese Physics B, 2026, 35(7): 078905. doi: 10.1088/1674-1056/ae6635
Citation: Xiaolong Fan, Jialin He. MGTTP: A multi-graph transformer model for traffic flow forecasting via bidirectional spatio-temporal interaction[J]. Chinese Physics B, 2026, 35(7): 078905. doi: 10.1088/1674-1056/ae6635

MGTTP: A multi-graph transformer model for traffic flow forecasting via bidirectional spatio-temporal interaction

  • Received Date: 21/12/2025
    Accepted Date: 25/04/2026
    Available Online: 01/07/2026
通讯作者: 陈斌, bchen63@163.com
  • 1. 

    沈阳化工大学材料科学与工程学院 沈阳 110142

  1. 本站搜索
  2. 百度学术搜索
  3. 万方数据库搜索
  4. CNKI搜索

Figures(2)  /  Tables(10)

Article Metrics

Article views(118) PDF downloads(0) Cited by(0)

Access History

MGTTP: A multi-graph transformer model for traffic flow forecasting via bidirectional spatio-temporal interaction

Abstract: Accurate traffic flow forecasting hinges on modeling coupled spatio-temporal dependencies rather than treating space and time in isolation. Many prior methods process spatial and temporal features separately — either in series or in parallel — and then fuse them with simple operators, which weakens their ability to capture intrinsic space–time interactions. We propose multi-graph transformer for traffic flow forecasting (MGTTP), a framework with an innovatively designed bidirectional spatio-temporal interaction mechanism: temporal signals guide multi-graph spatial fusion, while spatial context guides attention-based temporal aggregation. It addresses the limitations of static spatial fusion in existing multi-graph models and the serial spatio-temporal modeling paradigm in vanilla transformer baselines, achieving deep coupled modeling of spatio-temporal features. First, MGTTP builds three complementary graphs — adjacency, reachability, and similarity — and applies temporal feature-guided attention to dynamically fuse their multi-dimensional spatial representations. Subsequently, a transformer encoder captures long-term temporal dependencies, with spatial feature-guided attention to aggregate the time series. Finally, a gated fusion module realizes the ultimate fusion of spatio-temporal features for prediction. Extensive experiments on four public real-world traffic datasets demonstrate that MGTTP outperforms all compared mainstream baseline models across all evaluation metrics, with statistically significant performance gaps, validating the effectiveness of the proposed bidirectional spatio-temporal interaction mechanism.

1.   Introduction
  • Traffic flow forecasting is a core capability of intelligent transportation systems (ITS), supporting congestion management, route optimization, and urban planning. With rapid urbanization and growing vehicle ownership, the need for timely and accurate forecasts is more pressing than ever. Historical data from loop detectors and global positioning system (GPS) devices exhibit rich spatio-temporal structure: spatial dynamics reflect road topology, multi-hop connectivity, and functional similarity across regions; temporal dynamics show daily/weekly cycles, seasonal trends, and regime shifts. Meanwhile, the raw traffic flow data inevitably contain noise interference caused by sensor failures, abnormal weather, and other factors during data acquisition, which also reduces the accuracy of traffic flow forecasting.[1] Effectively modeling both dimensions — and, crucially, their interactions — remains a central challenge.

    Classical time-series models such as autoregressive integrated moving average (ARIMA) capture temporal correlations but struggle to encode the non-Euclidean spatial dependencies of road networks.[2] Deep learning has advanced the field, especially graph neural network (GNN)-based approaches that model traffic on graphs where nodes are sensors or intersections and edges capture connectivity or similarity.[3–6] However, existing methods have three core limitations that hinder deep spatio-temporal coupled modeling.

    First, most methods rely on a single, predefined adjacency matrix: e.g., diffusion convolutional recurrent neural network (DCRNN)[7] and spatio-temporal graph convolutional network (STGCN)[8] only consider physical adjacency relations, limiting their ability to represent multi-facet spatial relations in traffic systems. Multi-graph fusion models, represented by spatio-temporal multi-graph convolutional network (ST-MGCN)[9] and temporal multi-graph convolutional network (TMGCN),[10] incorporate multi-dimensional spatial graph structures yet only integrate multi-graph features through static weighting or concatenation, without adaptively tuning the weights of distinct spatial relations based on the temporal dynamics of individual nodes. This results in a decoupling between spatial modeling and temporal features.

    Second, recurrent neural network/long short-term memory (RNN/LSTM) models[11] face difficulties with very long-range dependencies and limited parallelism despite their excellent temporal modeling performance. Transformer-based spatio-temporal models such as the ST-transformer and ST large language model (ST-LLM)[12] excel at capturing long-range temporal dependencies, but they still follow a two-stage serial structure: “independently modeling spatial features first, then independently modeling temporal features, and finally performing shallow fusion”, where spatio-temporal information flows only unidirectionally, failing to achieve deep feature-level interaction.

    Most importantly, spatial and temporal modules are often designed separately and only loosely fused via simple serial or parallel feature fusion approaches, overlooking the intrinsic coupling between space and time, which leads to suboptimal prediction performance.

    To address these issues, we present a multi-graph transformer for traffic flow forecasting (MGTTP), a multi-graph transformer with bidirectional spatio-temporal closed-loop interaction. Unlike existing approaches that simply combine temporal and spatial features via serial or parallel concatenation (i.e., a simple two-step sequential design), our model achieves deep coupling of spatio-temporal features through two mutually conditional steps forming a closed-loop bidirectional interaction: temporal-guided spatial fusion and spatial-guided temporal aggregation. This differs fundamentally from the unidirectional serial pipeline of existing methods: temporal features dynamically guide the fusion of three spatial views — adjacency, reachability, and similarity — while spatial features inform temporal attention to focus on the most relevant historical data. This design ensures that spatial feature extraction is conditioned on the temporal dynamics of individual nodes, while temporal feature aggregation is modulated by spatial context, overcoming the limitations of unidirectional information flow in conventional two-stage fusion paradigms and yielding deeply coupled representations beyond naive concatenation or static weighting.

    The main contributions of this work are summarized as follows.

    (i) We propose a bidirectional spatio-temporal interaction architecture incorporating two novel mechanisms: time-guided spatial feature fusion and space-guided temporal feature aggregation. This design realizes mutually conditional closed-loop modeling of spatio-temporal features, addressing the drawbacks of spatio-temporal separation and unidirectional information flow in existing methods.

    (ii) We develop a multi-perspective spatial representation learning framework that simultaneously constructs three distinct graph types — adjacency, reachability, and similarity — each capturing complementary spatial dependencies arising from physical connectivity, path-based propagation, and functional similarity, respectively.

    (iii) We design a peak-aware adaptive weighted loss function that assigns higher weights to samples corresponding to peak traffic periods, alleviating the critical limitation of conventional MSE loss — its insensitivity to prediction accuracy during peak traffic hours in real-world applications.

    (iv) We conduct extensive experiments on four real-world public traffic datasets, demonstrating that the proposed MGTTP model achieves superior prediction performance over all compared mainstream baseline models across all key evaluation metrics, validating the effectiveness of each core component.

    The remainder of this paper is organized as follows: Section 2 provides a review of related work; Section 3 details the methodology underlying the MGTTP model; Section 4 discusses experimental results; and Section 5 concludes with a summary and directions for future research.

2.   Related work
  • Early spatial modeling approaches predominantly employed convolutional neural networks (CNNs) to process gridded traffic data. However, these methods encountered inherent difficulties when applied to the non-Euclidean topology of real-world road networks. The advent of graph neural networks (GNNs) provides a robust framework to address this challenge. Notably, DCRNN, introduced by Li et al.,[7] integrates diffusion convolution with gated recurrent units to capture spatial dependencies on graph-structured data. Similarly, STGCN, proposed by Yu et al.,[3] models spatio-temporal correlations through the combination of graph convolution and temporal convolution operations. These seminal contributions underscore the efficacy of GNN-based methodologies in traffic flow forecasting.

    Nonetheless, the majority of early GNN models rely on predefined static graphs constructed primarily on the basis of physical proximity, thereby constraining their capacity to represent non-local spatial dependencies. To mitigate this limitation, subsequent research has investigated adaptive graph construction strategies. For instance, Graph WaveNet, developed by Wu et al.,[13] employs learnable node embeddings to generate an adaptive adjacency matrix, while AGCRN, proposed by Bai et al.,[14] uncovers implicit node relationships in a fully data-driven manner. Although these adaptive approaches enhance model flexibility, the resultant graph structures often lack explicit physical interpretability.

  • In light of the limitations associated with single-graph structures, recent research has progressively shifted towards multi-graph fusion techniques. For example, ST-MGCN, introduced by Geng et al.,[9] integrates a proximity graph with a point-of-interest (POI) similarity graph. Similarly, TMGCN, proposed by Lv et al.,[10] simultaneously models adjacency, functional similarity, and traffic connectivity among regions. These studies collectively highlight the promise of multi-graph fusion in capturing complex spatial dependencies. Nonetheless, existing approaches exhibit several inherent limitations: the dimensionality of fused graphs remains relatively constrained; fusion strategies commonly employ simplistic operations such as weighted summation or feature concatenation, which are essentially static fusion approaches; they lack adaptive mechanisms to dynamically adjust fusion weights according to the temporal dynamics of individual nodes; and critically, there is no interaction between spatial modeling and temporal features.

  • In recent years, attention mechanisms have been extensively employed in spatio-temporal prediction tasks. The transformer architecture[15] has demonstrated superior capability in capturing long-range temporal dependencies via its self-attention mechanism. Xu et al.[16] applied the transformer framework to traffic forecasting, empirically validating its effectiveness in modeling long-term temporal dynamics. However, most existing attention-based methods predominantly follow the serial pipeline of “spatial modeling, temporal modeling, and feature fusion”, without explicitly enabling bidirectional interaction and collaborative optimization between spatio-temporal features.

    In contrast to these approaches, the bidirectional spatio-temporal interaction mechanism proposed herein not only integrates richer and more comprehensive graph information but also fosters deep, reciprocal interactions between spatial and temporal features. This design enables coupled spatio-temporal representation learning that transcends simplistic feature fusion strategies.

  • Let X∈ℝN×T×F denote the historical traffic flow data, where N represents the number of nodes (i.e., traffic detectors) within the traffic network, T corresponds to the total number of historical time steps with a fixed input window size of T = 12 (each time step is 5 minutes, corresponding to 1 hour of historical data), and F indicates the feature dimension per time step. The raw input features include traffic flow, average speed, and average occupancy; however, only the traffic flow value is used for prediction in this work, hence F = 1. The objective is to predict the future traffic flow Y∈ℝN×T′×F over the subsequent T′ = 12 future time steps (corresponding to 1 hour of future data).

  • The MGTTP model is grounded in the core principle of bidirectional spatio-temporal closed-loop interaction and comprises four essential components: (1) initial temporal feature extraction, which supplies temporal context to guide subsequent spatial feature learning; (2) multi-view spatial representation learning, involving the construction and fusion of feature representations derived from multiple spatial graphs; (3) long-term temporal dependency modeling, which leverages the transformer architecture to capture complex temporal patterns across extended time horizons; and (4) bidirectional spatio-temporal interaction fusion, facilitating deep reciprocal interaction between spatial and temporal features to generate the final prediction. Figure 1 provides an overview of MGTTP, integrating multi-graph spatial learning with bidirectional spatio-temporal interaction.

  • To effectively capture the temporal dynamics inherent to each node within the spatial feature extraction process, we begin by deriving an initial temporal feature vector for each individual node. Given the historical traffic flow matrix for node i, denoted as Xi∈ℝT×F, a one-dimensional convolutional neural network (1D CNN) is applied

    where Conv1D(·) denotes the 1D convolution operator and d′ represents the dimensionality of the convolutional output feature. The complete hyperparameters of the 1D convolution are set as: kernel size = 3, stride = 1, padding = 1, which ensures the output sequence length is consistent with the input, and the output feature dimension d′ = 64. This vector encapsulates the essential temporal dynamic characteristics of node i and constitutes the key input for the subsequent time-guided spatial feature fusion.

  • (i) Adjacency graph construction The adjacency graph Ga(V, E, Wa) is employed to characterize local spatial dependencies among nodes within the traffic network. An edge (i, j) ∈ E is established if nodes i and j are directly connected by a road segment. The corresponding edge weight is defined by an exponential decay function dependent on the physical distance dij between nodes:

    where α denotes the attenuation coefficient, which physically represents the strength of distance decay and governs the influence range of local adjacency relationships. This parameter is determined via grid search on the validation set and is fixed at 0.1 throughout this work. This setting achieves an optimal balance between capturing local correlations and filtering out noise. The optimality of this value has been verified through the hyperparameter ablation experiment detailed in Subsection 4.5.2, and the parameter remains fixed across all datasets.

    (ii) Reachability graph construction The reachability graph Gr(V, E, Wr) is designed to capture path dependencies among nodes from a global perspective, thereby accounting for the indirect influence propagated through multi-hop connections. In practical traffic networks, certain intersections may lack direct geographic adjacency yet form potential traffic propagation pathways via intermediate nodes. For instance, as illustrated in Fig. 2, although nodes A and F are not directly connected by a road segment, congestion occurring at node A can indirectly impact traffic conditions at node F through other intermediary nodes.

    To effectively capture the indirect propagation relationships between nodes, we employ the communicability function to model global reachability. Originally introduced by Estrada et al.,[17] the communicability function quantifies the capacity for information transmission between two nodes within a complex network by considering all possible paths, including multi-hop connections. Concretely, it represents the cumulative influence between nodes as the matrix exponential of the adjacency matrix, thereby assigning greater weight to shorter paths. Mathematically, the matrix exponential of the adjacency matrix can be expanded as a Taylor series

    where the term with k = 0 corresponds to the identity matrix I (node self-loops, 0-hop paths), the term with k = 1 corresponds to Wa (direct node connections, 1-hop paths), and the terms with k ≥ 2 correspond to multi-hop indirect paths with two or more hops.

    Building upon this idea, we define the reachability weight matrix Wr from the adjacency weight matrix Wa associated with the underlying graph

    Here, eWa represents the matrix exponential of Wa, serving as the communicability function within the graph. This function can be interpreted as a weighted summation over all possible paths between nodes, thereby encapsulating both direct and indirect connectivity. The identity matrix I is subtracted to remove trivial self-loops; the subsequent subtraction of Wa eliminates the information of direct 1-hop connections, which are exclusively modeled by the adjacency graph. This design ensures that Wr only retains the cumulative influence of all indirect paths with a length ≥ 2 between nodes, realizing complete functional decoupling between the adjacency and reachability graphs. The adjacency graph exclusively models 1-hop direct local connections, while the reachability graph focuses on multi-hop global path propagation, reducing feature redundancy in multi-graph fusion. In real-world traffic scenarios, 1-hop congestion effects are captured by the adjacency graph, while cross-node indirect propagation effects modeled by the reachability graph serve as effective supplements.

    To improve computational efficiency and highlight valid paths, a threshold εr is applied to Wr for sparsification. For all datasets in this study, the sparsity threshold εr is uniformly set to 10−5, representing the lower effective weight bound of multi-hop paths. Its value is determined via grid search on the validation set and remains fixed across all datasets, ensuring computational control while preserving core multi-hop paths.

    For computational complexity and numerical stability, we implement:

    (i) Computational complexity optimization: The matrix exponential eWa is computed using the industry-standard Scaling and Squaring algorithm, with time complexity O(N3), where N is the number of nodes. Combined with sparsity thresholding, this approach reduces computational overhead while maintaining accuracy, rendering graph convolution complexity comparable to that of the sparse adjacency matrix. This allows scalability to large-scale networks, such as the PEMS07 dataset.

    (ii) Numerical stability control: Prior to computing the matrix exponential, spectral normalization is applied to Wa to constrain its spectral radius below 1, avoiding numerical explosion. Double-precision floating-point arithmetic further ensures stability for large-scale graphs.

    (iii) Similarity graph construction: The similarity graph captures functional relationships between nodes that, while not necessarily spatially proximal, exhibit analogous traffic patterns. For instance, intersections in different regions near schools may share similar commuting patterns. To quantify these similarities, we employ the dynamic time warping (DTW) algorithm, denoted as DTW(·, ·), which calculates the optimal nonlinear alignment distance between two time series.[18] Unlike point-wise metrics such as Euclidean distance, DTW mitigates sensitivity to temporal shifts and scaling, better capturing the dynamic shapes of traffic flow.

    Formally, given two time series A = (a1, a2, …, an) and B = (b1, b2, …, bm), DTW constructs a cost matrix and applies dynamic programming to find the minimal cumulative cost path from (1,1) to (n, m). For efficiency, we adopt FastDTW,[19] which approximates DTW with near-linear complexity by constraining the search space of the warping path, e.g., via the Sakoe–Chiba band.

    For nodes i and j, with daily traffic sequences Xi,k and Xj,k for day k, the alignment distance is computed via FastDTW. The average distance over T days is

    This average distance is transformed into a similarity weight via exponential decay:

    Graph sparsification retains edges exceeding a threshold εs, set to 10−3 for all datasets. This parameter represents the effective lower bound of functional similarity and is fixed via grid search, ensuring a balance between capturing cross-regional similarity and controlling graph sparsity.

    The core hyperparameters of the three graphs are fixed via grid search to ensure clear physical meaning, avoid semantic ambiguity, and enhance generalization stability. Fixed thresholds also support the reproducibility and practical engineering deployment of traffic flow forecasting models.

  • Following the construction of the adjacency graph Ga, reachability graph Gr, and similarity graph Gs, graph convolutional networks (GCNs) are employed to extract spatial dependency information embedded within these graphs from the input features. Each GCN utilizes the initial temporal feature matrix xinit,i (Subsection 3.3) as input. For a given graph Gt = (V, E, Wt), where t ∈ {a, r, s} denotes the adjacency, reachability, and similarity graphs respectively, normalized graph convolution operations are applied

    where Dt is the degree matrix corresponding to Wt, and I is the identity matrix to include self-loops. A multi-layer GCN then extracts spatial features. The graph convolution at layer l is formulated as

    where Θt(l) denotes the trainable weight matrix at layer l, and σ(·) represents a nonlinear activation function. After L layers, the spatial representations Ht∈ℝN×ds are obtained, capturing local spatial dependencies (Ha), global path dependencies (Hr), and functional similarity dependencies (Hs) among the nodes.

  • Given the distinct temporal dynamics of nodes, each node may rely differently on the three spatial relationships under varying traffic conditions. Unlike transformer-based baselines such as ST-transformer and ST-LLM, which use mean pooling, fixed-step extraction, or independent temporal modeling, and only perform static multi-graph feature fusion, we design a temporal-guided attention mechanism to dynamically fuse the three types of spatial features. This mechanism is the first core component of our bidirectional spatio-temporal interaction design, allowing temporal features to guide spatial modeling and breaking the decoupling between spatial and temporal modules in existing methods.

    For each node i, its initial temporal feature xinit,i serves as the query, while the corresponding spatial features hi,t act as keys and values. The attention weight αi,t for graph t ∈ {a, r, s} is computed as

    where Wq and Wk denote learnable projection matrices. The fused spatial feature for node i is obtained via a weighted sum

    Collectively, the fused spatial feature matrix Hspace∈ℝN×d is constructed by aggregating these node-level representations. This mechanism enables the model to adaptively adjust the importance of different spatial relations based on real-time temporal dynamics of each node, rather than using a fixed fusion strategy. The fused spatial features will subsequently serve as the query vector for the spatial-guided temporal aggregation module (Subsection 3.5.2), forming the second half of our bidirectional spatio-temporal interaction closed loop.

  • To capture temporal dependencies across multiple scales — such as daily peaks, weekly cycles, and irregular holiday patterns — we employ a multi-layer transformer encoder to process the historical sequence Xi∈ℝT×F for each node i. At layer l, temporal dependencies are modeled via a multi-head attention mechanism

    where each attention head is computed as

    and the scaled dot-product attention is defined by

    The output of each attention layer is followed by a residual connection and a position-wise feed-forward network (FFN)

    After passing through L transformer layers, the final temporal feature sequence Zi(L)∈ℝT×dmodel is obtained, effectively encoding multi-scale temporal patterns.

  • Traffic temporal patterns are often strongly correlated with the spatial attributes of nodes. For example, nodes in commercial districts exhibit weekday peaks, whereas residential nodes may emphasize weekends and nighttime traffic. Motivated by this observation, we propose a spatially guided temporal feature aggregation mechanism that dynamically selects and weights historical time intervals based on the spatial features learned in Subsection 3.4.3.

    Formally, for node i, let hspace,i denote the spatial feature obtained via time-guided fusion, and let the temporal feature sequence from the transformer encoder be Zi(L)=[zi,1,zi,2,…,zi,T]∈ℝT×d. We employ a cross-modal attention mechanism where the spatial feature acts as the query and the temporal features as the keys and values

    The aggregated temporal feature for node i is then

    where Wq′ and Wk′ are learnable projection matrices.

    This mechanism enables the model to adaptively extract the most relevant temporal patterns conditioned on the spatial context of each node. By assembling the temporal features of all nodes, the final temporal representation matrix Htime∈ℝN×d is produced.

    Importantly, the spatial features from the time-guided spatial fusion module serve as the query for this spatial-guided temporal aggregation, forming a closed-loop bidirectional spatio-temporal interaction. This design fundamentally differs from conventional two-step serial attention paradigms, achieving deep coupling between spatial and temporal representations.

  • Following the bidirectional spatio-temporal interaction, we obtain the coupled spatial and temporal feature matrices Hspace and Htime, respectively. The relative importance of these features may vary across traffic conditions, forecasting horizons, and node types. For instance, spatial propagation effects dominate during peak hours, while historical temporal patterns may be more influential during off-peak intervals.

    To account for this variability, we design a parameterized gating fusion mechanism that adaptively modulates the contribution of spatial and temporal features at the feature-dimension level. Formally, we introduce two learnable gating matrices Pspace and Ptime∈ℝN×d and compute the fused features as

    where σ(·) denotes the sigmoid function, constraining gating weights to [0,1], and ⊙ represents element-wise multiplication. Through end-to-end training, the gating parameters learn to optimally balance the contributions of spatial and temporal features for each node and feature dimension, improving adaptability and predictive accuracy.

  • The fused spatio-temporal feature Hcombined is subsequently mapped to the prediction space via a multi-layer perceptron (MLP) to forecast traffic flow over the upcoming T′ time steps

    Given the characteristics of traffic flow forecasting, the conventional mean squared error (MSE) loss treats all time intervals equally, neglecting the critical importance of accuracy during peak traffic periods. To mitigate this, we introduce a peak-aware adaptive weighted loss

    where the adaptive weight wi,t,f is defined as

    Here, μi and σi are the historical mean and standard deviation of traffic flow at node i, ensuring cross-node comparability; τ is a peak threshold controlling the onset of additional weighting; ρ is the peak weight coefficient controlling the amplification for high-demand periods. In this study, τ = 1.0 and ρ = 0.5 are determined via grid search on the validation set and fixed across all datasets. This design follows conventions in spatio-temporal forecasting and is inspired by the focusing parameter γ in focal loss,[20] ensuring training stability and interpretability. The ReLU function guarantees non-negativity of additional weights.

3.   Experiment
  • We evaluated the proposed MGTTP model on four public traffic network datasets: PEMS03, PEMS04, PEMS07, and PEMS08. These datasets were originally compiled and released by Song et al. (2020),[8] and collected from traffic monitoring systems in four distinct regions of California, USA.

    All data are derived from the Performance Measurement System (PeMS) operated by the California Department of Transportation (Caltrans) and are aggregated at 5-minute intervals, yielding 288 time points per working day. Prior to modeling, all input features were standardized using Z-score normalization.

    Detailed statistics of these datasets are summarized in Table 1. For experimental evaluation, each dataset is chronologically partitioned into training, validation, and test sets in a 6:2:2 ratio, without any random shuffling. This chronological split strictly adheres to the standard protocol for time-series forecasting, ensuring that future data are never used to inform past predictions.

  • We evaluated the proposed MGTTP model against a suite of mainstream representative baseline methods commonly employed in traffic flow forecasting. All baseline models were configured with core architecture parameters strictly following the optimal settings reported in their original publications, and uniformly adapted to the 12-step input and 12-step output prediction window used throughout this work.

    FC-LSTM: Fully connected long short-term memory network, a classical recurrent architecture capable of modeling long-term temporal dependencies in time series data (Sutskever et al., 2014).[21]

    DCRNN: Diffusion convolutional recurrent neural network, integrating diffusion convolution within gated recurrent units under an encoder-decoder framework to capture spatial dependencies in traffic networks (Li et al., 2017).[7]

    STGCN: Spatio-temporal graph convolutional network, combining graph convolution with one-dimensional temporal convolution to jointly extract spatial and temporal features from traffic data (Yu et al., 2017).[3]

    ASTGCN(R): Attention-based spatio-temporal graph convolutional network, enhancing modeling capability via spatio-temporal attention mechanisms. We adopt the variant that models only recent periodic components for fairness (Guo et al., 2019).[22]

    Graph WaveNet: A graph neural network framework incorporating adaptive adjacency matrices alongside dilated one-dimensional convolutions to automatically learn spatial dependencies (Wu et al., 2019).[13]

    STSGCN: Spatial-temporal synchronous graph convolutional network, synchronously modeling spatial and temporal relationships via local spatio-temporal subgraph modules (Song et al., 2020).[9]

    STGODE: Spatio-temporal graph neural ordinary differential equation, introducing continuous graph neural networks to capture dynamic spatio-temporal evolution in traffic forecasting (Fang et al., 2021).[23]

    ST-LLM: Spatio-temporal large language model, treating each location’s time step as a token, learning spatio-temporal embeddings for spatial positions and global temporal patterns, and fusing them through convolutional operations with a partially frozen attention mechanism to adapt large language models for global spatio-temporal dependency modeling (Liu et al., 2024).[12]

  • To ensure consistency, reproducibility, and fairness, all experiments maintained identical data preprocessing pipelines, dataset partitioning strategies, input/output window settings, training environments, and hyperparameter tuning budgets across MGTTP and all baseline models.

    All models were implemented using the PyTorch framework and trained on hardware consisting of an Intel(R) Xeon(R) Gold 6133 CPU @ 2.50 GHz and an NVIDIA GeForce RTX 3090 GPU. During training, hyperparameters were consistent across all models: the Adam optimizer was used with an initial learning rate of 0.001, a cosine annealing learning rate scheduler was applied, the batch size was set to 32, and the maximum number of training epochs was 100. Early stopping was employed, terminating training if the validation RMSE did not decrease for 10 consecutive epochs.

    The core architectural hyperparameters of MGTTP are summarized in Table 2. For transparency and fairness, the main architectural settings of four strong baseline models are presented in Table 3, strictly following their original optimal configurations and adapted to the 12-step input/output prediction window. The remaining baseline models (FC-LSTM, DCRNN, STGCN, ASTGCN) adhere to the above hyperparameter tuning rules.

    For performance evaluation, three standard metrics are adopted: mean absolute error (MAE), mean absolute percentage error (MAPE), and root mean squared error (RMSE). All baseline models are based on their official open-source implementations, and the reported results represent the mean of three independent runs with different random seeds, ensuring stability and reproducibility by mitigating randomness.

  • To evaluate the effectiveness of the proposed MGTTP model, we conducted a comprehensive quantitative comparison against all selected baseline methods on the four PEMS datasets, using the evaluation metrics defined in Subsection 4.3. The results, summarized in Table 4, consistently demonstrate that MGTTP achieves state-of-the-art prediction performance across all metrics and datasets.

    Specifically, MGTTP attains MAE values of 15.49, 19.37, 21.62, and 15.50, and RMSE values of 26.83, 31.42, 34.85, and 24.47 on PEMS03, PEMS04, PEMS07, and PEMS08, respectively, outperforming all comparative baselines, including the recent ST-LLM, on most evaluation metrics.

    Compared with classical graph-based models such as DCRNN and STGCN, which integrate graph convolution with recurrent architectures, MGTTP achieves a relative improvement of 10% to 15% in RMSE across all datasets, highlighting the effectiveness of the multi-graph fusion strategy in capturing spatial heterogeneity. Notably, even against stronger baselines such as Graph WaveNet and STGODE, which leverage adaptive adjacency matrices and neural ordinary differential equations (ODEs) respectively, MGTTP maintains superior predictive performance. This advantage is primarily attributed to its richer spatial relation modeling and fine-grained bidirectional spatio-temporal attention mechanism, which enables more accurate traffic forecasting across diverse traffic conditions and datasets.

    It is particularly noteworthy that MGTTP consistently outperforms the recently proposed ST-LLM method across all datasets. Although ST-LLM innovatively leverages large language models by treating time steps as tokens and designing spatio-temporal embeddings to capture global patterns, its general-purpose architecture lacks task-specific specialization for traffic prediction. In contrast, MGTTP is explicitly tailored for traffic flow forecasting, enabling more precise modeling of the unique spatio-temporal dynamics inherent in traffic data. For example, on PEMS04, MGTTP reduces MAE by 2.6% relative to ST-LLM (from 19.89 to 19.37), while on PEMS08, the improvement reaches 2.8% (from 15.94 to 15.50).

    Compared with STGODE, the second-best performing model, MGTTP achieves notable MAE improvements of 7.1% on PEMS04 and 7.8% on PEMS08. In particular, MGTTP reduces MAPE to 9.19% and 9.84% on PEMS07 and PEMS08, respectively, surpassing all compared baselines and demonstrating superior accuracy in low-error scenarios. These consistent and significant performance gains underscore the effectiveness of the MGTTP architecture in capturing complex spatio-temporal dependencies, dynamics, and heterogeneity in traffic flow data.

    In terms of stability, MGTTP exhibits smaller performance standard deviations than all baseline models across the datasets, indicating enhanced robustness under different random seeds.

    To verify the statistical significance of the improvements, we conducted a one-tailed paired samples t-test between MGTTP and ST-LLM at a 95% confidence level. The test settings are as follows:

    Paired objects: Prediction errors (MAE, RMSE, MAPE) of MGTTP and ST-LLM for each test sample across three independent repeated experiments (with different random seeds) were paired one-to-one.

    Prediction horizons: The test was performed over all 12 prediction steps (5–60 min).

    Hypotheses: The null hypothesis H0 states that “there is no significant difference between the prediction errors of MGTTP and ST-LLM,” while the one-tailed alternative hypothesis H1 states that “the prediction error of MGTTP is significantly lower than that of ST-LLM.” A p-value < 0.05 indicates statistical significance.

    The p-values of the paired t-test are summarized in Table 5. All metrics yielded p-values below 0.05, leading to rejection of H0. This confirms that MGTTP’s performance improvements are statistically significant and not attributable to random fluctuations.

  • To rigorously assess the effectiveness of each core component of the proposed MGTTP model, we conducted two categories of ablation experiments following the single-variable control principle: (i) Necessity ablation of core modules, which evaluates the performance contribution of each essential design. (ii) Optimality ablation of key hyperparameters, which verifies the validity of the selected core hyperparameter settings.

    All ablation experiments were performed on two representative datasets, PEMS04 and PEMS08, while keeping the training environment and all non-pertinent hyperparameters fixed to ensure fair comparison.

  • The results of the necessary ablation experiments are summarized in Table 6, illustrating the contribution of each individual module to the overall predictive performance.

  • We first evaluate the contribution of the temporal feature extraction module. As shown in Table 6, the variant “-Htime”, which omits the spatio-temporal attention mechanism and simply averages the transformer outputs at the final time step, exhibits notable performance degradation. On PEMS04, MAE increases from 19.37 to 20.64. These results confirm that the spatio-temporal attention mechanism effectively integrates spatial context when aggregating temporal features, enabling richer and more informative temporal representations.

  • To assess the contribution of the multi-graph fusion strategy, we conducted ablations by removing each graph structure — adjacency, reachability, or similarity — individually. Excluding any single graph consistently increases prediction error, indicating that the multi-graph fusion framework outperforms any two-graph combination. A comparison with the full MGTTP model (Table 4) shows that all ablated variants (-adjacency, -reachability, -similarity) degrade performance across all metrics. This highlights that adjacency, reachability, and similarity graphs capture complementary spatial dependencies essential for accurate traffic forecasting. Notably, the relative importance of each graph varies between datasets: on PEMS04, removing adjacency has the largest impact (MAE 19.84), whereas on PEMS08, omitting either adjacency or similarity yields significant degradation, reflecting differences in network topology and functional zoning.

  • We further validate the design choice in Eq. (3) by constructing an ablation variant Wr = eWa, retaining self-loops and the 1-hop adjacency term. This variant shows clear performance drops: on PEMS04, MAE rises from 19.37 to 19.76 and RMSE from 31.42 to 32.18; on PEMS08, MAE rises from 15.50 to 16.31 and RMSE from 24.47 to 25.64. Retaining I and Wa introduces redundant modeling between reachability and adjacency graphs, validating the necessity of the original functional decoupling in the multi-graph design.

  • The adaptive gating fusion mechanism is evaluated by replacing it with simple feature concatenation (− adaptive gating, + feature concatenation). As reported in Table 6, this ablation leads to substantial performance degradation: on PEMS04, MAE increases from 19.37 to 19.94; on PEMS08, from 15.50 to 16.74. These results demonstrate that the adaptive gating mechanism dynamically modulates the contributions of spatial and temporal features at both node and feature levels, adjusting to heterogeneous traffic scenarios. In contrast, fixed concatenation fails to capture the varying importance of spatio-temporal information, highlighting the gating module as critical for high-performance prediction.

  • Finally, the peak-aware adaptive weighted loss function is evaluated by replacing it with the standard MSE (i.e., peak-aware loss vs. MSE). Table 6 shows clear performance deterioration: on PEMS04, RMSE increases from 31.42 to 32.49; on PEMS08, from 24.47 to 25.67, corresponding to a 4.90% relative increase. The peak-aware loss enhances accuracy during critical periods such as peak traffic hours by dynamically weighting samples according to practical importance. Compared with the uniform MSE loss, it guides the model to focus on high-impact periods, supporting effective traffic management and practical deployment.

  • In this set of experiments, we strictly adhere to the single-variable control principle: all other model parameters are fixed at their optimal values while only the core hyperparameters of the target graph are varied. This allows for a direct assessment of the optimality of the hyperparameter values adopted in this work. All hyperparameters were initially determined via grid search on the PEMS04 validation set and then fixed across all other datasets. The ablation results demonstrate the generalization stability of these fixed settings across similar traffic datasets.

    (i) Decay coefficient of the adjacency graph

    To verify the optimality of the adjacency graph decay coefficient, we conducted an ablation study varying its value while keeping all other hyperparameters unchanged. The results, summarized in Table 7, show that the selected decay coefficient yields the lowest prediction error. Deviating from this value leads to a gradual degradation in both MAE and RMSE, indicating that the chosen coefficient effectively balances the influence of neighboring nodes, capturing local spatial dependencies without over-smoothing or under-weighting adjacent information.

    The experimental results indicate that the decay coefficient α = 0.1 selected in this work is optimal. When α = 0.01, the decay intensity is too weak; this allows correlations from overly distant nodes to persist and introduces noise interference. Conversely, when α = 1.0, the decay intensity is excessively strong, retaining only the connections of very close neighboring nodes and discarding valid spatial information from adjacent road segments. The choice of α = 0.1 effectively balances local correlation capture with noise filtering, achieving the best prediction performance.

    (ii) Sparsity threshold of the reachability graph

    To validate the optimal sparsity threshold εr for the reachability graph, we conducted an ablation study with varying threshold values, and the results are summarized in Table 8. The experiments show that εr = 10−5 is the optimal value. A higher threshold, εr = 10−4, is overly strict, filtering out many valid multi-hop paths and failing to fully capture global reachability correlations. In contrast, a lower threshold, εr = 10−6, is too permissive, introducing numerous edges with extremely low weights, which increases computational overhead and the risk of overfitting. Setting εr = 10−5 retains the core multi-hop paths while maintaining graph sparsity and computational efficiency.

    (iii) Sparsity threshold of the similarity graph

    To determine the optimal sparsity threshold εs for the similarity graph, we conducted an ablation study with different threshold values, and the results are summarized in Table 9. The experiments indicate that the selected value of εs = 10−5 achieves the best balance. A higher threshold, εs = 10−4, is excessively restrictive, removing many valid similarity-based edges and weakening the model’s ability to capture functional correlations between nodes. Conversely, a lower threshold, εs = 10−6, is overly permissive, introducing a large number of weak and potentially noisy connections, which increases computational cost and risks overfitting. Setting εs = 10−5 effectively preserves meaningful functional similarity edges while maintaining sparsity and efficiency in the graph structure.

    (iii) Sparsity threshold of the similarity graph

    To determine the optimal sparsity threshold εs for the similarity graph, we conducted an ablation study with different threshold values. The result, summarized in Table 9, shows that the selected value εs = 10−3 achieves the best trade-off. When εs = 10−2, only node pairs with extremely high similarity are retained, which fails to fully capture cross-regional functional correlations. Conversely, εs = 10−4 introduces many weak and redundant edges, causing noise interference. The choice of εs = 10−3 effectively balances the extraction of meaningful functional similarity and the sparsity of the graph, validating the scientific rationale of this hyperparameter setting.

  • We further investigate the optimal values of τ and ρ in the peak-aware adaptive weighted loss function. A grid search experiment was performed on the PEMS04 validation set, and the results are summarized in Table 10. The findings confirm that the selected values of τ = 1.0 and ρ = 0.5 achieve the best prediction performance, effectively emphasizing peak traffic periods while maintaining overall model stability and accuracy.

    The experimental results indicate that the selected hyperparameter combination τ = 1.0 and ρ = 0.5 is optimal. When τ is too small or ρ is too large, the model excessively emphasizes extreme peak values, neglecting regular traffic patterns during off-peak periods. Conversely, if τ is too large or ρ too small, the peak-aware mechanism becomes ineffective, and prediction accuracy for peak hours cannot be substantially improved. These findings confirm the rationality of the adopted hyperparameter values.

  • The ablation experiments systematically validate the rationality of the MGTTP model design. The necessity ablation demonstrates that all four core components — spatially-guided temporal aggregation, multi-graph fusion strategy, adaptive gating fusion mechanism, and peak-aware loss function — are indispensable for achieving high prediction performance. The optimality ablation further confirms the scientific validity of the key hyperparameter settings, providing rigorous quantitative support for the core conclusions of this study.

4.   Conclusion
  • In this paper, we propose MGTTP, a multi-graph transformer model for traffic flow forecasting based on bidirectional spatio-temporal interaction. By adopting a bidirectional mechanism of time-guided spatial fusion and space-guided temporal aggregation, the model overcomes the limitations of conventional spatio-temporal separate modeling strategies. Simultaneously, through parallel fusion of adjacency, reachability, and similarity graphs, MGTTP effectively captures multi-dimensional spatial dependencies in traffic networks.

    Extensive experiments on four PEMS datasets demonstrate that MGTTP outperforms all selected mainstream baseline models across key evaluation metrics, achieving statistically significant improvements over state-of-the-art methods. Ablation studies further verify that the bidirectional spatio-temporal interaction and multi-graph fusion modules play critical roles in capturing latent and complementary semantic information in traffic data. Both adaptive gating fusion and the peak-aware loss function are effective components for boosting predictive performance, and the individual modules exhibit strong complementary synergy.

    Looking forward, although MGTTP achieves favorable predictive performance, real-world traffic systems are influenced by diverse exogenous factors such as weather, holidays, and special events, and cross-domain generalization remains a critical challenge. Future work will focus on two key extensions: (i) incorporating heterogeneous exogenous information as additional node attributes or via a global contextual vector through a dedicated information fusion module; and (ii) evaluating and optimizing cross-city generalization performance on datasets with varying road networks, traffic patterns, and data sources. We anticipate that these enhancements will further improve prediction accuracy, robustness to anomalies, interpretability, and practical deployment potential, advancing MGTTP toward more intelligent and adaptable traffic forecasting systems.

Figure (2)  Table (10) Reference (23)

Catalog

    /

    DownLoad:  Full-Size Img  PowerPoint
    Return
    Return