A traffic flow prediction method based on graph serialization and bidirectional state space

By employing graph serialization and bidirectional state space methods, the shortcomings of existing graph-structured data processing technologies are addressed, enabling adaptive traffic flow prediction and improving prediction accuracy and speed.

CN122135556APending Publication Date: 2026-06-02TIANJIN POLYTECHNIC UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TIANJIN POLYTECHNIC UNIV
Filing Date
2026-01-14
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing state-space models cannot effectively handle graph-structured data when dealing with traffic flow prediction. Traditional graph unfolding methods lose spatial topological information, resulting in limited prediction accuracy.

Method used

We employ a graph serialization and bidirectional state space-based approach. By generating a differentiable sorting matrix through a graph attention network, we convert graph structure data into serialized features. We then use a bidirectional gated state space model for recursive scanning and combine it with spatial structure reconstruction for prediction.

Benefits of technology

An adaptive graph structure mapping to a sequence structure was achieved, which improved prediction accuracy and reduced computational complexity, significantly improving the speed and accuracy of long sequence prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122135556A_ABST
    Figure CN122135556A_ABST
Patent Text Reader

Abstract

This invention discloses a traffic flow prediction method based on graph serialization and bidirectional state space. First, a spatiotemporal graph of traffic flow is constructed. Topological features of nodes are extracted using a graph attention network, and a double-random permutation matrix reflecting the optimal traversal path is generated through a differentiable relaxation sorting operator, adaptively mapping the two-dimensional graph structure data to one-dimensional serialized features. Then, a bidirectional gated state space model is constructed, and the serialized features are recursively scanned from both the forward and reverse directions using discretized state space parameters, and a hybrid hidden state is obtained through fusion using gated units. Finally, the transpose of the permutation matrix is ​​used to perform an inverse transformation on the hybrid features to restore the spatial structure, and the future traffic flow is output through a prediction head. This invention effectively solves the problem that traditional state space models struggle to handle graph structure data, achieving end-to-end joint optimization of the graph traversal strategy and the prediction model, significantly improving the accuracy and efficiency of long-sequence traffic prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of intelligent transportation systems (ITS) and deep learning data mining technology, and in particular to a traffic flow prediction method based on graph serialization and bidirectional state space. Background Technology

[0002] Accurate traffic flow prediction is fundamental to urban traffic management, congestion mitigation, and route planning. With the development of artificial intelligence technology, deep learning models have become the mainstream method in this field. Existing prediction techniques are mainly divided into two categories: one is based on graph convolutional networks (GCNs), which use adjacency matrices to describe road network topology and are good at extracting spatial features. However, when dealing with long-term series dependencies, their computational complexity and memory usage increase quadratically with the time step, making them difficult to apply to long-term prediction of large-scale road networks. The other is based on recurrent neural networks (RNNs) or Transformers, which are good at processing time series data but cannot directly process graph structure data in non-Euclidean spaces.

[0003] Recently, State Space Models (SSMs), represented by Mamba, have attracted much attention due to their linear computational complexity and excellent long-sequence modeling capabilities. However, the original design of SSM models is only suitable for one-dimensional sequential data. Traffic networks are essentially complex two-dimensional graph structures with intricate physical connections between nodes. Existing techniques for applying SSMs to traffic prediction typically use simple node ID sorting or random walks to unfold the graph into a sequence. This rigid, non-adaptive serialization method disrupts the spatial continuity of the road network, causing SSMs to fail to capture local spatial diffusion patterns within the network. Furthermore, simple fully connected layers cannot dynamically adjust the graph traversal order based on real-time traffic flow conditions, limiting the model's prediction accuracy.

[0004] Therefore, designing a traffic flow prediction method that can adaptively map graph structures to sequence structures end-to-end and combine the advantages of efficient inference in SSM is a technical challenge that urgently needs to be solved in the field of intelligent transportation. Summary of the Invention

