In this section, we introduce our proposed routing protocol LSGR. Firstly, we describe the method utilized to measure the link state in VANETs. Then, the EOA metric is introduced, and finally the LSGR algorithm is presented in detail.
3.1 Computing ETX in VANETs
First, we briefly introduce the calculation method presented in[22]. In IEEE 802.11, a packet is considered to be successfully transmitted after the sender receives the acknowledgment packet from the receiver. Therefore, the calculation of ETX takes the asymmetric loss rates into account. The case of the link between the nodes X and Y is shown in Figure2. Suppose d_{
f
} is the forward packet delivery probability from X to Y, d_{
r
} is the reverse packet delivery probability from Y to X. The ETX of the link is obtained by
\text{ETX}=\frac{1}{{d}_{\text{f}}\xb7{d}_{\text{r}}}.
(1)
The delivery probability d_{
f
} and d_{
r
} are measured using dedicated link probe packets, which are broadcasted at an average period τ. A window lasting w seconds is used to measure the delivery probability. Every node remembers the number of probes it has received during the last w seconds, allowing it to calculate the delivery probability from the sender at any time t as
r\left(t\right)=\frac{\text{count}(tw,t)}{w/\tau},
(2)
count(tw,t) is the number of probes that the node has received at time t during the window w, and w/ τ is the number of probes that should have been received. For a link shown in Figure2, node X can only calculate d_{
r
} and Y can only calculate d_{
f
}. In order to allow every node to measure the ETX of a link, each probe sent by a node contains the number of probe packets it has received from each of its neighbors during the last w seconds.
As can be seen from the description, ETX does not specifically account for mobility. In the calculation of ETX, w/τ is the number of probes that should have been received during the window w; however, in highly mobile networks, the probability should be calculated after the node enters into the transmission range of its neighboring node. Suppose that node X enters into the transmission range of node Y at time t_{0}. Then Y needs to measure the packet delivery rate from X to Y at time t (tt_{0} < w). The result obtained by Equation 2 is wrong because of the inappropriate probe count that should be received. Assume that the broadcast interval of the probes is 1 s, the length of the window w is 10 s, and tt_{0} = 6 s. During this time, the total number of probes that Y received from X is 5. The packet delivery rate from X to Y is 5/6 = 83.33%. However, the result from Equation 2 is 5/10 = 50%.
Therefore, we adjust the calculation of ETX to adapt to the networks that are highly dynamic. Note that Hello packets are periodically broadcasted to record the information of neighbors in several geographic routing protocols. We use the Hello packets instead of dedicate probe packets to measure the packet delivery probability in LSGR. Traditionally, each node maintains a neighbor table that records the position information of every neighbor. To calculate the ETX of a link, the neighbor table should record the time (t_{0}) when the first Hello packet is received from a neighbor and the number of Hello packets it has received from the neighbor during the last w seconds. The entry of a node in the neighbor table is shown in Figure3. According to the window w and the interval between t_{0} and the current time t, the calculation formula is
r\left(t\right)=\left\{\begin{array}{ll}\frac{\text{count}(tw,t)}{w/\tau},& \phantom{\rule{.5em}{0ex}}t{t}_{0}\ge w;\\ \text{count}(t{t}_{0}),& \phantom{\rule{.5em}{0ex}}0<t{t}_{0}<1;\\ \frac{\text{count}(tw,t)}{(t{t}_{0})/\tau},& \phantom{\rule{.5em}{0ex}}1\le t{t}_{0}<w.\end{array}\right.
(3)
As can be seen from the formula, there are three situations in terms of the difference between window w and tt_{0}. 1) tt_{0} ≥ w, in this situation, the calculation is the same as Equation 2. 2) 0 < tt_{0} < 1, the time difference between the current time and t_{0} is less than 1 s. In this case, the packet delivery rate is the number of Hello packets received from t_{0} to t. Note that the probability is certainly equal to 1. If count(t_{0},t) is divided by tt_{0}, the result would be a very large number. 3) 1 ≤ tt_{0} < w, the packet delivery probability in this condition is the number of the Hello packets received from t_{0} to t divided by the number of Hello packets should have been received during this period.
Note that in the Hello scheme, the entry of a neighbor will be deleted from the neighbor table if the node has not received a Hello packet from the neighbor for a period of time. We set this time to be twice the broadcast interval. Then, the minimum packet delivery probability of a link is 1/3 = 33.33%. Accordingly, the maximum ETX of a link would be 1/(0.33 × 0.33) = 9.18. The distribution of ETX value of the link is correlated with the parameters that are set in the Hello scheme.
3.2 Routing based on link state
In LSGR, the next hop is selected using an enhanced greedy forwarding, which performs according to the EOA routing metric. The EOA value indicates the expected advance that a packet can make towards the destination through one transmission. Instead of choosing the neighbor that is geographically closest to the destination, the enhanced greedy forwarding chooses the neighbor with the largest EOA. When a node S has a packet to forward, it calculates the geographic advance each neighbor can make and the expected number of data transmissions require to successfully send a packet over the link formed by S and the neighbor. Then, the EOA of neighbor i is obtained by
{\text{EOA}}_{i}=\frac{{D}_{\text{ns}}{D}_{\text{ni}}}{{\text{ETX}}_{i}},
(4)
where D_{ns} is the distance from the forwarding node to the destination node. D_{ni} is the distance between the neighbor i and the destination node. ETX_{
i
} is the ETX of the link that is formed by the forwarding node and the neighbor i. D_{ns}D_{ni} indicates the geographic distance a packet can advance towards the destination. However, due to the link loss, to be successfully forwarded over that link, a packet needs to be transmitted ETX_{
i
} times on average. Hence, a neighbor’s EOA demonstrates the expected advance that a packet can make towards the destination through one transmission if it chooses the neighbor as the next hop.
EOA metric incorporates the geographic distance and the link quality. It is a tradeoff between the advance and transmission reliability. It tends to minimize the bandwidth use and increase the network throughput by taking the link state into account. With less transmission times, EOA can also reduce the endtoend delay.
3.3 Routing on junctions
Routing in VANETs, especially in city scenarios, usually separates the streets from junctions. In LSGR, the enhanced greedy forwarding is adapted to route packet in streets. On junctions, LSGR incorporates the distance and the network connectivity to choose the next street. The network connectivity of a street is reflected by the vehicle density in the street. A distributed algorithm has been proposed in our previous work[18] to collect the vehicle density of a certain street. In LSGR, we use the algorithm to get the vehicle density of the streets. With the algorithm, the following parameters of a street can be obtained:
N_{avg} is the average number of vehicles of a unit scope. The unit scope is defined as a road segment whose length is equal to the transmission range of a node, as shown in Figure4, in which the value of N_{avg} is 11/3 = 3.67.
N_{min} is the minimum number of vehicles among the unit scopes in a certain street. In the street shown in Figure4, the value of N_{min} is 2.
These parameters are obtained with the help of Network Information Collection Packet (NICP) in three steps: 1. When a vehicle is at the junction, a NICP is generated with the number of its neighbors as N_{sum} and N_{min}. 2. The NICP is forwarded to its farthest neighbor as a receiver, and N_{sum} is modified by adding the number of neighbors on the forwarding side (in Figure4, the right side) of the receiver, N_{min} is modified to the number of the receiver’s neighbors in the forwarding side if it is less than N_{min}. 3. Repeat this process until the NICP is forwarded to another junction, then N_{sum} and N_{min} of this road segment can be obtained.
A node at junction chooses the next street to transmit the packet according to the following function
S\left(J\right)=\alpha \times (1D)+\beta \times \frac{{N}_{\text{avg}}}{1+\left({N}_{\text{avg}}{N}_{\text{min}}\right)},
(5)
where D = D_{j}/D_{i}, D_{j} is the distance from the midpoint of the candidate street to the destination and D_{i} is the distance between the current junction and the destination. α and β are weighting factors. S(J) is the score of other adjacent road segments that integrates the distance and the network connectivity, and the road segment with highest S(J) will be chosen to forward the packet to. D is the closeness of the candidate junction to the destination, the shorter the distance from the candidate junction to the destination, the lager the value of the first item. N_{avg} is the average number of vehicles in a unit scope, N_{avg}N_{min} reflects the uniformity degree of the distribution of the vehicles in the road segment, and the road segment with large and balanced vehicle density has more opportunity to be chosen.
Now we will have a brief discussion on the influence of the vehicular traffic in three conditions with respect to different values of N_{min}:

