Adaptive Routing Optimization Algorithm in Community-Oriented Opportunistic Networks for Mobile Health

The appearance of a large number of mobile intelligent devices boosts the fast rise of mobile health (mHealth) application. However, due to the sensitivity and complexity of medical data, an efficient and secure mobile communication mode is a very difficult and challenging task in mHealth. The Opportunistic Networks (OppNets) is self-organizing and can expand the communication capacity by the movement of nodes, so it has a good prospect in the application of mHealth. Unfortunately, due to the shortage of stable and reliable end-to-end links, the routing protocol in OppNets has usually lower performance and is unsafe. To address these issues, we propose an adaptive routing optimization algorithm in OppNets for mHealth. This routing scheme firstly analyzes the relationship between nodes and defines the average message forwarding delay as a new metric to selectively forward messages, and then designs a local community detection algorithm based on the metric to adapt to the characteristics of OppNets, and finally resorts to some super-nodes to ferry messages between different communication domains. The simulation results demonstrate the efficiency and effectiveness of the proposed scheme. It increases the delivery ratio by about 30%, decreases delay by about 35%, and decreases the number of forwarding by about 5%, by comparing it with several existing routing schemes. We believe that the relationship between nodes, community, and message ferrying will play an important role in routing of OppNets for mHealth.


Introduction
The mobile health (mHealth) provides an effective approach for medical and health services through the use of mobile communication technologies, such as the mobile phone. The mHealth improves not only the working efficiency of the hospital but also the health of the people, and it is becoming one of the most active research and application directions in the field of medical information recently [1]. However, the flourish of mHealth still faces many challenges, including communication mode and information security. The Opportunistic Networks (OppNets) is composed of a large number of mobile intelligent terminals and takes advantage of their movement to facilitate data transmission and exchange. The appearance of OppNets makes people's communication with each other break through the limitations of time and space, and provides them with quick and convenient access to information [2,3]. Therefore, OppNets is more suitable for the mHealth applications and has a good prospect of application [4].
Different from the traditional networks, OppNets adopts the "storage-carry-forward" routing strategies to transmit the messages [5]. The advantage of this strategy is that it can forward messages

Related Work
As a new health care model, mHealth has attracted the attention of many researchers. They mainly introduce the current situation of the mHealth application, discuss the main problems in the process of the application, and put forward some opinions on the development trend in the future. Free et al. [9] analyzes the effectiveness of mobile technology interventions for health care consumers. Istepanian et al. [10] discusses the trends in the applications of mobile technologies for different healthcare schemes. Doukas et al. [11] designs and implements a mobile healthcare system that is based on Cloud Computing. In [12], Inglong et al. think service provisions and individual attitudes play an important role in the promotion of the mHealth Application. Rongxing et al. [13] presents a mHealth framework based on OppNets to efficiently protect the user privacy.
On the other hand, to improve routing performance of OppNets, many routing algorithms are proposed from different perspectives, such as Spray and Wait [14] and PRoPHET [15]. With the popularization of mobile intelligent terminals, a number of new applications of OppNets have been spawned, such as pocket switched networks (PSN) and vehicular networks. In these scenarios, the community-based routing algorithms are proposed. Hui et al. [16] described the community structure of PSN and proposed an algorithm, named BUBBLE, which selects nodes with high centrality value and community members of destination as relay nodes. Jianwei et al. [17] organize nodes into communities on the basis of the contact frequencies and choose more active nodes as the relays in communication. Thomas et al. [18] use group structures for efficient routing in terms of the relationship among human society. In [7], Fang et al. used a simple method to construct a new cross-group network structure. Jia et al. [19] present a data transmission scheme based on the weight distribution between nodes and community's reconstitution in social opportunistic networks. Xingyuan et al. [20] propose an overlapping communities detection algorithm based on vital nodes and initial seeds. Xianhuan et al. [21] propose a non-overlapping community detection algorithm based on the trust relationship between users. Yeqing et al. [22] propose an effective data transmission strategy based on node socialization. It has a high packet delivery ratio by using the communities and selecting optimal next-hop nodes, but it has some disadvantages, such as the measurement of the nodes' similarity by distance. In addition, there are some routing algorithms based on the relationship [23], context aware [24], etc. Furthermore, the routing based on message ferry is introduced in some applications of OppNets where nodes are distributed sparsely. Wenrui et al. [25] propose a message ferrying scheme and discuss the use of the ferry routing under the conditions of the constrained number of ferry nodes. The optimized way-points [26] was proposed to determine the mobile path of the ferry node by calculating the encounter probability. Xue et al. [27] select the node with the highest power as the ferry and propose the single-ferry and multiple-ferry mechanisms. Shangxing et al. [28] formulate the problem of robots ferrying messages to communicate between statically-placed sources and sink pairs. Harounabadi et al. [29] use a stigmergic communication for the coordination of ferries and the decision functions based on the local observations of a ferry, and present an adaptive on-the-fly decision maker for multi-ferry delay tolerant networks.
As presented above, the mHealth system need a wireless ad-hoc network that can efficiently and securely transmit massive and sensitive medical information. However, the flooding-based routing scheme does not consider the heterogeneity of nodes and simply relies on multiple copies to transmit messages. The message ferry-based routing scheme can improve the transmission performance in OppNets where nodes are distributed sparsely. The routing based on communities provides an effective measure to promote the communication ability of network, but it has some defects to transmit messages efficiently between communities. Therefore, it is necessary to propose a new approach to achieve the reliable and efficient data transmission in OppNets for mHealth.