[0005] This invention aims to address the technical problems that existing state-space models cannot effectively process graph-structured traffic data and that traditional graph unfolding methods lose spatial topological information. It proposes a traffic flow prediction method based on graph serialization and bidirectional state space.

[0006] This invention adopts the following technical solution: a traffic flow prediction method based on graph serialization and bidirectional state space, comprising the following steps: S1. Construct traffic flow spatiotemporal map data; obtain historical traffic flow data and physical topology of the target road network, and construct input feature tensor and adjacency matrix; S2. Construct a topology-aware differentiable sorting module; extract node topology features using a graph attention network, and generate a double random permutation matrix reflecting the optimal traversal path through a differentiable relaxation sorting operator, converting graph structure data into serialized features; S3. Construct a bidirectional gated state space feature extraction module; using discretized state space parameters, recursively scan the serialized features from both the forward and reverse directions, and obtain the hybrid hidden state by fusing them through a gated unit. S4. Spatial Structure Restoration and Prediction Output: The transpose of the permutation matrix is ​​used to perform an inverse transformation on the mixed hidden state to restore the original spatial arrangement of the road network nodes, and the traffic flow prediction value for the future time step is output through the prediction head. S5. Model training and optimization: Construct the loss function and use the backpropagation algorithm to update the model parameters end-to-end.

[0007] Further, step S1 includes: S11. Data Acquisition and Tensor Construction; Define the road network as a graph structure G = (V, E, A), where A ∈ R. N×N Let N be the adjacency matrix, and N be the number of nodes. The historical time window for data collection is T. in Traffic flow data within the area is used to construct an input feature tensor. In the formula, B is the batch size; T in Where N is the historical time step; C is the number of nodes; and C is the number of feature channels. S12. Data Standardization: Perform Z-Score standardization on the input tensor X to obtain the standardized input X. norm This makes its mean 0 and its standard deviation 1.

[0008] Further, step S2 includes: S21, Feature Mapping and Topological Aggregation; First, standardize the input X... norm The feature is mapped to a high-dimensional hidden feature H through a linear layer. in Using Graph Attention Network (GAT) to process H in For any node i in the road network, its set of neighboring nodes is indexed according to the adjacency matrix A. Calculate the attention coefficient α between node i and its neighbor node j. ij Based on this, neighbor features are aggregated to obtain a node embedding vector h containing local spatial topological information. topo,i The calculation formula is as follows: In the formula, h topo,iLet be the topological feature vector of node i; σ be the nonlinear activation function; Let α be the set of first-order neighbors of node i; ij W represents the normalized attention weights between node i and node j. gat h is a learnable linear transformation matrix. in,j Let be the initial hidden features of node j. S22, Calculate the ranking score; construct a scoring neural network, and embed the embedding vectors H of all nodes. topo Mapped to a one-dimensional ranking score vector S∈R B×N×1 This score vector represents the traversal priority of each node during the serialization process. S23. Generate a soft permutation matrix; process the rating vector S using a differentiable relaxation sorting operator. Calculate the rating s of node i. i The score s′ of the sorted position j j The difference between them is normalized along the rows and columns using the Softmax function to generate a double random permutation matrix P∈R. B×N×N .Matrix element P ij Let represent the probability that node i is placed at the j-th position in the sequence. The formula is as follows: In the formula, P ij s is the element in the i-th row and j-th column of the permutation matrix; i Let s' be the score value of the i-th node; j τ represents the value of the j-th node after sorting all node scores; τ is the temperature coefficient used to control the smoothness of the distribution; N is the total number of nodes. S24. Serialization transformation; perform matrix multiplication to transform the original graph features H. in Transformed into serialized features X arranged in topological logic seq .