1.
When N _{min = 0}, that means on this road segment there is a vehicle having no neighbors in the forwarding direction of itself, thus the network on this road segment is considered disconnected. At this time the NICP cannot be delivered from one junction towards the other side; therefore, this road segment will not be selected until after a period of time N _{min} grows larger than 0 due to the movement of the vehicles.

2.
When 1 ≤ N _{min} < N _{avg}, at this time, the uneven node distribution is penalized by the denominator, making the second item a smaller value. The closer these two values are, the smaller the penalization it has.

3.
When N _{min} = N _{avg}, then value of the second item without weighting factor equals to N _{avg}, the road segment is connected and the distribution of vehicles on this road segment is approximately uniform, and it can be reflected by the relatively higher value of the second item. Then the road segment with such characteristic has higher priority to be chosen to forward the packet to.
3.4 Repair strategy
When the network nodes become sparse, there is a high probability that a packet gets stuck in a local optimum. In this case, the forward algorithm enters into a repair strategy. In LSGR, the repair strategy combines the idea of carry and forward[17] and the perimeter forwarding. The current vehicle in a repair mode will carry the packet for a period of time to look for an available neighbor to forward the packet. If the vehicle cannot find an available next hop during the period, the packet is forwarded back to the last junction. Then the packet is forwarded back in the perimeter mode similar to that in GPCR. In the simulation in Section 4, the period is dynamically set as R/2v. Where R is the transmission range and v is the speed of the vehicle when it begins to carry the packet.
3.5 Further discussion
EOA incorporates the distance and the link quality to choose the next hop. It has the advantages of increasing the network throughput and reducing the endtoend delay. However, several deficiencies of EOA should be illuminated here. And our future work will focus on perfecting the routing metric.

