A traffic flow prediction method based on tree prior dynamic graph Mamba time sequence encoder
Patent Information
- Application Number
- CN202610751903.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-28
- Publication Date
- 2026-09-25
AI Technical Summary
(1)许多模型依赖预定义静态图或全局共享的自适应静态图,难以充分反映真实交通网络中随时间变化的空间相关关系;基于RNN或GRU的时序编码器在长历史窗口下存在串行计算成本高、长距离依赖建模不足等问题;
1、本发明通过构建基于Mamba时序编码器的节点独立编码机制,显著提升了长距离时间依赖建模能力与计算效率, 相比基于RNN或GRU的模型,Mamba模块采用选择性状态空间建模与门控残差结构,有效降低了串行计算开销;相比基于自注意力的模型,其在长历史窗口下仍保持线性复杂度,避免了平方级计算增长。实验结果表明,移除Mamba模块后预测误差显著升高(PeMSD4数据集上MAE由19.97升至44.77),且本发明在参数量(仅23.9万)和训练时间(22.3分钟)上均优于MTGNN、DGCRN等多种基线方法,具备良好的工程部署潜力。
Smart Images

Figure CN122821758A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of intelligent transportation, spatiotemporal sequence prediction and artificial intelligence, specifically to a traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder. Background Technology
[0002] Traffic flow prediction is a key foundational capability in intelligent transportation systems, and its results directly serve congestion warning, dynamic signal control, route planning, public transport scheduling, vehicle-road cooperation, and arrival time estimation for travel service platforms. Existing traffic flow prediction methods can be broadly categorized into statistical learning methods and deep learning methods. Traditional statistical methods, such as historical averaging, vector autoregression, and ARIMA, rely heavily on the assumption of stationarity and have limited adaptability to complex nonlinear traffic fluctuations. When facing holidays, emergencies, tidal traffic, and multi-source disturbances, their prediction accuracy often falls short of practical deployment requirements.
[0003] With the development of deep learning, convolutional neural networks, recurrent neural networks, and graph neural networks have been widely applied to traffic flow prediction tasks. In particular, methods based on graph convolution can utilize the spatial connectivity between sensors to model propagation effects in road networks. However, existing methods still have the following shortcomings: (1) Many models rely on predefined static graphs or globally shared adaptive static graphs, which are difficult to fully reflect the spatial correlations that change over time in real traffic networks; time-series encoders based on RNN or GRU have problems such as high serial computation cost and insufficient long-distance dependency modeling under long historical windows. (2) Although the time series model based on the self-attention mechanism has a strong ability to model long-range dependencies, the computational complexity increases significantly with the length of the sequence, which is not conducive to large-scale real-time deployment. Although dynamic graph learning can enhance the ability to characterize time-varying structures, it is easy to generate pseudo-correlation edges in scenarios with noise, missing values or short-term disturbances, which causes the adjacency matrix to fluctuate drastically over time, thereby reducing the prediction stability and generalization ability.
[0004] Therefore, there is an urgent need to propose a traffic flow prediction technology that can balance long-term modeling efficiency, time-varying spatial dependency characterization capability, and structural robustness to meet the practical application needs of multi-step prediction in complex urban road network scenarios. Summary of the Invention
[0005] The purpose of this invention is to provide a traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder, so as to solve the problems existing in the prior art mentioned in the background.
[0006] To achieve the above objectives, the present invention provides the following technical solution: A traffic flow prediction method based on a tree-prior dynamic graph Mamba temporal encoder includes the following steps: S1: Obtain the traffic network map and historical traffic flow sequences; S2: Construct the TPDGMN model for multi-step traffic flow prediction, specifically including: S21: Perform feature mapping on the historical traffic flow sequence to obtain a node-level latent space representation; S22: The Mamba temporal encoder is used to independently encode each node along the time dimension to obtain a temporal hidden representation; S23: Generate a dynamic graph adjacency matrix based on the historical traffic flow sequence; S24: Construct the tree prior adjacency matrix, and construct the tree prior regularization loss term based on the difference between the dynamic graph adjacency matrix and the tree prior adjacency matrix; S25: Perform spatiotemporal fusion based on the temporal hiding representation and the dynamic graph adjacency matrix, and output multi-step prediction results; S26: Using the prediction loss and the tree prior regularization loss term as a joint training objective, the model is trained end-to-end to obtain the final traffic flow prediction model.
[0007] Preferably, in step S22, the Mamba time encoder includes multiple residual blocks, each residual block including layer normalization, selective state space modeling, gated residual connection and Dropout operation, to improve long-distance dependency modeling capability and reduce serial computation overhead.
[0008] Preferably, the specific process of generating the dynamic graph adjacency matrix in step S23 includes: By aggregating the historical sequence along the time dimension using the mean, we obtain the historical description vector of each node. The historical description vectors are mapped to the hidden space using a multilayer perceptron, and the similarity scores between nodes are calculated using a scaled inner product. Perform Top-k sparsity on the outer edges of each node, retaining only the k most similar neighbors; The sparsified score matrix is subjected to row-wise Softmax normalization, and combined with Dropout operation to obtain the adjacency matrix of the time-varying dynamic graph.
[0009] Preferably, the specific process of constructing the tree prior adjacency matrix in step S24 includes: Shortest path completion is performed based on the road distance graph to obtain the complete node distance relationships; The distance matrix is converted into a compressed form, and a cluster merging sequence is generated through hierarchical clustering. In each cluster merging process, the node pair with the smallest distance between the cross-cluster node pairs of the left and right clusters is selected to establish an undirected edge until the clustering is completed, thereby obtaining a symmetric sparse tree-like adjacency matrix, which serves as the tree prior adjacency matrix.
[0010] Preferably, the tree prior regularization loss term is measured by calculating the Frobenius norm or L1 mean of the difference between the dynamic graph adjacency matrix and the tree prior adjacency matrix, and is used to suppress spurious related edges and structural drift in dynamic graph learning.
[0011] Preferably, the specific process of performing spatiotemporal fusion and outputting multi-step prediction results in step S25 includes: The current node state is represented by the last time node output by the Mamba time encoder. On the adjacency matrix of the dynamic graph, an adaptive vertex-weighted graph convolution based on Chebyshev multinomials is used for spatial propagation, aggregating neighborhood information of different orders to form a spatiotemporal fusion representation; The spatiotemporal fusion representation is mapped into traffic flow prediction results for multiple future time steps in one go by a convolutional prediction head, achieving direct multi-step output.
[0012] Preferably, the joint training objective in step S26 is represented as: L = Lpred + Ltree Where Lpred is the prediction error term and Ltree is the tree prior regularization term.
[0013] A traffic flow prediction system based on a tree prior dynamic graph Mamba temporal encoder, characterized in that the system comprises: The data acquisition module is used to acquire traffic network maps and historical traffic flow sequences; The feature mapping module is used to perform feature mapping on the historical traffic flow sequence to obtain a node-level latent space representation; The Mamba temporal encoding module is used to independently encode each node along the time dimension to obtain a temporally hidden representation; The dynamic graph learning module is used to generate a dynamic graph adjacency matrix based on the historical traffic flow sequence; The tree prior constraint module is used to construct the tree prior adjacency matrix and construct the tree prior regularization loss term based on the difference between the dynamic graph adjacency matrix and the tree prior adjacency matrix. The spatiotemporal fusion and prediction module is used to perform spatiotemporal fusion based on the temporal hiding representation and the dynamic graph adjacency matrix, and output multi-step prediction results; The training module is used to perform end-to-end training on the model, using the prediction loss and the tree prior regularization loss term as the joint training objective.
[0014] An application of a traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder is presented, which is applied to traffic management, congestion warning, proactive guidance, travel service platforms, or vehicle-road cooperative scenarios.
[0015] Compared with the prior art, the beneficial effects of the present invention are: 1. This invention significantly improves the ability to model long-distance temporal dependencies and computational efficiency by constructing a node-independent encoding mechanism based on the Mamba temporal encoder. Compared with RNN or GRU-based models, the Mamba module adopts selective state-space modeling and gated residual structure, effectively reducing the serial computation overhead. Compared with self-attention-based models, it maintains linear complexity under long history windows, avoiding quadratic computational growth. Experimental results show that removing the Mamba module significantly increases the prediction error (MAE increases from 19.97 to 44.77 on the PeMSD4 dataset). Furthermore, this invention outperforms various baseline methods such as MTGNN and DGCRN in terms of parameter count (only 239,000) and training time (22.3 minutes), demonstrating good potential for engineering deployment.
[0016] 2. This invention effectively suppresses the generation of spurious edges and structural drift under noise and short-term disturbances by constructing a tree-based prior adjacency matrix and introducing a regularization loss term to constrain the dynamic graph learning process, thereby improving the robustness of time-varying spatial dependency modeling. Addressing the problem that existing dynamic graph learning methods easily generate false spatial connections and lead to decreased prediction stability in scenarios with missing data or disturbances, this invention generates a tree-based prior graph based on the road distance graph through shortest path completion and hierarchical clustering. A regularization term is constructed using the difference between this prior graph and the learned dynamic graph, allowing the dynamic graph to maintain time-varying adaptability while also considering structural prior constraints. Ablation experiments show that after removing the tree-based prior regularization term, the model's MAE increases from 15.96 to 16.08 and RMSE increases from 25.05 to 25.16 on the PeMSD8 dataset, verifying that this mechanism can effectively suppress structural fluctuations, thus achieving more stable and reliable multi-step traffic flow prediction in complex urban road network scenarios. Attached Figure Description
[0017] Figure 1 This is a flowchart of the method of the present invention.
[0018] Figure 2 This is a flowchart of step 2 of the method of the present invention.
[0019] Figure 3 This is a flowchart illustrating the specific implementation of the method of the present invention.
[0020] Figure 4 This is an overall framework diagram of the method of the present invention.
[0021] Figure 5 This is a flowchart of the Mamba module in the method of the present invention.
[0022] Figure 6 This is a flowchart of the dynamic graph learner module of the method of the present invention.
[0023] Figure 7 This is a flowchart of the tree prior regularization constraint module of the method of the present invention.
[0024] Figure 8 This is a graph showing the prediction performance of the method of this invention and six comparative methods across 12 horizons. Detailed Implementation
[0025] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below in conjunction with specific embodiments.
[0026] Please see Figure 1-7 The present invention provides the following technical solutions: A traffic flow prediction method based on a tree-prior dynamic graph Mamba temporal encoder includes the following steps: S1: Obtain the traffic network map and historical traffic flow sequences; the traffic network map is represented as graph G=(V,E), where V is the set of monitoring nodes and E is the set of road connectivity relationships. Construct historical observation sequences. Using data from the past T time steps, predict traffic flow results for the next H time steps. .
[0027] S2: Construct the TPDGMN model for multi-step traffic flow prediction, specifically including: S21: Perform feature mapping on the historical traffic flow sequence to obtain the node-level latent space representation Z; project the original input onto the d-dimensional latent space for subsequent node-level temporal coding.
[0028] S22: A node-wise encoding method is adopted, and the Mamba time encoder is used to independently encode each node along the time dimension to obtain the time hidden representation H; the Mamba time encoder includes multiple layers of residual blocks, each residual block includes layer normalization, selective state space modeling, gated residual connection and dropout operation, which are used to improve the long-distance dependency modeling capability and reduce the serial computing overhead.
[0029] S23: Generate a dynamic graph adjacency matrix Alearn based on the historical traffic flow sequence; the specific process of generating the dynamic graph adjacency matrix includes: By aggregating the historical sequence along the time dimension using the mean, we obtain the historical description vector U of each node. The historical description vectors are mapped to the hidden space using a multilayer perceptron, and the similarity scores between nodes are calculated using a scaled inner product. Perform Top-k sparsity on the outer edges of each node, retaining only the k most similar neighbors; The sparsified score matrix is subjected to row-wise Softmax normalization, and combined with Dropout operation to obtain the adjacency matrix of the time-varying dynamic graph.
[0030] S24: Construct the tree prior adjacency matrix Atree, and learn the results through the dynamic graph by constraining the tree prior regularization.
[0031] First, shortest path completion is performed on the distance graph. Then, the distance matrix is converted into a compressed form, and a cluster merging sequence is generated through hierarchical clustering. During each cluster merging process, the node pair with the smallest distance between the cross-cluster nodes of the left and right clusters is selected to establish an undirected edge until the clustering is completed, thus obtaining a symmetric sparse tree-like adjacency matrix Atree. Finally, a tree prior regularization term Ltree is constructed based on the difference between Alearn and Atree.
[0032] The specific process of constructing the tree prior adjacency matrix includes: Shortest path completion is performed based on the road distance graph to obtain the complete node distance relationships; The distance matrix is converted into a compressed form, and a cluster merging sequence is generated through hierarchical clustering. In each cluster merging process, the node pair with the smallest distance between the cross-cluster node pairs of the left and right clusters is selected to establish an undirected edge until the clustering is completed, thereby obtaining a symmetric sparse tree-like adjacency matrix, which serves as the tree prior adjacency matrix.
[0033] S25: Based on the temporal hiding representation and the dynamic graph adjacency matrix, perform spatiotemporal fusion to output multi-step prediction results; the specific process of performing spatiotemporal fusion and outputting multi-step prediction results includes: The current node state S is represented by the node at the last moment output by the Mamba time encoder. On the dynamic graph adjacency matrix Alearn, an adaptive vertex-weighted graph convolution based on Chebyshev multinomials is used for spatial propagation to aggregate neighborhood information of different orders and form a spatiotemporal fusion representation Ssp. The spatiotemporal fusion representation Ssp is mapped in one step to traffic flow prediction results for the next H time steps using a convolutional prediction head. This enables direct multi-step output, reducing error accumulation caused by recursive rolling prediction.
[0034] S26: Using the prediction loss and the tree prior regularization loss term as a joint training objective, the model is trained end-to-end to obtain the final traffic flow prediction model.
[0035] The tree prior regularization loss term is measured by calculating the Frobenius norm or L1 mean of the difference between the dynamic graph adjacency matrix and the tree prior adjacency matrix, and is used to suppress spurious related edges and structural drift in dynamic graph learning.
[0036] The joint training objective is expressed as: L = Lpred + Ltree Where Lpred is the prediction error term and Ltree is the tree prior regularization term.
[0037] This invention also discloses a traffic flow prediction system based on a tree prior dynamic graph Mamba temporal encoder, the system comprising: The data acquisition module is used to acquire traffic network maps and historical traffic flow sequences; The feature mapping module is used to perform feature mapping on the historical traffic flow sequence to obtain a node-level latent space representation; The Mamba temporal encoding module is used to independently encode each node along the time dimension to obtain a temporally hidden representation; The dynamic graph learning module is used to generate a dynamic graph adjacency matrix based on the historical traffic flow sequence; The tree prior constraint module is used to construct the tree prior adjacency matrix and construct the tree prior regularization loss term based on the difference between the dynamic graph adjacency matrix and the tree prior adjacency matrix. The spatiotemporal fusion and prediction module is used to perform spatiotemporal fusion based on the temporal hiding representation and the dynamic graph adjacency matrix, and output multi-step prediction results; The training module is used to perform end-to-end training on the model, using the prediction loss and the tree prior regularization loss term as the joint training objective.
[0038] This invention also discloses an application of a traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder, which can be applied to traffic management, congestion warning, active guidance, travel service platforms or vehicle-road cooperative scenarios.
[0039] Example like Figure 1 and Figure 2 As shown, this embodiment provides a traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder. The specific implementation process of this method is as follows: Figure 3 As shown, the details are as follows: S1: Prepare the historical dataset to be predicted.
[0040] Data from monitoring nodes and road connectivity information in the urban road network are acquired to construct a traffic network graph G=(V,E). Monitoring nodes can be fixed roadside detectors, cameras, checkpoint devices, or other data acquisition terminals capable of generating time-series traffic observation data. Historical traffic flow data for each node is obtained at a fixed sampling period, and an input sequence and a prediction target sequence are constructed. The sampling interval is set to 5 minutes. Traffic flow for the next hour is predicted using historical data from the most recent hour. Missing values are filled using linear interpolation, and standardization or zero-mean normalization is performed to enhance training stability.
[0041] S2: Construct the TPDGMN model for multi-step traffic flow prediction.
[0042] The construction process of the TPDGMN prediction model includes the following steps: S21: Completed historical sequence The input feature mapping layer maps the original features to the d-dimensional latent space through linear mapping or equivalent projection operations, resulting in a node-level sequence representation Z.
[0043] (1) Then, the time series of each node is independently Mamba encoded along the time dimension to obtain the node-level temporal hidden representation: (2) in, For historical input sequences, d is the node-level sequence representation after projection, where d is the hidden dimension. This represents the temporal implicit representation of the output of the i-th node. This represents the timing coding result after summarizing all nodes.
[0044] S22: Given a batch input history sequence First, aggregate along the time dimension to obtain the historical description vector of each node: (3) Then, it is mapped to the hidden space through a multilayer perceptron: (4) And the similarity score between nodes is calculated using the scaled inner product: (5) To suppress noisy edges and control structural sparsity, Top-k sparsification is applied to the outgoing edges of each node: (6) The sparse matrix is then normalized row-wise and an application is performed. Dropout Obtain the adjacency matrix of the dynamic graph: (7) (8) S23: To suppress spurious edges caused by noise and short-term perturbations in dynamic graph learning, this invention starts from the road distance graph and constructs a tree prior adjacency matrix through shortest path completion, hierarchical clustering, and cross-cluster shortest edge connection. Let the adjacency matrix generated by the dynamic graph learning module be Alearn, then the tree prior regularization term is defined as: (9) in, For regularization weights, This represents the difference matrix between the learning graph and the tree prior graph. It becomes a scalar loss metric. When When there is a batch dimension, Extend to The samples are of the same shape, and the mean is calculated after calculating the differences for each sample to ensure the consistency of the regularization constraint across the batch dimension. In terms of metric form, when... hour, The Frobenius norm is used, which means that the average is calculated for each sample in the batch case; otherwise, the element-wise L1 mean is used as an alternative measure.
[0045] Furthermore, the overall training objective can be expressed as: (10) in, This indicates a loss of traffic flow.
[0046] S24: Take the output of the last time step of Mamba as the representation of the current node, perform spatial propagation based on Chebyshev polynomials on the dynamic graph structure, and obtain the spatiotemporal fusion representation: (11) (12) in, Let E represent the k-th order Chebyshev polynomial propagation operator, and E be the learnable node embedding. This represents the adaptive convolutional weights generated by node embedding. This design can aggregate neighborhood information of different orders on a dynamic graph structure, thereby effectively fusing the temporal representation extracted by Mamba with the dynamic spatial structure. After obtaining the fused representation Ssp, the convolutional prediction head maps it to traffic flow predictions for the next H time steps. This invention adopts a direct multi-step output method, outputting all prediction step sizes simultaneously in a single forward pass, and obtaining a standard multi-step prediction tensor through reshape / permute. (13) (14) in, =1 indicates that the prediction target dimension is univariate flow, and O represents the effect of end_conv on the... (Converted to convolutional input format) to obtain multi-step output channels. Finally, TreePrior passes the constraints. and The differences in training objectives are used to improve the stability and robustness of dynamic graph structure learning.
[0047] This invention is implemented based on the PyTorch 2.1.2 framework. The hardware used in this implementation is an Intel Platinum 8352V processor and an NVIDIA RTX 4090D GPU (24GB). To ensure fairness and reproducibility of the comparison, this embodiment uses the same training and evaluation settings in all baseline model comparison experiments with TPDGMN, namely, MAE and RMSE as the main evaluation metrics, a batch size of 64, and 100 epochs. Model training and testing are completed under the same data partitioning and experimental procedures, thus ensuring that the performance differences between different methods mainly stem from the model structure itself. The formulas for the evaluation metrics are as follows: (15) (16) To evaluate the performance of the proposed model, TPDGMN is compared with traditional models, including AGCRN, DCRNN, ASTGCN, STSGCN, DGCRN, and MTGNN.
[0048] The following seven methods were compared on the PeMSD04 and PeMSD08 datasets. The table below shows the performance metrics of each example.
[0049] Table 1 Comparative Experiment
[0050] Table 1 shows that STSGCN and ASTGCN mainly rely on convolution and attention to model spatiotemporal dependencies on a fixed structure, resulting in significantly lagging performance. This indicates that using only local convolution or static attention is insufficient to fully characterize the complex spatial propagation in traffic networks. In contrast, graph-based models such as AGCRN, DRCNN, DGCRN, and MTGNN significantly improve performance. Among them, AGCRN and MTGNN enhance spatial dependency capture through adaptive graph learning, while DGCRN further considers dynamic graph mechanisms, thus performing stronger on both datasets. However, these methods still have room for improvement in the co-modeling of time-varying structures and long-term dependencies. Building on this, TPDGMN further addresses the aforementioned shortcomings.
[0051] On PeMSD4, TPDGMN achieved an MAE / RMSE of 19.90 / 32.00, which, compared to the baseline method AGCRN (20.17 / 33.93), reduced MAE and RMSE by 1.34% and 5.69%, respectively, indicating that the model, through a dynamic graph learner, can better capture spatial dynamic dependencies. Compared to the strongest baseline, the MAE decreased by 0.95% compared to DGCRN (20.09), and the RMSE decreased by 0.16% compared to MTGNN (32.05), demonstrating that the tree structure regularization term of the model effectively constrains the sparsity and stability of the graph structure, while also exhibiting better overall error control. Similarly, on PeMSD8, TPDGMN's MAE / RMSE was 15.96 / 25.05, which, compared to MTGNN (16.03 / 25.53), decreased by 0.44% and 1.88%, respectively, and the RMSE decreased by 6.53% compared to DGCRN (16.83 / 26.80). These results demonstrate that TPDGMN continues to benefit stably even on larger-scale road networks. Figure 8 The prediction performance of the method of this invention and six comparative methods is shown across 12 horizons. It can be observed that the prediction difficulty increases with the increase of horizon, while TPDGMN maintains a low error level across most prediction step sizes, and the error increases more slowly with the increase of horizon, reflecting that the model more fully characterizes complex spatiotemporal dependencies and is more robust in prediction.
[0052] To verify the contribution of each component module to the overall performance of the invention, further ablation experiments were conducted, as shown in Table 2.
[0053] Table 2 Ablation Experiment
[0054] As shown in Table 2, removing the Mamba module significantly increased the MAE and RMSE on PeMSD4, indicating that the Mamba temporal encoder plays a crucial role in long-range dependency modeling. Specifically, removing the dynamic graph module or tree prior constraints also degraded the model performance, demonstrating that both dynamic graph learning and tree prior regularization constraints can effectively improve the ability to characterize spatiotemporal relationships and structural stability.
[0055] Table 3 shows a comparison of the number of parameters and training time between the present invention and the baseline method. It indicates that the present invention has a lower number of model parameters and a shorter training time while ensuring prediction accuracy, which shows that it has good potential for engineering deployment.
[0056] Table 3 Computational Efficiency
[0057] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A traffic flow prediction method based on a tree-prior dynamic graph Mamba temporal encoder, characterized in that, Includes the following steps: S1: Obtain the traffic network map and historical traffic flow sequences; S2: Construct the TPDGMN model for multi-step traffic flow prediction, specifically including: S21: Perform feature mapping on the historical traffic flow sequence to obtain a node-level latent space representation; S22: The Mamba temporal encoder is used to independently encode each node along the time dimension to obtain a temporal hidden representation; S23: Generate a dynamic graph adjacency matrix based on the historical traffic flow sequence; S24: Construct the tree prior adjacency matrix, and construct the tree prior regularization loss term based on the difference between the dynamic graph adjacency matrix and the tree prior adjacency matrix; S25: Perform spatiotemporal fusion based on the temporal hiding representation and the dynamic graph adjacency matrix, and output multi-step prediction results; S26: Using the prediction loss and the tree prior regularization loss term as a joint training objective, the model is trained end-to-end to obtain the final traffic flow prediction model.
2. The traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder according to claim 1, characterized in that, In step S22, the Mamba time encoder includes multiple residual blocks. Each residual block includes layer normalization, selective state space modeling, gated residual connection, and Dropout operation, which are used to improve long-distance dependency modeling capabilities and reduce serial computation overhead.
3. The traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder according to claim 1, characterized in that, The specific process of generating the dynamic graph adjacency matrix in step S23 includes: By aggregating the historical sequence along the time dimension using the mean, we obtain the historical description vector of each node. The historical description vectors are mapped to the hidden space using a multilayer perceptron, and the similarity scores between nodes are calculated using a scaled inner product. Perform Top-k sparsity on the outer edges of each node, retaining only the k most similar neighbors; The sparsified score matrix is subjected to row-wise Softmax normalization, and combined with Dropout operation to obtain the adjacency matrix of the time-varying dynamic graph.
4. The traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder according to claim 2, characterized in that, The specific process of constructing the tree prior adjacency matrix in step S24 includes: Shortest path completion is performed based on the road distance graph to obtain the complete node distance relationships; The distance matrix is converted into a compressed form, and a cluster merging sequence is generated through hierarchical clustering. In each cluster merging process, the node pair with the smallest distance between the cross-cluster node pairs of the left and right clusters is selected to establish an undirected edge until the clustering is completed, thereby obtaining a symmetric sparse tree-like adjacency matrix, which serves as the tree prior adjacency matrix.
5. The traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder according to claim 3, characterized in that, The tree prior regularization loss term is measured by the Frobenius norm or L1 mean of the difference between the dynamic graph adjacency matrix and the tree prior adjacency matrix, and is used to suppress spurious edges and structural drift in dynamic graph learning.
6. The traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder according to claim 1, characterized in that, The specific process of performing spatiotemporal fusion and outputting multi-step prediction results in step S25 includes: The current node state is represented by the last time node output by the Mamba time encoder. On the adjacency matrix of the dynamic graph, an adaptive vertex-weighted graph convolution based on Chebyshev multinomials is used for spatial propagation, aggregating neighborhood information of different orders to form a spatiotemporal fusion representation; The spatiotemporal fusion representation is mapped into traffic flow prediction results for multiple future time steps in one go by a convolutional prediction head, achieving direct multi-step output.
7. A traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder according to claim 1, characterized in that, The joint training objective in step S26 is represented as follows: L = Lpred + Ltree Where Lpred is the prediction error term and Ltree is the tree prior regularization term.
8. A traffic flow prediction system based on a tree prior dynamic graph Mamba temporal encoder, used to perform the method according to any one of claims 1-7, characterized in that, The system includes: The data acquisition module is used to acquire traffic network maps and historical traffic flow sequences; The feature mapping module is used to perform feature mapping on the historical traffic flow sequence to obtain a node-level latent space representation; The Mamba temporal encoding module is used to independently encode each node along the time dimension to obtain a temporally hidden representation; The dynamic graph learning module is used to generate a dynamic graph adjacency matrix based on the historical traffic flow sequence; The tree prior constraint module is used to construct the tree prior adjacency matrix and construct the tree prior regularization loss term based on the difference between the dynamic graph adjacency matrix and the tree prior adjacency matrix. The spatiotemporal fusion and prediction module is used to perform spatiotemporal fusion based on the temporal hiding representation and the dynamic graph adjacency matrix, and output multi-step prediction results; The training module is used to perform end-to-end training on the model, using the prediction loss and the tree prior regularization loss term as the joint training objective.
9. An application of a traffic flow prediction method based on a tree prior dynamic graph Mamba temporal encoder, wherein the method described in any one of claims 1-7 is applied to traffic management, congestion warning, active guidance, travel service platform or vehicle-road cooperative scenarios.