### Problem Background and Motivations  
In a network environment dominated by vehicles with relatively fixed trajectories, such as buses, how to use trajectory information to make routing decisions is a problem that needs to be considered. According to our observations, the shortcomings of the above related research are: (i) Intergrid routing does not consider the overall direction of the vehicles' movement between grids to select the best neighbor grid, and does not use the corresponding Q-tables for different time periods. (ii) Intragrid routing does not focus on how to analyze the vehicles' actual trajectories for selecting the best neighbor node in grids to forward packets to. Therefore, grid-based packet transmission needs to refer to the following three directionalities:  
1. Grid directionality and source-to-destination directionality for intergrid routing: By analyzing vehicle trajectories in the overall network environment, we define the number of outgoing vehicles from the current grid to the adjacent grid as the _grid directionality_ of this adjacent grid in this paper. We believe that the grid directionality has an important impact on increasing the successful transmission rate and reducing the delay of the packet delivery. If you select a neighbor grid that is more in line with the vehicle's driving direction, i.e., the grid with higher grid directionality, as the next-hop grid to forward the packet to, the packet has a higher probability of reaching the destination. In addition, the direction from the source node to the destination node, i.e., the source-to-destination directionality in this paper, also guides the best selection of the next-hop neighbor grid. If Q-learning selects a neighbor grid that has the higher grid and the source-to-destination directionalities, this grid will obtain a higher reward and Q-value, which are used as the decision basis of the intergrid routing. As shown in Figure 1, the starting position of the packet is at \(Grid_{D}\), and it will be sent to the destination at \(Grid_{C}\). Because the Q-value of \(Grid_{E}\) is the highest one among all neighbor grids of \(Grid_{D}\), the intergrid routing for \(Grid_{D}\) selects \(Grid_{E}\) as the best next-hop grid. This means that the intergrid routing can use the grid directionality to train the Q-model and select the most plausible neighbor grid to forward the packets to. 2. Two-hop directionality for intragrid routing: By analyzing the historical vehicle trajectories to determine the grid directionality of each grid, we can select the neighbor vehicle whose future driving trajectory goes to the best next-hop grid selected by the intergrid routing. However, there may be more than one possible neighbor vehicle that meets the above conditions; thus, how to make an appropriate choice is the important issue to address. As shown in Figure 2, vehicle node \(v_{a}\) located in \(Grid_{A}\) has two neighbor nodes, \(v_{b}\) and \(v_{c}\), located in the best next-hop grid \(Grid_{C}\). Which of the two is the best relay node? If a neighbor node whose future driving trajectory moves to the best next-hop grid first, and then, to the best neighbor grid next, which is called the best two-hop next grid in this article, this node will be a better relay node than any node whose trajectory does not follow this two-hop path. This is because this relay node would have a higher probability to meet the destination node than others, even though it does not meet any neighbor node on this two-hop path to forward the packet to, but has to carry the packet by itself to the destination using SCF. Hence, this paper proposes two-hop trajectory-based routing (THTR) as follows. THTR first performs the intergrid routing on the best next-hop grid, i.e., \(Grid_{C}\), of \(Grid_{A}\) to select the next best neighbor grid, i.e., \(Grid_{E}\). It then analyzes the historical trajectories of \(v_{b}\) and \(v_{c}\) located in the best next-hop grid, \(Grid_{C}\), to find their future positions.