[0009] Further, step S3 includes: S31. Parameter Discretization: Based on the continuous-time state-space equations, using the zero-order preserve (ZOH) method, the time-scale parameter Δ and the system matrix A are discretized. ssm and input matrix B ssm Convert to discretization parameters and The formula is as follows: In the formula, This is the discretized state transition matrix; The input control matrix is ​​discretized; Δ is the learnable time step parameter; A ssm B is the state matrix of a continuous system; ssmLet I be the input matrix of the continuous system; I is the identity matrix. S32, Forward Scan Channel; Serialization Feature X seq Input a forward Mamba block. Based on the discretized state equations, recursively scan along the generated sequence direction, and output the forward hidden state feature Y. fwd The recursive equation is: In the formula, h t h is the hidden state at time step t; t-1 x is the hidden state of the previous time step; t This is the input for the current time step. S33, Reverse Scan Channel; for serialization feature X seq Perform a spatial dimension flipping operation to obtain X. flip The input is a reversed Mamba block. A recursive scan is performed in the opposite direction of the sequence, and the output is the reversed hidden state feature Y. flip_out Then flip it back to the forward order to get Y. bwd . S34, Gated fusion; The positive hidden state feature Y... fwd With the reverse hidden state feature Y bwd The features are concatenated and then adaptively weighted and fused using gated linear units (GLUs) to obtain the hybrid features H. mix .

[0010] Further, step S4 includes: S41, Inverse spatial transformation; using the transpose matrix P of the permutation matrix generated in step S2. T For mixed features H mix Perform a left multiplication operation, i.e., H restored =P T ×H mix This restores the feature space to the original arrangement of road network nodes. S42, Predict the output; convert the restored feature H... restored The input consists of a prediction head with two 1×1 convolutional layers and a ReLU activation function, which is used to map and obtain the predicted traffic flow values ​​for the entire road network at future time steps.

[0011] Further, step S5 includes: S51. Construct the loss function; use the mean absolute error (MAE) as the loss function: In the formula, L is the loss value; B is the batch size; and N is the total number of samples. This represents the actual traffic value of the i-th node in the b-th sample. Let be the predicted flow value of the i-th node in the b-th sample. S52, Parameter Update: Using the Adam optimizer, the parameters of the GAT layer, scoring network, state-space model, and prediction head are updated simultaneously based on the backpropagation algorithm.

[0012] Compared with existing technologies, the advantages of this invention are as follows: This invention achieves efficient coupling between graph structures and linear complex models by designing a composite architecture of "GAT + differentiable ordering". This method utilizes a differentiable permutation matrix, enabling the model to adaptively learn the optimal graph traversal order based on real-time traffic conditions, thus solving the problem of traditional hard ordering destroying spatial topology. Simultaneously, the bidirectional state space design embeds the "convection" and "backtracking" physical mechanisms of traffic flow, significantly improving prediction accuracy in complex flow fields. Experimental results show that this method improves inference speed by 5 times compared to Transformer in long sequence prediction tasks, while reducing prediction error by 15%. Attached Figure Description

[0013] Since the text-based patent specification cannot directly include drawings, only a brief description of the drawings is provided here: Figure 1 This is a complete flowchart of the implementation of the present invention. Figure 2 This is a schematic diagram of the overall system architecture of the present invention. Figure 3 The schematic diagram of the topology-aware differentiable sorting module proposed in this invention (corresponding to step S2) is shown. Figure 4 This is a schematic diagram of the overall architecture of the bidirectional gated state space model proposed in this invention (corresponding to step S3). Figure 5 This is a flowchart of the spatial reconstruction and prediction output of the present invention (corresponding to step S4). Detailed Implementation

[0014] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0015] In this embodiment of the invention, the hardware operating environment specifically refers to a computing workstation equipped with an NVIDIA GeForce RTX 3090 GPU. The deep learning programming framework specifically refers to PyTorch version 1.12.0. The experimental data specifically refers to the PeMS08 public traffic dataset, which contains 170 sensor nodes with a time granularity of 5 minutes.

