# MTGNet: Multi-Agent End-to-End Motion Trajectory Prediction with Multimodal Panoramic Dynamic Graph
## 3 Methodology
### Global Interaction Encoder  
As shown in Figure 4, the Global Interaction Encoder uses GCN to extract the denoised features and construct a fully connected dynamic traffic map for panoramic agents. We adopt an agent-centric approach to construct traffic scenarios. To avoid resource waste and enhance computational efficiency, we introduce a strategy to dynamically divide the size of traffic scenarios. This strategy enables the dynamic adjustment of the graph's scale and connection mode based on the number of agents at different times or in various scenarios, thereby reducing unnecessary computational overhead. We treat each extracted agent as a node and employ the GCN-based Global Interaction Encoder module to reconstruct the edges between different agents. Initially, we construct a fully connected subgraph for each node, and then progressively connect these subgraphs to form a complete traffic trajectory graph. Our goal is to build a fully connected graph based on a predefined connection sequence. This process not only efficiently utilizes computational resources but also ensures comprehensive modeling of the interactions between each node in the traffic scenario. In the Global Interaction Encoder, we use the Dynamic Graph Builder to regard agents as node entities and extract their feature vectors (such as position, motion state, interaction attributes, etc.) as the attributes of the nodes. Specifically, for the traffic graph \(G^{t}\) at time step \(t\):  
\[G^{t}=\left(V^{t},E^{t}\right) \tag{8}\]  
\[V^{t}=\left(v^{t}_{1},v^{t}_{2},\ldots,v^{t}_{N}\right) \tag{9}\]  
Here, \(V^{t}\) represents the set of nodes, and each node represents a traffic participant. \(N\) represents the number of nodes in the graph at time step \(t\). \(E^{t}\) represents the set of edges, which is used to characterize the interaction between nodes. We rely on the attention mechanism to determine these interactions, which enables us to more accurately capture the complex and changeable interaction situations among traffic participants. After completing the construction of the above graph structure, in order to describe the relationships between nodes and the features of edges in the graph in more detail, we further construct edge attributes for each edge in the established fully-connected traffic graph. These edge attributes can represent the relationships between nodes or the features of edges in the graph. We use the scaled dot-product attention to dynamically calculate the edge weights \(e^{t}_{i,j}\):  
\[e^{t}_{i,j}=\frac{c^{t}_{i}c^{t}_{j}}{\sqrt{d}}*\exp\left(-\frac{dist(i,j)}{50}\right) \tag{10}\]  
Here, \(\sqrt{d}\) represents the scaling factor and \(d\) is the dimension of the feature vector, which prevents problems such as gradient explosion in the subsequent calculation process. \(\exp\left(-\frac{dist(i,j)}{L}\right)\) represents the spatial decay term. \(dist(i,j)\) represents the physical distance between the traffic participants represented by node \(i\) and node \(j\). \(c^{t}_{i}c^{t}_{j}\) represents the dot-product operation of the feature vectors of node \(i\) and node \(j\). Figure 4: (**a**) Structure of Global Interaction Encoder; (**b**) structure of CGConv module. The symbol \"*\" represents the multiplication operation. For the feature vector of node \(i\) at time step \(t\):  
\[c_{i}^{t}=\left[x_{i}^{t},y_{i}^{t},v_{i}^{t},a_{i}^{t},\theta_{i}^{t},lane_{i}^ {t}\right] \tag{11}\]  
Here, \(x_{i}^{t}\) and \(y_{i}^{t}\) represents the coordinate of node \(i\) at time step \(t\). \(v_{i}^{t}\) and \(a_{i}^{t}\) represent the velocity and acceleration of node \(i\) at time step t, respectively. \(\theta_{i}^{t}\) represents the heading angle. \(lane_{i}^{t}\) represents the lane ID. In this way, the edge features can express the displacement and relative motion between agents, providing effective inputs for the feature extraction of the graph neural network.