## 2 Materials and Methods
### Neighbor RSU Discovery
If there is a non-source RSU in the neighbor table of the vehicle, it means that the neighbor RSU is found, the value of mode needs to be modified to 2, and then the NDP packet is sent from the vehicle to the destination RSU, and other vehicles will ignore the NDP packet with the value of mode of 2. Second, when the value of mode is 1, it means that the NDP packet will be forwarded from vehicle to vehicle. The NDP packet will contain the ID of the next hop vehicle, so the backoff algorithm is no longer needed. In this mode, if the ID of the vehicle receiving the NDP packet is the same as \(DST\_CAR\_ID\) in the NDP packet, the vehicle will accept the NDP and then try to forward it, otherwise it will ignore the packet. If the vehicle node receiving the NDP packet finds a non-source RSU in its neighbor table, it means that a neighbor RSU is found, so the mode in the NDP packet is set to 2, indicating that the NDP packet will be forwarded from the vehicle to the RSU node. If the vehicle node does not find the non-source RSU in its neighbor table, the vehicle node farthest from the source RSU on the same street segment needs to be searched in its neighbor table as the next hop vehicle node, and the mode value of this vehicle node is still 1. Through this NDP forwarding method, when approaching the destination RSU, the sender vehicle of the last hop to the destination RSU is not necessarily the closest to the destination RSU, but the destination RSU must be within the signal coverage of the sender vehicle, and the NDP packet successfully reaches the destination RSU. In a word, according to the mode field in the NDP packet, Algorithm 3 can perform fine-grained control on NDP packet forwarding to ensure that the packet can be forwarded to the neighboring RSU node in the presence of an appropriate traffic flow. ### Calculation of Ant Pheromone

The adjacent RSUs at both ends of a street segment send ant packets to each other periodically. The ant packets can reach the RSU at the other end through the greedy forwarding between vehicle nodes, and the pheromone value is calculated according to the delay of the ant packet. We optimize the update of the ant pheromone [6] by adding a decay function over time and arithmetic mean. The pheromone value of the street segment from intersection \(i\) to intersection \(j\) will be updated using the following formula:

\[\mathit{pheo}_{ij}=\frac{\mathit{pheo}_{ij}+\Delta\mathit{pheo}_{ij}}{1+ \Delta\mathit{pheo}_{ij}} \tag{1}\]

where \(\Delta\mathit{pheo}_{ij}\) is

\[\Delta\mathit{pheo}_{ij}=C+\frac{2}{\pi}\arctan(\frac{minDelay_{ij}}{delay_{ ij}}) \tag{2}\]

where \(C\) is a constant less than 0.5. \(delay_{ij}\) and \(minDelay_{ij}\) are the time and minimum time it takes the ant packet to traverse the street segment from intersection \(i\) to intersection \(j\), respectively. To describe the reduction of the ant pheromone over time, i.e., pheromone evaporation, a decay function over time is defined as follows:

Figure 2:0

where \(\alpha\) is the time decay constant ant \(t\) is the delay between RSU receiving two ant packets. Each RSU decreases the ant pheromone of related street segments using the following formula:

Figure 2:1

The RSU is located near each road intersection, so it receives ant packets from different street segments, and calculates the pheromone values for different street segments. Then, the RSU needs to send the pheromone value of each street segment to the SDN server, and for this purpose, the RSU constructs a corresponding message \(mp\) for each street segment, which encapsulates the value of the pheromone, the generation time, and the two-tuple consisting of the sender RSU and receiver RSU. After that, the RSU sends \(mp\) to the SDN server. The SDN server sets a \(mp\) message buffer for each street segment, which can buffer at most \(M\) messages closest to the current time.