[0016] This invention provides a traffic flow prediction method based on graph serialization and bidirectional state space. For example... Figure 1 and Figure 2As shown, the method of this invention has an end-to-end pipeline structure, mainly comprising three core subsystems: a graph serialization subsystem, a state-space feature extraction subsystem, and a spatial reconstruction prediction subsystem. The original traffic flow data first enters the graph serialization subsystem, which uses a graph attention network to capture road network topological features and generates a differentiable "soft permutation matrix" based on these features. This matrix dynamically maps the graph node data, originally in non-Euclidean space, into one-dimensional sequence data, thus solving the problem that traditional graph models are difficult to adapt to efficient sequence models. Subsequently, the serialized data enters the state-space feature extraction subsystem, which uses a bidirectional gated state-space model based on the Mamba architecture to scan the sequence from both forward and reverse dimensions, capturing the long-distance dependencies of traffic flow in time and space. Finally, the extracted deep features enter the spatial reconstruction prediction subsystem, which uses the inverse transformation of the permutation matrix to remap the features back to the original road network spatial location, ensuring that the output results have clear geophysical meaning, and generates future traffic flow prediction values ​​through a convolutional prediction head. The implementation process of this method is described in detail below with specific steps.

[0017] S1. Constructing traffic flow spatiotemporal map data S11, Data Acquisition and Tensor Construction Extract flow readings from PeMS08 raw data and define the historical observation window length T. in =12 (i.e., the past hour), prediction step size T out =1 (i.e., the next 5 minutes). Construct the input feature tensor based on this. In this embodiment, the batch size B is set to 64, and the time step T is set to... in =12, number of nodes N=170, characteristic channel C=1 (containing only flow value, i.e. speed or flow reading). Subsequently, the adjacency matrix A∈R is constructed. N×N Calculate the Euclidean distance d between nodes. ij If d ij If the value is less than the threshold (set to 1000 meters in this example), then A ij =1, otherwise A ij =0, which is used to characterize the physical proximity of sensor nodes in the road network.

[0018] S12, Data Standardization Standardize all input data to eliminate the influence of data units and accelerate model convergence. Calculate the mean μ and standard deviation σ of the training set data, and obtain the standardized data X using the following formula. norm : In the formula, x represents the original data, X normThe dimensions remain (64, 12, 170, 1). This normalization process ensures the consistency of the input data distribution.

[0019] S2. Construct a topology-aware differentiable sorting module S21, Feature Mapping and Topology Aggregation Standardize input X norm Mapped to the hidden dimension D through a fully connected linear layer. model =64, thus obtaining the initial feature H in ∈R 64×12×170×64 The single-head graph attention network (GAT) is used to aggregate neighbor features. For node i and neighbor j, the unnormalized attention score e is calculated. ij The formula is as follows: e ij =LeakyReLU(a T [W gat h in,i ||W gat h in,j ]) In the formula, a is the attention parameter vector, and W gat Let || be the linear transformation matrix, and || denote vector concatenation. Then, the normalized attention coefficient α is calculated. ij : Finally, the topological features H are obtained through aggregation. topo The calculation formula is as follows: The obtained feature H topo The dimensions are (64, 12, 170, 64), which incorporates local topological information.

[0020] S22, Ranking and Scoring Calculation H topo H is obtained by averaging over the time dimension. avg Input fully connected layer W score The score vector S∈R is obtained. 64 ×170×1 The rating vector S represents the traversal priority of each node in the subsequent serialization process; the higher the rating, the earlier the node appears in the sequence.

