# A Pervasive Collaborative Architectural Model at the Network's Periphery
## 3 Collaborative Architectural Model of Mobile Pervasive Computing
### Constructing Connectivity Algorithms to Manage the APCAM Model
(5) Algorithm 5 Sending_Message (IP, IP) uses the previous algorithms to reach the target user (object). This algorithm routes a message from device A to target device B in areas covered by device-to-device radio connections such as Lora and Wi-Fi Direct. This algorithm is an iterative algorithm in which the device that has the message (at the beginning it is A) creates its list of devices connected to it with their scores. Then, it looks for device B to check if B can be reached using this device's list to send it the message and accomplish its task. Otherwise, it searches through its list to find the device with the next highest score to B. This algorithm takes advantage of the device's mobility to allow the device carrying the message to move to find in its list of connected devices the appropriate one to send this message. It keeps doing this until it meets the intended device B. We have a dynamic graph because the nodes can be entered in and out of it continuously. These devices are all in constant motion. Therefore, the device carrying the message must move to communicate with the others. Depending on the latitude and longitude of the nodes between B, the device carrying the message and the candidate to carry it, we determine their positions relative to each other. Then, the distances are compared between B and each of the two nodes. The carrier of the message sends it to the other if it has the shortest distance to B. For example, let M be the device carrying the message and N be the candidate to carry it. We calculate the distances MB and NB, and if NB < MB then M sends the message to N.

Before closing this section, let us say a word about the running times of these algorithms, which are, as we will see shortly, very efficient. Indeed, Algorithm 1 is obviously of \(O(1)\)-time. The time complexity of Algorithm 2 is dominated by the _while_ loop iterated at most \(n\) times. Since the core of this loop takes \(O(1)\)-time, it follows that Algorithm 2 is \(O(n)\). The time complexity of Algorithm 3 is dominated by the two loops nested one inside the other. Again, as the corps of the two loops is \(O(1)\)-time, it then follows that the global running time of Algorithm 3 is \(O\big{(}n^{2}\big{)}\). Algorithm 4 is obviously of \(O(1)\)-time. Now, for Algorithm 5, there are two things to distinguish. First, the inner loop _for_ runs in \(O(n)\)-time, whereas the running time of the outer loop while depends on the input. Indeed, as long as condition (ip! = ip\({}_{B}\)) is met, the loop while does not terminate. The device carrying the message moves to find an appropriate place in the list of devices connected to it to receive this message. This continues until it meets the intended device B. Therefore, in the worst case, the test will be done in \(O(n)\) time, as we have \(n\) devices. Therefore, the overall time complexity of Algorithm 5 is \(O\big{(}n^{2}\big{)}\). the public IP address of the page to a private one. To make the system more secure, we can also add an identification page to identify each user. Thus, each user must have a login and a password. For more security, we can further create a database via a registration form to the network of Lopys to verify the connection of the participants. However, it must be taken into account that the more important the security measures, the lower the chances are of the general public participating in and benefitting from this model. Therefore, the lower the chances are of rescuing people in harsh and catastrophic situations. ## 4 Experimental Study

Relying on the type of the available communication technology, we classified the experimental study we conducted into two categories. Category A uses device-to-device radio communication technology only, such as Wi-Fi Direct, and Category B combines this technology with others that are available via Pycom's LoPy4, such as Radio Wi-Fi, Lora and Bluetooth. In both cases, we used a combination of mobile phones, tablets and laptops. In case A, we used mobiles and tablets, whereas in case B, we used laptops.