Network Model
In our study, the OppNets for mHealth is designed as shown in Figure 1. The network consists of two different types of mobile nodes including ordinary and ferry nodes. The ordinary node is a common mobile intelligent terminal with several pieces of software that can send or accept messages and record logs of conversations, and the embedded communication device such as Bluetooth. It can be divided into different communities according to a certain metric, for example, the relationship between nodes. Compared to the ordinary node, the ferry node can reach a longer communication distance and don't need to join the community.
al. [25] propose a message ferrying scheme and discuss the use of the ferry routing under the conditions of the constrained number of ferry nodes. The optimized way-points [26] was proposed to determine the mobile path of the ferry node by calculating the encounter probability. Xue et al. [27] select the node with the highest power as the ferry and propose the single-ferry and multiple-ferry mechanisms. Shangxing et al. [28] formulate the problem of robots ferrying messages to communicate between statically-placed sources and sink pairs. Harounabadi et al. [29] use a stigmergic communication for the coordination of ferries and the decision functions based on the local observations of a ferry, and present an adaptive on-the-fly decision maker for multi-ferry delay tolerant networks.
As presented above, the mHealth system need a wireless ad-hoc network that can efficiently and securely transmit massive and sensitive medical information. However, the flooding-based routing scheme does not consider the heterogeneity of nodes and simply relies on multiple copies to transmit messages. The message ferry-based routing scheme can improve the transmission performance in OppNets where nodes are distributed sparsely. The routing based on communities provides an effective measure to promote the communication ability of network, but it has some defects to transmit messages efficiently between communities. Therefore, it is necessary to propose a new approach to achieve the reliable and efficient data transmission in OppNets for mHealth.

Network Model
In our study, the OppNets for mHealth is designed as shown in Figure 1. The network consists of two different types of mobile nodes including ordinary and ferry nodes. The ordinary node is a common mobile intelligent terminal with several pieces of software that can send or accept messages and record logs of conversations, and the embedded communication device such as Bluetooth. It can be divided into different communities according to a certain metric, for example, the relationship between nodes. Compared to the ordinary node, the ferry node can reach a longer communication distance and don't need to join the community.
The transmission mechanism of the network meets the following rules: (1) The forwarding of a message in the community is dependent on the ordinary nodes, while the communication between communities is carried out by the ferry nodes. (2) An encounter node is chosen as the relay node if it satisfies a certain condition, such as being more active than the source node, one of the ferry nodes, and the same community with the destination node.   The transmission mechanism of the network meets the following rules: (1) The forwarding of a message in the community is dependent on the ordinary nodes, while the communication between communities is carried out by the ferry nodes. (2) An encounter node is chosen as the relay node if it satisfies a certain condition, such as being more active than the source node, one of the ferry nodes, and the same community with the destination node.