1.
The ETX of a link is measured by the link’s packet delivery probability, which is obtained through the Hello packets. Note that the Hello packet is a short packet which can be much shorter than a data packet. In wireless networks, a long packet is more vulnerable to bit error and packet dropping than a short packet. The chance of a Hello packet dropping is comparatively much smaller than that of a data packet dropping. Therefore, while glaring discrepancies exist among the ETX of different links for data packets, it is not for the Hello packets. This fact will mislead the nodes about the choice of the next hop, making distance become the dominant factor.

2.
Suppose such a scenario, where vehicles A and B are two neighbors that are located close to the transmission range of vehicle S, as shown in Figure 5. A travels in the same direction as S, and the connectivity between them have existed for a period of time. Whereas B travels in the opposite direction and it has just entered the transmission range of S. After B enters the transmission range of S, it broadcasts a Hello packet and it is successfully received by S. In less than 1 s after S receives the Hello packet from B, S needs to forward a packet which is destined for the intersection I. Assume that ETX of the link between S and A is 1.65. As the time when S received the first Hello packet from B is less than 1 s before the current time, ETX of the link between S and A computed by S is 1. As a sequence, the EOA of A and B are 148.48 and 230, respectively. Then vehicle B will be chosen as the next hop. However, obviously the calculation result from one Hello packet cannot fully reflect the state of the link between S and B. An alternative method to address this problem is to take the moving direction into account. The neighbors which are moving in the same direction as the forwarder takes priority over those that move in the opposite direction.