## 3 Materials and Methods
### Vehicle Behavior Prediction
#### 3.3.1 DMR-GCN  
Multi-relational graph convolutional networks (MR-GCNs) are a typical means of modeling interactions in knowledge graphs and spatio-temporal data. However, traditional MR-GCN frameworks use a fixed weight matrix for different relationship types, which limits adaptability to dynamic environments. A dynamic multi-relational graph convolutional network (DMR-GCN) was designed to address this. The core components of this network include an adaptive neighbor matrix updating mechanism and a multi-relationship feature fusion mechanism. These mechanisms allow for more flexible dynamic relationship capture and comprehensive multi-relationship feature processing, enhancing the network's adaptability to real-time data. The specific steps are as follows:  
Adaptive Neighborhood Matrix Update Mechanism:  
Node Feature Conversion  
First, the node features \(h_{G}^{k-1}\) of the \((k-1)\) th layer are converted into a query vector \(Q\) and a key vector \(K\) using the query weight matrix \(W_{q}\) and the key weight matrix \(W_{k}\), respectively:  
\[Q=h_{G}^{k-1}W_{q},K=h_{G}^{k-1}W_{k} \tag{12}\]  
where \(W_{q}\), \(W_{k}\in\mathbb{R}^{d\times d}\). Similarity calculation  
Next, the similarity between the nodes is calculated using the dot product, which is then scaled to prevent tremendous values:  
Figure 5: DMR-GCN structure. \[Similarity_{ij}=\frac{Q_{i}\cdot K_{j}^{T}}{\sqrt{d_{k}}} \tag{13}\]  
where \(d_{k}\) is the dimension of the key vector. (3) Weight normalization  
Attention weights are obtained by normalizing the similarity using the following function:  
\[\alpha_{ij}=softmax\left(\frac{Q_{i}\cdot K_{j}^{T}}{\sqrt{d_{k}}}\right)=\frac {exp\left(\frac{Q_{i}\cdot K_{j}^{T}}{\sqrt{d_{k}}}\right)}{\sum_{j=1}^{n}exp \left(\frac{Q_{i}\cdot K_{j}^{T}}{\sqrt{d_{k}}}\right)} \tag{14}\]  
(4) Dynamic neighborhood matrix update  
Using the attention weights \(\alpha_{ij}\), we thus update the adjacency matrix of the relationship \(r\):  
\[\hat{A}_{r}[i,j]=\alpha_{ij} \tag{15}\]  
(2) Multi-Relational Feature Fusion Mechanisms  
A multi-relational feature fusion mechanism was designed to synthesize features from different relationships. This mechanism enhances the model's ability to capture richer interaction information by introducing adjacency matrices for multiple relationship types. Specifically, adjacency matrices are separately constructed for each relationship type, and these matrices are used to perform weighted fusion among the different relationship features, generating a comprehensive feature representation. This approach more accurately reflects the multiple interactions between nodes and improves the model's expressiveness and predictive performance in complex scenarios. (1) Multi-relational graph convolution  
A multi-relationship graph convolution operation is performed on the updated adjacency matrix \(\hat{A}_{r}\). For relationship \(r\), the node feature representation \(h_{G}^{k}\) at the \(k\) th layer is computed using the following equation:  
\[h_{G}^{k}=ReLU\Big{(}\sum_{r\in R}\hat{A}_{r}h_{G}^{k-1}W_{r}^{k}+h_{G}^{k-1}W _{s}^{k}\Big{)} \tag{16}\]  
where \(\hat{A}_{r}\) is the adjacency matrix of relationship \(r\) dynamically updated through the attention mechanism, \(W_{r}^{k}\) is the weight matrix of the \(k\) th layer associated with relationship \(r\), \(W_{s}^{k}\) is the weight matrix of the \(k\) th layer for calculating the node information (self-loop), and \(ReLU\) is the activation function. (3) Feature Fusion  
The results of the convolution for all relationships are weighted and fused to combine the effects of the different relationships:  
\[h_{G}^{k}=ReLU\Big{(}\sum_{r\in R}\beta_{r},\hat{A}_{r}h_{G}^{k-1}W_{r}^{k}+h_ {G}^{k-1}W_{s}^{k}\Big{)} \tag{17}\]  
where \(\beta_{r}\) is the fusion weight of relationship \(r\), which is learned through training dynamics. (4) Representation of Interlayer Stacking and Multi-Hop Relationships  
The multi-hop relational representation of a node can be obtained by stacking multiple layers of MR-GCNs.