# Dynamic Multiple Junction Selection Based Routing Protocol for VANETs in City Environment
## 3 Dynamic Multiple Junction Based Source Routing Protocol
### DMJSR Protocol Overview
#### 3.2.2 Dynamic Multiple Junction Selection  
Similar to the existing routing approaches GyTAR, E-GyTAR and TFOR, DMJSR routing protocol uses anchor based routing approach with city streets information. It utilizes street map topology for routing of data packets between vehicles. The major difference between the considered protocols and our protocol is the junction selection mechanism. DMJSR selects the next appropriate junction by considering the next two immediate junctions dynamically from current junction based on vehicular traffic density and shortest curve metric distance to the destination. Now a big question about the proposed protocol can be that why two junctions are considered and not three, four and so on? The answer to this question is given in Section 4.3.4. By considering two junctions, it decreases the probability of facing connectivity problem that occurs during existing junction selection mechanisms. Also, it decreases the probability of incurring dead-street (street without packet carriers/vehicles) along a selected path to the destination. It also moves packet progressively closer to the destination by using those streets that are rich in traffic/connectivity as compared to existing approaches. When choosing next two-hop neighbor junction, the sender vehicular node or intermediate vehicular node looks for the positions of two-hop neighboring junctions by using digital city streets map and a score is calculated and assigned to all candidate two-hop neighbor junctions based on traffic density and curve metric distance of candidate junctions to the destination. The two-hop neighbor junction with the highest score is selected as the next destination junction. Candidate junctions are allocated score using Algorithm 1. In Algorithms 1 and 2, alpha (\(\alpha\)) and beta (\(\beta\)) are the weighting factors for distance and traffic density respectively between the junctions. By adjusting the value of \(\alpha\) and \(\beta\), we can make a tradeoff between distance and traffic density when selecting next junction. Traffic density is vital for providing connectivity for relaying packet toward the destination. H\({}_{1}\) and H\({}_{2}\) are the weighting factors for candidate one-hop neighbor junction and two-hop neighbor junction respectively. An adjustment in the value of H\({}_{1}\) and H\({}_{2}\) can make a tradeoff between the importance of candidate one-hop neighbor junction and two-hop neighbor junctions. In our simulations, equal weights are assigned to all aforementioned parameters. Lines 1 to 10 set the values to the parameters used in our algorithm. Line 11 checks if candidate one-hop neighbor has next neighbor junction that leads to the destination then Algorithm 1 invokes Algorithm 2 using line 12 which is given below. ```
Input: Area, \(\alpha\), H\({}_{2}\) Output: The next destination junction NDj
1. begin
2. set score \(\leftarrow\) 0
3. set \(\beta\)\(\leftarrow\)\(1\) - \(\alpha\)
4. set H\({}_{1}\)\(\leftarrow\)\(1\) - H\({}_{2}\)
5. for each candidate junction j do
6. set D\({}_{\text{n}}\)\(\leftarrow\) the curve metric distance between NCj and destination /* NCj is the next candidate junction (one-hop) */
7. set D\({}_{\text{c}}\)\(\leftarrow\) the curve metric distance between Cj and destination /* Cj is the current junction */
8. set D\({}_{\text{p1}}\)\(\leftarrow\) D\({}_{\text{n}}\)/D\({}_{\text{c}}\)/* Closeness of candidate junction to destination */
9. set TD\({}_{1}\)\(\leftarrow\) no. of vehicles between NCj and Cj in both directions
10. if score < (\(\alpha\)\(\times\)\((1\) - D\({}_{\text{p1}}\)) + \(\beta\)\(\times\) TD\({}_{1}\))
11. if NCj contains next candidate neighbour junction NCk //two-hop
12. invoke Algorithm 2 //GetnextneighbourToKf (NDk, Score)
13. set ScoreK = Score
14. set NCj \(\leftarrow\) NDk
15. set NDj \(\leftarrow\) NCj
16. set score \(\leftarrow\) H\({}_{1}\). (\(\alpha\)\(\times\)\((1\) - D\({}_{\text{p1}}\) ) + \(\beta\)\(\times\) TD\({}_{1}\) ) + H\({}_{2}\).