[0021] S23. Generate the soft permutation matrix The rating vector S is processed using a differentiable relaxation sorting operator. A temperature coefficient τ = 0.1 is set, and all elements of the rating vector S are sorted. The rating value of the j-th element is taken as s′. j Calculate the doubly random permutation matrix P, and its matrix elements P ijThis represents the probability that the i-th physical node is mapped to the j-th position in the sequence. The formula is as follows: In the formula, P ij s is the element in the i-th row and j-th column of the permutation matrix; i s′ represents the original score value of the i-th node. j Let be the value of the j-th node after sorting all node scores; τ be the temperature coefficient; and N be the total number of nodes. This matrix has a doubly random property, and by controlling τ to approach 0, it can be approximated as a hard permutation matrix.

[0022] S24, Serialization Transformation Perform matrix multiplication X seq =P×H in Specifically, the permutation matrix P generated in step S23 is compared with the initial feature H. in Perform matrix multiplication. Through this operation, the original graph features H... in Converted into serialized features X arranged in topological logic seq At this moment, X seq The node dimensions have been rearranged according to the optimal path learned by the model, realizing an adaptive mapping from a two-dimensional graph structure to a one-dimensional sequence structure, providing a spatially continuous sequence input for subsequent SSM models.

[0023] S3. Construct a bidirectional gating state space feature extraction module This step employs the Selective State-Space Model (Mamba) as the core feature extractor. Traditional Recurrent Neural Networks (RNNs) are difficult to train in parallel, while Transformers have excessively high computational complexity on long sequences. Mamba, based on the State-Space Model (SSM) in modern control theory, introduces the Zero-Order Hold (ZOH) technique to discretize the continuous-time dynamic system into a recursive form suitable for digital computer processing. Simultaneously, it achieves linear-complexity inference through a hardware-aware Parallel Scan algorithm.

[0024] S31, Parameter Discretization Define the state dimension D state =16, expansion factor E=2. Based on the state matrix A of a continuous system. ssm and input matrix B ssm And the learnable time step parameter Δ, the discretization parameters are calculated using the zero-order hold (ZOH) principle: These discretization parameters and This will be used for subsequent recursive calculations, ensuring that the discrete system can accurately approximate the dynamic characteristics of the continuous system.

[0025] S32, Forward Scan Channel Serialization feature X seq The input is fed into a forward Mamba channel. A linear layer projects the input into input x and a gated z. After performing a one-dimensional convolution and SiLU activation on x, a discretized state update (SSM Scan) is performed. y t =C ssm h t In the formula, h t y is the hidden state at the current moment. t The output is then fused with the gated z to obtain the positive feature Y. fwd ∈R 64×12×170×64 This process simulates the forward propagation of traffic flow along the learned path.

[0026] S33, Reverse Scan Channel For X seq Perform a flip operation X at the node level. flip =Flip(X) seq (dim=2), and its input structure is exactly the same as that of the forward channel, forming a reverse Mamba channel. The reverse channel also includes the above parameter discretization and state update process. The output Y is obtained. flip_out Then, it is flipped back to its original order to obtain the reverse feature Y. bwd This process captures the reverse dependency or backtracking effect of traffic flows.

[0027] S34, Gating Fusion Calculate the fusion feature H mix The formula is as follows: H mix =(Y fwd +Y bwd )⊙Sigmoid(W gate (Y fwd ||Y bwd )) In the formula, W gate For a gated linear layer, ⊙ represents element-wise multiplication. The fused features H mix With dimensions of (64, 12, 170, 64), this feature contains both positive and negative spatial dependency information.

[0028] S4. Spatial Structure Reconstruction and Prediction Output S41, Inverse Spatial Transformation Using the permutation matrix P generated in step S2, calculate its transpose P. T Since P is approximately an orthogonal matrix, its transpose is its inverse matrix. Perform the inverse transformation: H restored =P T ×H mix This operation uses matrix multiplication to restore the spatial order of features from the "sorted sequence order" to the "original node ID order", ensuring that each node feature in the output is strictly aligned with the physical location of the node in the real label.

[0029] S42, Predicted Output Extract H restored The data H at the last time step last This is then input into a prediction head consisting of two 1×1 convolutional layers. The calculation formula is: Final output predicted value This refers to the predicted traffic flow across the entire road network at a future time step.

