## 3 Proposed Methodology
### Hybrid Algorithm for Finding the Highest Stable Least Delay Path or Highest Stable Shortest Path  
Let there be \(N\) nodes in the vehicular network. The algorithm finds the highest stable path (least delay or shortest path) from each and every other node to a given destination node. We find paths from each and every other node in the network rather than from a given source node for the following reason: in both cases, for finding a route from a given source node to a given destination and for finding routes from each and every node to a given destination node, the algorithm should run iteratively through all \(N\) nodes in the network to compute paths, as evident from Figure 1. It can be proven, using asymptotic runtime complexity analysis, that the total runtime complexity of finding \(N\) paths separately from a given source node to a given destination node by running the algorithm for \(N\) times is much higher (\(O(N^{3})\)) than computing paths from each and every node to a given destination node at once using a single algorithm run (\(O(N^{2})\)). Thus, the runtime complexity of the hybrid routing algorithm is \(O(N^{2})\). Furthermore, the space complexity of the hybrid routing algorithm is also \(O(N^{2})\). The controller workload is a key aspect of SDVN, as, when the number of nodes in the network increases, the workload of the controller increases, meaning that every effort should be made to reduce the computational complexity at the controller for any given solution to be scalable. Thus, we stick to the approach of finding routes from each node to the given destination vs. the computationally inefficient approach of finding a path from a given source to a given destination. The choice of least delay or shortest path depends on the current normalized network contention value. The inputs to the algorithm are the destination node (\(S\)), adjacency matrix of link lifetime (\(T[N,N,2]\)), adjacency matrix of position (\(X[N,N,2]\)), adjacency matrix of estimated delay (\(D[N,N,2]\)) for two communication channels (wired and wireless), normalized network contention (\(\mathcal{C}\)), link lifetime threshold (\(T_{th}\)), and network contention threshold (\(\mathcal{C}_{th}\)). The diagonal elements of the adjacency matrices \(X\), \(D\), and \(T\) are zero, since the distance, delay, and lifetime from node to node are themselves zero. Furthermore, note that the link lifetimes and delays of non-existing links (inter-node displacement greater than the maximum wireless transmission distance for wireless links) are zero and large, respectively. The outputs are \(P_{s}[N,x,1]\), \(V_{s}[N]\), and the destination node \(S\). \(P_{s}[N,x,1]\) is an adjacency list containing paths (Node ID and link type to visit in arriving at destination node \(S\)) from each and every other node to destination node \(S\), where \(x\in[0,N]\). \(V_{s}[N]\) is the path valid time vector, which contains the maximum time that each of the computed paths to destination node \(S\) is valid (the lifetime of each route). For instance, \(P_{s}[i,x,1]\) and \(V_{s}[i]\) contain the path and path valid time from source node \(i\) to destination node \(S\), respectively. The pseudo-code for the hybrid algorithm for finding the stable least delay or stable shortest path is given in the code snippet in Figure 1.  
The stable path-finding algorithm given in Figure 1 can be described as follows. \"added\" and \"shoStaDisDel\" are \(N\)-dimensional arrays. \"type\" is a variable to store the link type (communication channel type). \"added\" is used to track the already included vertices when finding the stable path. \"shoStaDisDel\" is used to store the stable shortest distance or stable least delay from the node represented by the \(i\)th array index of \"shoStaDisDel\" to the destination node. Line 2 of the algorithm initializes all \"shoStaDisDel\" elements with large integer values; the \"added\" array is initialized as false, as no elements are added to routes in the beginning.