## 3 System Model Design
### Complexity Analysis of this Algorithm  
In summary, we proposed a fuzzy routing-forwarding algorithm exploiting comprehensive node similarity in opportunistic social networks. Meanwhile, to improve the understanding of the proposed algorithm, concrete steps of the data transmission process in this algorithm are listed as follows:  
1. During the warming-up phase, each node in the network collects its social attributes and mobile information, constructs a state sequence about these collected statistics, and shares the state sequence with others it encounters.
2. Each node begins to calculate the mobile and social similarities with the destination by the updated state sequence. In opportunistic social networks, if there is a node possessing a relatively high social or mobile similarity with the destination, it is more likely to be a friend of that destination or to have a mobile trajectory highly similar to the destination, meaning the node must be a reliable relay node for the data transmission process.  
Figure 5: The selection diagram of the future two-hop nodes.  
According to the Mamdani fuzzy system, each node evaluates the membership degrees of the similarity with other nodes, determines the level of the transmission preference with the destination, and calculates the transmission preference value with the destination.
4. The source node or message carriers make appropriate message delivery decisions by collecting and comparing the transmission preference values from its neighbors and the second hop relay nodes. The message carrier will transmit data packages to its future two-hop nodes which have a higher transmission preference with the destination than its own. Ultimately, data packets are forwarded to the destination node by the feedback mechanism, which is beneficial to keep the continuity and high efficiency of the data transmission in opportunistic social networks.  
For the readability of the FCNS algorithm, we rigorously constructed Algorithm 1 to introduce our proposed algorithm in detail. Specifically, during the warming-up phase, each node shares its state sequence with the other nodes it encounters and updates the encounter status matrix through the obtained state sequences, so the time complexity of this phase is \(O(\log_{2}n)\). Based on the theory of the fuzzy inference system, each node in the network is able to accurately compute the transmission preference values--thus, the time complexity of this process is \(O(n)\). Finally, message carriers collect and compare the transmission preference values from its future two-hop relay nodes, and then make the suitable messages delivery decisions--hence, the time complexity of messages forwarding is \(O(\log n)\). On the whole, through rigorous mathematical analysis, the time complexity of the FCNS algorithm can be computed as \(O(\log_{2}n+n+\log n)=O(n)\). In retrospect, the time complexity of Spray and Wait [30] is \(O(n\log n)\) and the time complexity in the Epidemic routing algorithm [31] is \(O(n)\).  
```
Input: node \(A\), node \(B\), node \(C\) and the destination node \(D\) Output: \(T(A,D)\), \(T(B,D)\) and \(T(C,D)\)
1 Begin
2 The calculation of transmission preferences:
3 Collect enough information about all nodes;
4 If(A.isMessageCarrier())then
5 Give different weights for each sub-vector of the feature vector;
6 Compute \(MS\) and \(SS\) between each node and the destination;
7 For (each membership function of the fuzzifier component) do
8 Compute the membership degrees of mobile and social similarities;
9 End for
10 Determine the level of transmission preferences of the node based on \"If-Then\" rules;
11\(T=fuzzy\ (MS,SS)\);
12 Output \(T\);
13 End if
14 Forwarding messages through the feedback mechanism:
15 If(B.isNeighbor(\(A\)) \(\wedge\) C.isNeighbor(\(B\))) then
16 If(T(B,D) > \(T(A,D)\) \(\wedge\) T(\(C,D)>T(A,D)\)) then
17\(A\) sends data packets to \(B\);
18\(B\) sends data packets to \(C\);
19 End if
20 End if
21 End
```  
**Algorithm 1** The fuzzy routing-forwarding algorithm exploiting comprehensive node similarity