# Algorithms for Delivery of Data by Drones in an Isolated Area Divided into Squares
## 2 Materials and Methods
### Algorithms and Protocols for Delivery of Data Using Drones
This algorithm also requires high computation and infrastructure capabilities. This protocol has low performance when nodes have small buffer sizes because of the adaptive threshold calculation, but gives better performance with a larger buffer size. It has a so-called slow start problem, because, in the case of a big network, it may take a very long time before each node receives the delivery predictability of other nodes because of the disconnecting nature of the networks, as shown in [20]. MaxDelivery [54] is an algorithm based on prioritizing message delivery using an appropriate buffer management strategy that consists of a forwarding, dropping, and buffer-cleaning mechanism. Next, we propose our time-dependent Dijkstra algorithm to find a route between two nodes in our drone network. [PERSON]'s algorithm is used to find the shortest path connecting two nodes in a network [55]. Our routing problem can be modeled using a time-dependent oriented network [56] defined as follows. Figure 6: Squares network considered for experiments. **Definition 1**. : _A triple \(G=\) (V, \(A\), \(f\)) is called a time-dependent oriented network, where V is a set of vertices, \(A\subseteq V\times V\) is a set of arcs, and \(f\) is the time dependency function defined on each arc, \(f\): A \(\times\) T \(\rightarrow\) T, \(T\subseteq\) R+ is called the time set and when moving on the arc \(a=(u,v)\in A\) from node \(u\) to node \(v\), f(\(a\), \(t\)) \(\in\) T is the moment of arrival at node \(v\) if node \(u\) is left at the moment \(t\in T\). Of course, f(\(a\), \(t\)) \(>\) \(t\), for each arc \(a\in A\) and for any moment \(t\in T\)._  
In our problem, V is the equidistantly distributed set of 2D points, A is the set of connections between these points ensured by drones, and T = {0, 1, 2,... } is the set of counting seconds in a day. The value of f(\(a\), t) must be computed as quickly as possible. Thus, for each arc \(a\) = (u, v), the arrival moments of drones at node \(v\) are maintained in order to enable a binary search to be undertaken when f(\(a\), t) is calculated at arc \(a\) and time t. The arrival moments of drones for all arcs are pre-calculated (once before starting to use the algorithm) because an exact schedule of drones is known based on each drone's starting second in a day, its travel on each arc, its data transfer at nodes, and its wireless charge/battery change time. For a given source node \(s\in V\), the function dists: V \(\times\) T \(\rightarrow\) N is introduced, where dists(\(u\), ts) is the distance in seconds from s to u starting from the moment ts, i.e., it is the minimum number of seconds needed to go from node \(s\) to node \(u\in V\) on the arcs of A if source \(s\) is left at moment ts. Of course, dists(\(s\), ts) = 0 for every ts \(\in\) T. If node \(u\) is not reachable (accessible) from s, then dists(\(u\), ts) = +\(\infty\). For a given destination node \(d\), our problem is to determine dists(\(d\), ts) at a given time ts. The pseudo-code for the time-dependent Dijkstra algorithm is presented in Figure 7.  
Figure 7: Pseudo-code of TD-Drone Dijkstra algorithm. Q is a priority queue. This means that, at any moment, the nodes from Q are sorted in ascending order according to their distance in seconds from s. At the end of the algorithm, if destination d was reached, the values kept in the so-called predecessor vector p are used to determine the route from s to d. If a node v was reached, then this was done using the arc (p(v), v), where node p(v) is called the predecessor of v. After the time-dependent Dijkstra algorithm is executed using the staring moment ts, the route from s to d (if it exists, i.e., dists(d) \(<+\infty\)) is determined using the algorithm presented in Figure 8. Because the nodes of the route are found by the above algorithm in inverse order (from d to s), the route must be reversed at the end.