[0030] S5, Model Training and Optimization S51. Constructing the loss function Training hyperparameters: 100 training epochs, batch size 64, learning rate 1×10⁻⁶. -3 This embodiment uses the mean absolute error (MAE) to measure the difference between the predicted value and the actual value. The calculation formula is as follows: In the formula, L is the loss value; B is the batch size (64 in this embodiment); N is the total number of nodes (170 in this embodiment); This represents the actual traffic value of the i-th node in the b-th sample. This corresponds to the predicted flow rate.

[0031] S52, Parameter Update All parameters are updated using the AdamW optimizer. Since the Softmax operation of the sorting module, the exponential operation of parameter discretization, and the SSM scanning process in this invention are all composed of differentiable operators, the gradient can propagate unimpeded from the prediction head back to the frontmost feature embedding layer, thereby achieving end-to-end joint optimization of the "graph traversal strategy" and the "traffic prediction model". In this way, the model can automatically learn the road network serialization method that is most conducive to reducing prediction errors.

[0032] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Therefore, any modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A traffic flow prediction method based on graph serialization and bidirectional state space, characterized in that, Includes the following steps: S1. Construct traffic flow spatiotemporal map data; obtain historical traffic flow data and physical topology of the target road network, and construct input feature tensor and adjacency matrix; S2. Construct a topology-aware differentiable sorting module; extract node topology features using a graph attention network, and generate a double random permutation matrix reflecting the optimal traversal path through a differentiable relaxation sorting operator, converting graph structure data into serialized features; S3. Construct a bidirectional gating state space feature extraction module; Using discretized state space parameters, the serialized features are recursively scanned from both the forward and reverse directions, and the hybrid hidden states are obtained by fusing them through gated units. S4. Spatial Structure Restoration and Prediction Output: The transpose of the permutation matrix is ​​used to perform an inverse transformation on the mixed hidden state to restore the original spatial arrangement of the road network nodes, and the traffic flow prediction value for the future time step is output through the prediction head. S5. Model training and optimization: Construct the loss function and use the backpropagation algorithm to update the model parameters end-to-end.

2. The traffic flow prediction method based on graph serialization and bidirectional state space according to claim 1, characterized in that, Step S1 includes: S11. Data Acquisition and Tensor Construction; Define the road network as a graph structure G = (V, E, A), where A ∈ R. N×N Let N be the adjacency matrix, and N be the number of nodes; the historical time window for data collection is T. in Traffic flow data within the area is used to construct an input feature tensor. In the formula, B is the batch size, and T is the batch size. in Where N is the historical time step, C is the number of nodes, and C is the number of feature channels. S12. Data Standardization: Perform Z-Score standardization on the input tensor X to obtain the standardized input X. norm This makes its mean 0 and its standard deviation 1.

3. The traffic flow prediction method based on graph serialization and bidirectional state space according to claim 1, characterized in that, Step S2 includes: S21, Feature Mapping and Topological Aggregation; First, standardize the input X... norm The feature is mapped to a high-dimensional hidden feature H through a linear layer. in Using graph attention networks to process H in For any node i in the road network, its set of neighboring nodes is indexed according to the adjacency matrix A. Calculate the attention coefficient α between node i and its neighbor node j. ij Based on this, neighbor features are aggregated to obtain a node embedding vector h containing local spatial topological information. topo,i The calculation formula is as follows: In the formula, h topo,i Let be the topological feature vector of node i, and σ be the nonlinear activation function. Let α be the set of first-order neighbors of node i. ij W represents the normalized attention weights between node i and node j. gat h is a learnable linear transformation matrix. in,j Let be the initial hidden features of node j; S22, Calculate the ranking score; construct a scoring neural network, and embed the embedding vectors H of all nodes. topo Mapped to a one-dimensional ranking score vector S∈R B×N×1 This scoring vector represents the traversal priority of each node during the serialization process; S23. Generate a soft permutation matrix; process the rating vector S using a differentiable relaxation sorting operator, and calculate the rating s of node i. i The score s′ of the sorted position j j The difference between them is normalized along the rows and columns using the Softmax function to generate a double random permutation matrix P∈R. B×N×N Matrix element P ij Let represent the probability that node i is placed at the j-th position in the sequence, as shown in the following formula: In the formula, P ij Let s be the element in the i-th row and j-th column of the permutation matrix. i Let s' be the score value of the i-th node. j The value of the j-th node after sorting all node scores is τ, where τ is the temperature coefficient and N is the total number of nodes. S24. Serialization transformation; perform matrix multiplication X. seq =P×H in The original image features H in Transformed into serialized features X arranged in topological logic seq .