Analysis of Node Relations
In OppNets for mHealth, nodes are human-carried intelligent devices, and their movement and contacts are carried out by the carriers. Hence, they are heterogeneous and have social relationships and behaviors of people, which are used to analyze their mobility and predict their contacts for reliable message delivery.

Historical Encounters
The historical encounters of nodes can be successfully collected with the wireless terminal devices after a period of network running. They usually include information such as the number, duration, and time interval of encounters, and may also include the node's position, speed, and direction of movement. Hence, we can obtain the movement laws of nodes over a period of time and measure the strength of the relationship between nodes. For example, the more frequent the contact between pairs of nodes are, the closer their relationship is.
In the previous researches [16,[30][31][32][33], there are some metrics which can be used to analyze the relationship between nodes, such as the number of encounters, the frequency of encounters, and the total or average duration of encounters. Unfortunately, they have some shortcomings and cannot exactly evaluate the relationship between nodes in different situations. Therefore, we define a new metric based on the historical encounters as follows: where, w ij is the measure metric and denotes the reciprocal of the average delay of messages forwarding in the time T. f (t) is a function and denotes the forwarding delay. The message is forwarded at once during the encounter, while it can only wait for the next encounter in other cases. Therefore, we have: Furthermore, the interval time of encounters between nodes v i and v j is t k , and k =1, 2,· · · , n. Then, we specify the metric as follows: Clearly, the larger w ij is, the closer the relationship between node v i and v j is.

Social Features
The social features of nodes can be represented by physical features and logical features of a person (for example, membership in an organization, such as age, gender, blood group, and members of the organization. Li et al. in [29] present that the more the same social features of two nodes is, the more frequent their contact is. Therefore, we think the social features can also reflect a certain relationship between nodes.
The 2006 Infocom datasets [34] provides 10 social features based on questionnaires, and they are nationality, studies, languages, affiliation, position, city, country, topics, and so on. The MIT reality mining datasets [35] provide, also, several social features, such as neighborhood, daily commute, hangouts, working hour, affiliation, and research group. In these social features, only a small part of them have a significant influence on the relationship between nodes, and they can be obtained by computing their Shannon entropy as follows: where, f i is the ith social features of nodes, x j is a value of f i , and p(x j ) is the probability of x j . Obviously, if the value of E(f i ) is bigger, the social feature f i is more important. To measure the relationship between nodes based on the social features, we used the number of their social features in common as follows: Obviously, if the value of the metric F ij is bigger, node v i and v j is closer.

Proposed New Metric
Both the social feature and the historical encounter can reflect the relationship between nodes, but they are different from a logical point of view. The former is stable and can be obtained according to the investigation before network deployment, and it is related to the social relationship and physical features of the carrier, while the latter is dynamic and calibrated and maintained at scheduled time intervals, and it depends on the physical position of nodes. Therefore, they are complementary and can be combined to use as a hybrid relationship as follows: where, w ij is the new metric which is combined historical encounters with social features of nodes by normalized processing, α is an adjustment parameter to control the influence of historical encounters and social features on the relationship between nodes.
In the actual application of OppNets for mHealth, the global attribute of the network is usually very hard to get due to the network partition. On the other side, some nodes may belong to multiple different communities. Therefore, the community detection algorithm of OppNets should meet two conditions: it is based on the local attribute of the network and can deal with the overlapping communities. For this reason, we present a local community detection algorithm on the basis of the relationship between nodes. Its details are as follows: Step 1. Compute the active value of nodes: Considering a large degree of nodes is often the center of a community, we simplify the computation of the active value as follows: where, C i is the active value of node v i , m ij is the proposed metric, and N i is the number of nodes which have the close relationship with v i .
Step 2. Select the core nodes: Sorting by the active value, the nodes with the larger value are picked out. Considering some of the selected node are intimate and may belong to the same community, they cannot be a core node and should be removed. Hence, we have: where, Γ i is the intimate node set of v i , |Γ i ∩ Γ j | is the number of the common intimate nodes between v i and v j , S ij is the similarity value between node v i and v j . If S ij is greater than a threshold (e.g., 0.8), v i and v j is thought to be similar, and one of them is removed. Step 3. Expand community according to the fitness degree: The fitness degree of node v i for community C can be defined as: where K in (C) is the metric sum of internal node in community C, K out (C) is the metric sum between C and other community, α is a regulatory factor which can control the size of the community, and C + i is Step 4. Combine redundant communities: where, |C 1 | is the number of nodes in C 1 , |C 1 ∩ C 2 | is the number of identical nodes in C 1 and C 2 , O 12 is the overlap value between C 1 and C 2 . If O 12 is bigger than a value (for example, 0.75), C 1 and C 2 are redundant and need to be combined into a new community.
Step 5. Repeat Steps 3 to 4 above for the rest of nodes until each node is added in a community.

Deployment of Ferry Nodes
The community can be introduced into the OppNets for mHealth to improve their routing performance. However, there is a communication bottleneck between communities because nodes are very rare and inactive in these areas. Considering the role of ferry nodes, this section will discuss how to deploy the ferry nodes in the community boundary.
The network topology of OppNets is dynamically changing because of node movement. In order to achieve adaptive deployment of ferry nodes, we introduce the virtual potential field theory to control the movement of ferry nodes. In the virtual potential field theory [41], there is a pair of forces between two objects in the vacuum as follows: where, K is a coefficient, M is the mass of the object, D is the distance of two objects, → D 0 is the direction of the force.
Just like the objects in the vacuum, the ferry nodes in OppNets will be subject to the repulsion and attraction forces of the neighbor nodes. Furthermore, we improve the Formula (11) as follows: First, we simplify the calculation of forces and set K = 1, Next, we only consider the effect of force upon the ferry nodes. Then, the repulsion or attraction forces of the ferry nodes are determined by their position, not their distance. Specifically, we consider the two cases as follows: (1) Ferry node is located in a community.
In this case, the ferry node should be away from the center of the community and move to the edge. Therefore, it will be excluded by the nodes located in the inner layer of the community, and be attracted to the outer layer nodes. To achieve this goal, the following two problems need to be addressed: First, the layer-number of a node located in the community can be determined. It is obtained by tagging, in the process of community detection, based on the breadth-first search algorithm. For example, the layer-number of the center node in the community is determined to be 0, and its neighbor nodes are 1, and so on. Second, the position of a node relative to the ferry node in the community can be determined. We take the reference layer to be n r = (n 1 + n 2 )/2, where n 1 and n 2 are the two layers' numbers of nodes that have nearer distance from the ferry node. If the layer number of a node n > n r , it is located in the inner layer of the community, and it is attracted to the ferry node. Otherwise, it is in the outer layer and excludes the ferry node. The forces diagram of ferry nodes located in a community is shown in Figure 2A. In the perceptual boundary of the ferry node fn, there are four ordinary nodes n 21 , n 22 , n 31 , n 32 . Where n 21 and n 22 are ordinary nodes in the second layer of the community, and n 31 and n 32 are ordinary nodes in the third layer of the community. There are two repulsion forces, f 21 and f 22 , and two attraction forces, f 31 and f 32 . The resultant force is as follows: Under the action of this resultant force, the ferry node moves to the edge of the community.
community. There are two repulsion forces, f21 and f22, and two attraction forces, f31 and f32. The resultant force is as follows: 21 22 31 32 f Under the action of this resultant force, the ferry node moves to the edge of the community.
(2) Ferry node is located in the area between communities.
In this case, the ferry node should be excluded by all its neighbor nodes, including ordinary nodes in communities and other ferry nodes, and it should move to the center area between the communities. The force diagram of ferry nodes located in the area between communities is shown in Figure 2B. In the perceptual boundary of the ferry node fn1, there are two ordinary nodes, na and nb, and two ferry nodes, fn2 and fn3. Where na is in the ath community and nb is in the bth community. There are four repulsion forces, fa, fb, f2, and f3. The resultant force is as follows: Under the action of this resultant force, the ferry node moves to the center area between the communities.

Transmission Algorithm
In OppNets, the transmission scheme of messages is based on the greed strategy in general. That is, compared to the current node with a message, an intermediate node has more opportunities to access the destination node. Then it is selected as a relay and can receive the message forwarded by the current node. In this paper, the network contains a number of communities. The messages are forwarded by ordinary nodes within the community, and are ferried by ferry nodes between communities.
The transmission strategy in the community is: If the intermediate node vi is met, then the following requirement applies: vi is one of the ferry nodes or wi > ws (where, wi is the metric sum of relationships between vi and other nodes in the community). In the case whereby vi is thought to be (2) Ferry node is located in the area between communities.
In this case, the ferry node should be excluded by all its neighbor nodes, including ordinary nodes in communities and other ferry nodes, and it should move to the center area between the communities. The force diagram of ferry nodes located in the area between communities is shown in Figure 2B. In the perceptual boundary of the ferry node fn 1 , there are two ordinary nodes, n a and n b , and two ferry nodes, fn 2 and fn 3 . Where n a is in the ath community and n b is in the bth community. There are four repulsion forces, f a , f b , f 2 , and f 3 . The resultant force is as follows: Under the action of this resultant force, the ferry node moves to the center area between the communities.

Transmission Algorithm
In OppNets, the transmission scheme of messages is based on the greed strategy in general. That is, compared to the current node with a message, an intermediate node has more opportunities to access the destination node. Then it is selected as a relay and can receive the message forwarded by the current node. In this paper, the network contains a number of communities. The messages are forwarded by ordinary nodes within the community, and are ferried by ferry nodes between communities.
The transmission strategy in the community is: If the intermediate node v i is met, then the following requirement applies: v i is one of the ferry nodes or w i > w s (where, w i is the metric sum of relationships between v i and other nodes in the community). In the case whereby v i is thought to be more active than the source node v s and it has more opportunities to access the destination node, v s forwards the message to v i and v i becomes a relay node. The transmission strategy between the communities is: If the intermediate node v i is in the ordinary node and is a member in the community of the destination node, the ferry node v f forwards the message to v i and v i becomes a relay node.
The Algorithm 1 explains the process of the adaptive routing. At a particular time, the node v s needs to send a message m to the node v d and encounters a node v i . If v i is v d or v i has more opportunities to access v d than v s , v i is selected as a relay and receives m from v s . Otherwise, v s continues carrying m until it meets the next node. Then, v i with m also participates in the forwarding, and this process does not stop until v d accepts m.

Algorithm 1 An Adaptive Routing Optimization Algorithm
Input: source node v s , destination node v d , ferry node v f , message m, community C, metric w 1: while v d without m do 2: current node v c (v s , v f or relay node v r ) encounters node v i without m; 3: if v i is v d then 4: v i accepts m from v c and the forwarding process ends; 5: else 6: if v c and v d are in the same C then 7: if v i is in the C and w id > w cd then 8: v i is selected as v r , and v c forwards m to v i ; 9: end if 10: else 11: if v c is v f then 12: if v i and v d are in the same C then 13: v i is selected as v r , and v c forwards m to v i ; 14: end if 15:

Simulations
To evaluate the performance of the proposed routing in OppNets for mHealth, a few simulation experiments were done with several different types of contact traces.

Simulation Data
In all our simulations, the following data set was used. (1) Realistic contact trace: We used the datasets which were collected with iMotes in Infocom 2006 [34]. It is publicly available from the CRAWDAD collection. There were 79 students and researchers who had 74,981 contacts in 337,418 s. In our simulation, the data of 61 participants was only used, because other people's information was incomplete. Six social features were extracted from these datasets, including graduated school, topics, nationality, country, city, and affiliation. The first 40 h of data was used to gather the historical data for the network training, and the remaining 53 h of data was used to evaluate the proposed routing performance. (2) Synthetic contact trace: It was formed in the simulator ONE. The parameter of ONE was: The size of the network map was 12 × 12 km; the wireless range of the ferry nodes were around 300 m and their movement speed was 20 m/s; the wireless range of the ordinary nodes was around 150 m and their movement speed was 10 m/s; the simulation lasted 26,500 s.

Performance Metrics
In all simulations, the following metrics of routing performance were used: (1) Delivery Ratio: It is the average percentage of the number of packets that successfully achieved the destination and that were sent from by the source node over a certain period of time; (2) Delivery Delay: It is the average transmission time of the packets that are accepted by the destination; (3) Hop Count: It is the average number of the relay when packets are delivered successfully; (4) Number of Forwarding: It is the average number of packets during the forwarding process.

Methods
In our simulations, the following routing schemes were used: (1) Enhanced community-based routing with ferry node (ECRF): Our proposed routing scheme. (2) Enhanced community-based routing (ECR): ECRF without ferry nodes. (3) Community-based routing (CR) [32]: In this scheme, an encounter node is forwarded the message if it is within the community of the destination node. (4) Space filling way-point (SFWP) [25]: The scheme divided the whole network i into grids, and deployed ferry nodes in the center of grids. In addition, it used the ECR algorithm to forward messages. (5) Spray-and-wait (S-W) [14]: In the first phase, the current node gives half of the message replicas to the encountered node; in the second phase, all nodes do not forward the message replicas until they meet the destination node. (6) SimBet [31]: The messages are forwarded based on the SimBet utility. (7) ESR [42]: An effective algorithm based on the relationship between nodes. (8) FCNS [43]: An effective algorithm based on the fuzzy routing-forwarding.

System Framework
The system framework of optimized routing in the community-based OppNets consists of three parts: data acquisition, methods, and results, as shown in Figure 3.  In the part of data acquisition, the raw data can be obtained from three ways: open experimental data (e.g., the Infocom 2006 trace datasets), simulation and experimental data (e.g., ONE simulator), and actual data acquisition. These data may be incomplete, noisy, and inconsistent, and the use of data cleaning techniques to correct detected errors and omissions is needed. These In the part of data acquisition, the raw data can be obtained from three ways: open experimental data (e.g., the Infocom 2006 trace datasets), simulation and experimental data (e.g., ONE simulator), and actual data acquisition. These data may be incomplete, noisy, and inconsistent, and the use of data cleaning techniques to correct detected errors and omissions is needed. These improved data were saved to the cache of nodes to use again in the future. Then, three important data (including social features, historical encounters, and distances between nodes) can be gained after feature selection. It should be noted that social features of nodes are static internal and long-term characteristics and only need to be collected once, while historical encounters and distances between nodes are dynamic and need to be updated continually.
In the methods, its main task is to the stated method in Section 3-to construct communities and deploy adaptive nodes to the network. In the result showing, its main task is to the system platform (e.g., the simulator ONE) to adjust the parameters of algorithms and evaluate the performance of the optimized routing.

Influences of Ferry Nodes
This simulation evaluates the influence of the ferry node on the message forwarding by comparing ECRF with ECR and SFWP. From Figures 4 and 5, it was clear that ECRF with ferry nodes had better performance than ECR, and ECRF was also superior to SFWP with the same number of ferry nodes. In the simulation of Infocom 2006, with the growth of the number of messages in the network, the delivery ratio and the average delay in ECRF were stable and maintained at about 65% and 1600 s, respectively, while the delivery ratio in SFWP was reduced by about 52% and average delay decreased about 25%. The delivery ratio in ECR was reduced by about 50% and average delay decreased about 25%. The situation in the synthetic trace was roughly similar. These simulation data are explained by: The ferry nodes aid the improvement of the message forwarding performance, and the degree of influence is related to the location of the ferry node.

Comparison of Community Detection Algorithms
In this simulation, we compared the performance of different algorithms from the aspects of community structure detection and message forwarding.
We used the Infocom 2006 datasets to implement the community structure detection. Figure 6 showed the results that the ECR algorithm was slightly better than the k-clique. In ECR, the community structure was clearer and more accurate, especially in areas of the margin or where the community structure was not obvious. In addition, in the practical application of OppNets, the global attribute of the network (including the topology structure) is difficult to obtain because of the movement of nodes and the lack of continuous end-to-end links. Hence, ECR is more suitable for OppNets.
In the performance of community detection algorithms, Figure 7 showed the results that ECR had the better forwarding performance, especially compared to CR. In the simulation based on Infocom 2006 datasets, the delivery ratio in ECR increased by 23%, the forwarding delay reduced by 26%, and the number of forwarding decreased by 5%. In the simulation based on synthetic contact

Comparison of Community Detection Algorithms
In this simulation, we compared the performance of different algorithms from the aspects of community structure detection and message forwarding.
We used the Infocom 2006 datasets to implement the community structure detection. Figure 6 showed the results that the ECR algorithm was slightly better than the k-clique. In ECR, the community structure was clearer and more accurate, especially in areas of the margin or where the community structure was not obvious. In addition, in the practical application of OppNets, the global attribute of the network (including the topology structure) is difficult to obtain because of the movement of nodes and the lack of continuous end-to-end links. Hence, ECR is more suitable for OppNets. trace, the delivery ratio in ECR rose by 4%, the forwarding delay decreased by 5%, and the number of forwarding decreased by 5%. From the simulation results, we can draw the conclusion that our proposed community detection algorithm is effective due to the fact that it has taken advantage of the accurate node relationship and the better method of community construction. In the performance of community detection algorithms, Figure 7 showed the results that ECR had the better forwarding performance, especially compared to CR. In the simulation based on Infocom 2006 datasets, the delivery ratio in ECR increased by 23%, the forwarding delay reduced by 26%, and the number of forwarding decreased by 5%. In the simulation based on synthetic contact trace, the delivery ratio in ECR rose by 4%, the forwarding delay decreased by 5%, and the number of forwarding decreased by 5%. From the simulation results, we can draw the conclusion that our proposed community detection algorithm is effective due to the fact that it has taken advantage of the accurate node relationship and the better method of community construction.

Comparison of Routing Algorithms
This simulation is based on several contact tracks to evaluate our proposed ECRF by comparing with several classical routing algorithms. From Tables 1 and 2, it can be seen that ECRF had the best performance among the routing schemes in different situations. In simulation of Infocom 2006, compared to S-W, SimBet, ESR, and FCNS, ECRF is, respectively, 47%, 30%, 1.4%, and 2.3% higher in the delivery ratio, 38%, 27%, 7.5%, and 8.1% lower in the delivery delay, and 15.8%, 7.7%, 0.8%, and 1% lower in the number of forwarding. In simulation of synthetic trace, ECRF is, respectively, 5.4%, 3.4%, 1.8%, and 2.3% higher in the delivery ratio, 9.4%, 3.6%, 0.9%, and 1.1% lower in the delivery delay, and 17%, 9.1%, 2.9%, and 4% lower in the number of forwarding. Obliviously, the community structure and message ferry can remarkably improve the routing performance in OppNets for mHealth.

Comparison of Routing Algorithms
This simulation is based on several contact tracks to evaluate our proposed ECRF by comparing with several classical routing algorithms. From Tables 1 and 2, it can be seen that ECRF had the best performance among the routing schemes in different situations. In simulation of Infocom 2006, compared to S-W, SimBet, ESR, and FCNS, ECRF is, respectively, 47%, 30%, 1.4%, and 2.3% higher in the delivery ratio, 38%, 27%, 7.5%, and 8.1% lower in the delivery delay, and 15.8%, 7.7%, 0.8%, and 1% lower in the number of forwarding. In simulation of synthetic trace, ECRF is, respectively, 5.4%, 3.4%, 1.8%, and 2.3% higher in the delivery ratio, 9.4%, 3.6%, 0.9%, and 1.1% lower in the delivery delay, and 17%, 9.1%, 2.9%, and 4% lower in the number of forwarding. Obliviously, the community structure and message ferry can remarkably improve the routing performance in OppNets for mHealth.

Discussion
Due to the randomness of node mobility and the dependence on the forwarding of relay nodes, OppNets typically have poor routing performance and unsafe data leaks. Thus, we introduce the relationship between nodes, community, and message ferry to assist forwarding decision and relay selection.
(1) Complexity of the proposed algorithm As we could see, there are mainly three computing processes in our algorithm: The measurement of the relationship between nodes, the construction of the community, and the deployment of ferry nodes. They use mainly their own information of each node in each period, which do not consume much of the network resources to transmit control and maintenance information. The time complexity of three processes are, respectively, o(n), o(n 2 ), and o(n). Specially, the time complexity of community detection depends on the scale parameters α, and is close to the linear time if α is small enough.
(2) Effect of parameters Firstly, in the calculation of the relationship metric, as in Equation (6), there is an adjustment parameter α to control the proportion of historical encounters and social features in the relationship. Clearly, α is an important parameter to the accurate measurement of node relationship and the construction of community. In different application cases, α can take different values to obtain better network performance. In this paper, its value is 0.5, that is, the influence of historical encounters and social features is the same on the relationship between nodes. Next, the center value of nodes is a vital factor to form community, because a mistake will often lead to a very bad result. In this paper, we use a simple calculation method of the center value, as in Equation (7), in order not to waste precious and rare network resources. Finally, α in Equation (9) is another important parameter, which can control the size of the community, and is related to the time complexity of community formation. The smaller the value of α is, the finer the community size is, and the higher the time complexity is.

(3) Limitation of proposed algorithm
To improve the accuracy of the node relationship measurement, we used all attributes of the node, including historical encounters and social features. The first ones, which depend on the physical proximity of nodes, are dynamic and need to be updated every once in a while, whereas the second ones are stable and can be obtained before the deployment of OppNets. On the other hand, we only consider the direct relationship between nodes. In fact, the indirect relationship between nodes also affects the motion of nodes, but it increases the complexity of the system.

(4) Future work
It is reasonable that two nodes without a direct relationship still can have a close indirect relationship, and can contact frequently through a very close node in common. Hence, the indirect relationship between nodes can be introduced to improve the measurement of relationship and the center value of nodes. On the other hand, the communities may overlap. That is, one node is part of some different communities. For example, a man in real life has a group of classmates, relatives, and colleagues, etc. Therefore, this multi-level hybrid community performs better in forwarding messages and is worthy of further study.

Conclusions
In this paper, we have discussed the application of mHealth based on an adaptive routing Optimization Algorithm in OppNets. To achieve the secure message forwarding, we analyze the relationship between nodes and present the average message forwarding delay as a new metric to select the closely related node as the relay. At the same time, we resort to the improved community structure and ferry nodes, which can be adaptively deployed in the network based on the virtual potential field theory, in order to efficiently transfer messages. In future implementation and application, we will use more practical activities based on different realistic and synthetic traces of node movement to test our point of view. We also plan to explore the relationship between nodes based on big data analysis to study more sophisticated routing schemes.
Author Contributions: W.C. and Z.C. contributed to the study, design and overall coordination of the project. W.C., F.C. was involved in the project implementation and data collection. W.C., Z.C., F.C. contributed to the data analysis, article writing and modification. All the authors checked and approved the final manuscript.