## 3 System Model Design
### Complexity Analysis of this Algorithm  
In summary, we propose an algorithm that utilizes an efficient data transmission strategy for mobile and social similarity in opportunistic social networks. To improve the understanding of the algorithm, the general steps of data transmission in the MSSN algorithm are divided into the following four steps:  
1. In the information gathering stage of the algorithm, we build a sequence of information by preparing the data information collection and update in the previous stage, which contains the data information needed later. In order to provide accurate and timely data, our information sequence needs to be constantly integrated integration.
2. Secondly, based on the collected information sequence, the mobile node's mobile similarity is calculated by the neighbor nodes of the node and the movement trajectory of the node. Then, the node range is reduced by a single threshold, leaving nodes with similar similarity and deleting nodes with similar similarity.  
Figure 3: Model diagram of message forwarding strategy in opportunistic social networks.  
In the algorithm, we calculate the distance between social attributes by the Minkowski distance and VDM distance in the clustering algorithm. According to the larger the distance, the smaller the similarity between social attributes, mark each node.
4. Finally, we take the appropriate relay node by the average method, calculate the average value by the distance of the social attribute, and take the node below the average value as the relay node. The purpose of this is that the message is not easy to be lost. Through this mechanism, the security and continuity of the message transmission of the opportunistic social networks is guaranteed.  
According to the four steps mentioned above, in the preparation phase, each node should update the encounter state matrix in time, in addition to sharing its own state sequence. The time complexity of this phase is \(O(\log_{2}n)\). The time complexity of computing node motion similarity and narrowing the node range by a single threshold is \(O(n)\). The algorithm complexity related to the social attribute distance calculation between destination and neighbor nodes is \(O(n)\). Finally, by taking the average of all distances, the distance node below the average is used as the relay node, and the time complexity of the process is \(O(n)\). Through the rigorous analysis of each step, the overall time complexity of the MSSN algorithm is \(O(n)\).  
```
Input: Message carrier \(node_{x}\) and its neighbor nodes sequence \(<node_{1},node_{2},\ldots,node_{n}>\) And the encounter matrix \(M(n)\) of each node Output: the relay node \(node_{m}\)
```  
**Begin**  
Node classification:  
**For** (\(a=1\); \(a\leq n\); \(a++\))  
If (\(node_{a}\) and \(node_{b}\) meet);  
Collect and update matrix \(M(n)\);  
**End for**  
Matrix \(M(n)\) gets a complete update, obtaining the relationship matrix of all nodes and the corresponding number of nodes:  
**For** (i = 1; i \(<=\) n; i++)  
Calculating the mobile similarity of nodes:  
\(MNS=\delta N\_similarity+\mu M\_similarity\);  
**If** (\(Q_{\text{MSN}}>Threshold\)) then  
Reserve the node L;  
**Else**  
Delete the node D;  
**End for**  
**For** (i = 1; i \(<=\) n; i++)  
Calculating the social attribute distance of the remaining nodes  
\(Weig\_MinkV(S\_attr_{u},S\_attr_{v})\)  
**End for**  
Calculate the average of the distances between all nodes: \(Arg_{node}\);  
**For** (i = 1; i \(<=\) n; i++)  
**If** (\(Weig\_MinkV(S\_attr_{u},S\_attr_{v})\)\(<\)\(Arg_{node}\)) then  
Output relay node \(node_{m}\)  
**End for**  
Forwarding messages:  
\(node_{x}\) synthesizes all the calculation results to obtain the reliable relay node \(node_{m}\);  
\(node_{x}\) forwards the messages to \(node_{m}\);  
**End**