4. The traffic flow prediction method based on graph serialization and bidirectional state space according to claim 1, characterized in that, The process of utilizing discretized state-space parameters in step S3 includes: S31. Parameter Discretization: Based on the continuous-time state-space equations, using the zero-order preservation method, the time-scale parameter Δ and the system matrix A are discretized. ssm and input matrix B ssm Convert to discretization parameters and The formula is as follows: In the formula, This is the discretized state transition matrix. Here, A is the discretized input control matrix, Δ is the learnable time step parameter, and A is the input control matrix. ssm Let B be the state matrix of a continuous system. ssm Let I be the input matrix of the continuous system, and let I be the identity matrix.

5. The traffic flow prediction method based on graph serialization and bidirectional state space according to claim 1, characterized in that, The recursive scanning and fusion process of the serialized features in step S3 includes: S32, Forward Scan Channel; Serialization Feature X seq Input a forward Mamba block, recursively scan along the generated sequence direction according to the discretized state equation, and output the forward hidden state feature Y. fwd The recursive equation is: In the formula, h t h is the hidden state at time step t. t-1 x is the hidden state of the previous time step. t Input for the current time step; S33, Reverse Scan Channel; for serialization feature X seq Perform a spatial dimension flipping operation to obtain X. flip Take a reversed Mamba block as input, recursively scan in the opposite direction of the sequence, and output the reversed hidden state feature Y. flip_out Then flip it back to the forward order to get Y. bwd ; S34, Gated fusion; The positive hidden state feature Y fwd With the reverse hidden state feature Y bwd The features are concatenated and then adaptively weighted and fused using gated linear units to obtain the hybrid feature H. mix The formula is as follows: H mix =(Y fwd +Y bwd )⊙Sigmoid(W gate (Y fwd ||Y bwd )) In the formula, W gate is a gated linear layer, and ⊙ represents element-wise multiplication.

6. The traffic flow prediction method based on graph serialization and bidirectional state space according to claim 1, characterized in that, Step S4 includes: S41, Inverse spatial transformation; using the transpose matrix P of the permutation matrix generated in step S2. T For mixed features H mix Perform a left multiplication operation, i.e., H restored =P T ×H mix This restores the feature space to the original arrangement order of road network nodes; S42, Predict the output; convert the restored feature H... restored The input consists of a prediction head with two 1×1 convolutional layers and a ReLU activation function, which is used to map and obtain the predicted traffic flow values ​​for the entire road network at future time steps. The calculation formula is:

7. The traffic flow prediction method based on graph serialization and bidirectional state space according to claim 1, characterized in that, Step S5 includes: S51. Construct the loss function; use the mean absolute error as the loss function: In the formula, L is the loss value, B is the batch size, and N is the total number of samples. This represents the actual traffic value of the i-th node in the b-th sample. Let be the predicted flow value of the i-th node in the b-th sample; S52, Parameter Update: Using the Adam optimizer, the parameters of the GAT layer, scoring network, state space model, and prediction head are updated simultaneously based on the backpropagation algorithm.