A Relay Selection Algorithm Based on User Trust Degree for D2D Communications

. The emergence of 5G has promoted the rapid development of the Internet of Things(IOT), the dramatic increasing of mobile equipment has led to the increasing shortage of spectrum resources , D2D(Device-to-Device) communication technology is widely concerned for its ability to improve the utilization of spectrum resources. In order to expand the communication scope, relay nodes are introduced into D2D communications , as the third party of D2D relay communication, the quality of relay nodes directly affects the quality of communication process. In order to make more users willing to participate in relay communication, social relationship is introduced into D2D relay communication, How-ever, as an explicit relationship between people, the function of social relationship in D2D communication is limited by the mobility of users and the variability of communication scenarios. In order to find a more reliable relay node and upgrade the connection success rate of D2D relay communication, implicit social relationship between the users need to be mined. Aiming at that, user trust degree (UTD) is established in this paper. By combining the explicit relationship which is called the social connectivity degree with the implicit social relationship called the interest similarity degree, and considering the user’s movement, a relay selection algorithm is presented to help sender find a relay node with a deeper user trust, which can increase the user’s willingness to participate in D2D relay communication and upgrade the success rate of communication connection, so this algorithm can ensure the security of the relay node and can improve the throughput performance. Simulation results show that this algorithm can increase the success rate of connection, improve the overall throughput of the system and improve the user's communication experience.

the user to communicate directly by multiplexing the spectrum resources of a cellular user. Introducing D2D communication into cellular network can reduce communication delay, improve spectrum efficiency and improve user experience. However, communication distance limits the application scope of D2D communication. Adding relay nodes in D2D communication can expand its application scope and improve the success rate of connection establishment [2][3][4]. Due to the introduction of relay nodes, D2D communication changes from one-hop communication to multi-hop communication, but the reliability of the relay node directly affects the success rate of communication connection, in order to enhance the communication security and ensure that the communication process can be established normally, some researchers quantify social relationship between people to find a relay node which has a stronger willingness to participate in D2D relay communication. [5][6][7][8][9][10].
In recent years, there have been numerous studies on D2D relay selection based on social relationship. Literature [11] proposed a D2D relay selection algorithm under fog community, considered relay selection under different social environments, which improved the transmission success rate and reduced the transmission delay. Similarly, literature [12] comprehensively considered several communication conditions, through capability assessment and social relationship assessment, an algorithm based on Bayesian probability formula has been proposed to help sender make final trust point decision.
Literature [13] proposed a coalitional game-theoretic framework, and leverage two key social phenomena to promote efficient cooperation among devices, the proposed mechanism can achieve significant performance gain. Literature [14] proposed an innovative social-aware energy-efficient relay selection mechanism that considered the hidden social ties among mobile users to ensure that more users are willing to participate in the cooperative communications, which achieved a significant performance gain.
In most of the studies above, some social attributes are introduced to improve the quality of relay nodes, such as social relationship assessment and social ties, these methods quantified the social relationship between users and enhanced the efficiency of finding relay nodes. However, these studies only considered some specific social attributes in a single scenario and ignored the fact that the selected relay node may not be the best relay node for D2D users. It is obvious that social attributes are helpful to find reliable relay nodes, the relay nodes found through social relationship are more likely to interact with the sender, so the connection establishment success rate of D2D relay communication is higher, but people are constantly moving, a user in a single day will arrive in many different location, the social relationship change quickly, those who only consider one single social relationship are difficult to ensure the connection success rate and can not guarantee the security of communication, for example, when a user takes convenient transportation like subway, he may be in a weak social relationship scenario for a short time, at this time, as an explicit relationship between people, considering social relationship alone cannot adapt to the complexity of communication scenario and it's hard to find a suitable relay node to establish the relay connection, when the sender is in a weak social relationship scenario, D2D communication will encounter the cold start problem and it may be difficult to find a relay node and establish a relay communication in a short time.
Based on the above questions, we take into account the real life scenario, first, we consider the mobility limitation of the relay node, introducing the explicit social relationship-social connectivity degree to quantify the social relationships between the sender and the relay node, then we consider that people are often connected because they have certain common interests, and we introduce an attribute called the interest similarity degree, and divided it into long-term interest and short-term interest to exploit the hidden social connections between the sender and the relay node, hence, we can find the deep connection between the sender and the relay node, , finally, the utility function of UTD is formed by combining the social connectivity degree and the interest similarity degree. This algorithm is more suitable for real scenarios and can solve the cold start problem, therefore can ensure the throughput performance of communication process and upgrade the connection success rate of D2D relay communication.
The rest of this paper is organized as follows. The section Ⅱ introduces the system model, the relay selection algorithm based on UTD combined with the user mobility is proposed in section Ⅲ, the performance analysis is shown in section Ⅳ. the simulation results and the analysis of UTD algorithm performance are given in section Ⅴ, Finally, the conclusion is given in Section Ⅵ.

System model
In the D2D communication system, when the channel condition is not good so that the single-hop communication cannot be carried out or the communication distance is too far to establish the normal single-hop communication, multi-hop D2D communication can be used to complete the communication process, one or more relay nodes need to be selected at this time. The D2D relay selection system model is shown in Fig.1. At this moment, cellular communication and D2D communication are simultaneously carried out, so the D2D receiver will receive the same frequency interference from other cellular transmitters, interference analysis will be described in Section Ⅳ. When the distance between the sender i u and the relay node i r is too far or the channel condition is insufficient to support this direct D2D communication, the sender can choose the D2D relay communication to increase the number of communication hops and meet the communication quality. Several D2D users can reuse one cellular user's spectrum, but in order to control the D2D user's interference to the cellular user, we should fully consider the number of D2D users who reuse the spectrum resources of the cellular user and evaluate the channel condition, ensuring that D2D relay communication should be carried out without affecting the normal communication of the cellular user.

A Relay Selection Algorithm Based on UTD
To enhance the success rate of D2D communication connection, and to improve the data transmission rate, this paper propose two social relationship factor called the social connectivity degree and the interest similarity degree, and considering the user mobility, to build the utility function of UTD between user, finally we propose a relay selection algorithm based on UTD, which will help sender to find a relay node to forward data in a higher transmission rate, and make sure that the connection is established successfully and guarantee the safety of the communication process.

User Mobility
Mobile terminals are carried by people, who move constantly, and their position are in constant change, if the distance between the relay node and the sender is too far, the transmission rate of communication may cannot be guaranteed. In order to ensure the communication quality is within the lowest acceptable range, we consider the limited communication range of D2D communication, the concept of user mobility is introduced in this paper, the user is regarded as a node that is constantly moving, its moving distance is limited to an acceptable minimum communication distance to ensure the minimum data transmission rate, then we can obtain the relay node set after the user mobility screening. According to Literature [15], In a circle with the maximum communication distance as the radius, the sender is at the central point (0, 0) , relay node is located at ( , ) Using R denotes the threshold of movement distance limitation, the communication distance should be satisfy ur d < R and rs d < R . Using t denotes the communication time, v denotes the movement speed of the relay user, the motion angle is a random value θ . After time t , the relay node is located at ( cos , sin ) ur d denotes the distance between the relay user and the D2D sender. 2 2 ' cos sin ( Similarly, ' rs d denotes the distance between the relay user and the D2D receiver.
Relay user that satisfy ' are put into candidate set G1. So far, all users in the candidate set G1 can satisfy the requirement of the minimum communication distance. However, many of the nodes in the current candidate set are strange nodes, they are less willing to participate in relay communication, those relay nodes are rational, it is bound to consider their own profits, if choose these nodes as the relay node, the connection success rate will be lower and may cannot guarantee the transmission rate. So in the next step, we introduce the social connectivity degree and the interest similarity degree, by combining these two factors, we build the utility function of UTD, then we propose an algorithm based on UTD to find the relay node which has certain social relations with the sender, the relay node found by this algorithm have a strong social trust with the sender, hence, UTD algorithm can improve the success rate of connection establishment, and improve the throughput performance.

Social Connectivity Degree
Since the smart phones penetrating into all aspects of life, people can communicate anytime and anywhere and forming the mobile social networks, which especially show the characteristics of "social" and "interaction". The social relationship between people is always having the feature of stability, periodicity and regularity. A large amount of social information can be utilized in D2D relay selection algorithm, which is conducive to finding the better relay node. D2D communication in mobile networks is different from other wireless networks because mobile devices are carried by people, a mobile user has full control over his device, it is the user, not the device, that decides whether to participate in D2D cooperative communication. In other wireless networks, such as sensor networks or mesh networks, it is assumed that the device is willing to help each other to forward the data, by contrast, the relay node in D2D communication is a person with an independent mind, so it is important to understand whether he is willing to participate in D2D relay communication.
Assuming that there are N relay nodes around sender i u who needs D2D relay communication, and form a set ) denotes the relay node, and the D2D receiver is i s . An undirected weighted graph is ( ) , which represents the social relationship model between the sender i u and the relay node i r . At the same time, vertex set is As shown in Fig.2, when the sender i u want to establish the D2D relay communication, considering the social connectivity degree and interest similarity degree in social networks, and considering the user's mobility limitation in mobile networks, then find the best rely node.

Fig. 2 D2D Relay communication
When the communication distance is beyond the maximum communication distance or the channel conditions is so poor that we can't establish connection, introducing relay communication is helpful to improve the system throughput and the success rate of connection establishment, for the sender i u , most of the relay nodes in its communication range are strangers, and those relay nodes are rational, so before they make a decision, they will consider their equipment privacy security and battery remaining capacity and reluctant to join relay communications process, which results in a low success rate of connection establishment. To solve this problem, we consider the social relationship between users and hope to find a relay node which have a certain relationship with the sender, due to the interactive characteristics of the social network, those relay nodes are often more willing to participate in relay communications, so the success rate of connection establishment and system throughput can be effectively improved. We present a factor called social connectivity degree which is used to represent the strength of social relationship between the sender i u and the relay node i r . Firstly, social connectivity degree is defined based on WeChat communication data or mobile phone communication data. In this paper, social connectivity degree between people is quantified from two perspectives, which are the contact factor and the interaction factor. In reality, a person who often contacts with sender i u may be a sales person or an e-commerce person, although this kind of people often contact with this user, they do not have a relatively stable social relationship with the sender, in order to avoid the inclusion of such people in the candidate set G1, we define the contact time , which is used to ensure that there is indeed a close social relationship between the two users, In the observation time ρ , if contact time is larger than the minimum contact time , we assume that there is social relationship between two users, and use ( ) can be written:

Social Network
Where 1 σ denotes the scale parameter of the contact time between the sender i u and the relay node i r , which can be set according to the actual situation. The contact factor reflects the intimacy degree between two users.
Second, we consider the interaction factor between people, assuming that the sender i u and the relay node i r have some common friends, they will have certain social relationship, the interactive factors reflect the depth of the relationship between the two users. Therefore, we define the common friends number proportion between the sender i u and the relay node i r , Where (1 ) the deepest contact as the relay node. If there are no close friends within the current communication range, we set 1 0 β = to find the relay node in the old social circle which has the most common friends with the sender as the relay node, it can still ensure that the relay node we found has a strong social relationship with the sender. In addition, if the relationship between the relay user and the sender is not clear, two factors can be considered comprehensively, and we can set 1 0.5 β = .

Interest similarity degree
As an explicit relationship between users, social relationship is helpful to find relay users in certain situations such as cluster network, but social relationship alone is not enough to deal with the change of the dynamic and complex scenarios. When the sender is in a strange environment, the sender i u may not able to find a relay user who have social relationship with him, in order to solve the cold boot problem, this paper proposes the interest similarity degree and divides it into long-term interest similarity and shortterm interest similarity, then, use it to mining the implicit social relationship. The interest similarity degree helps sender to find a reliable relay node in communication scenarios with weak social relationship. In real life, those with similar interest tend to be more interested in what is being transmitted to each other, and are more willing to participate in relay communications, hence, it can upgrade the connection success rate and ensure the safety of communication process. Assuming 1, 0, Short-term interest also affects user similarity, this paper introduces three parameters which based on the analysis of interaction of mobile social network information similarity in content to define short-term interest between users, including release information similarity, user comment information similarity and user forward information similarity. Finally, sum three parameters and build the short-term interest equation.
First, assuming the release information subject sets of the sender i u and the relay node i r are { } respectively, then the release information similarity between the sender i u and the relay node i r can be denoted as follows: This paper use edit distance ( ) i j dis t t to measure the user's comment information similarity, which can not only calculate the similarity degree between string, but also can evaluate the similarity degree of natural language, when the comment of the sender i u and the relay node i r are more similar, the short-term interest similarity is larger. Second, the comment content similarity between and the relay node i r is shown in Eq. (15). Similarly, the forward content similarity is also measured by editing distance, then the forward content similarity between the sender i u and the relay node i r can be denoted: ) is the weight, which can be adjusted according to different communication scenarios. In the actual communication process, user doesn't necessarily comment or forward certain things. Therefore, when the network information of users cannot be obtained, we assume that the location where users go is the point they are interested in. At this time, we set 2 1 β = . Second, if the user does not open the location service but we can obtain the user's network information, we set 2 0 β = to analyze the user's interest from the content, comment and forward information. Finally, if the user's location information and network information can be obtained both, we set 2 0.5 β = to comprehensively analyze the user's interest similarity. Finally, we are able to find the relay node which has the greatest interest similarity degree to the sender

The Utility Function UTD
Combined with the social connectivity degree and the interest similarity degree between users, this paper defines UTD as an indicator to measure the similarity between the sender i u and the relay node i r . The higher trust degree between sender and relay node, the larger possibility of establishing communication and the higher throughput performance. The utility function is the weight, which can be adjusted according to different communication scenarios. As a parameter that can directly evaluate interpersonal relationship, social relationship should be placed in the first place. Therefore, in the scenario with clear social relationship, we set 3 1 β = to find the node with the deepest social contact with the sender. If sender in a situation where the social relationship is not clear, we can comprehensively consider the two factors, and set 3 0.5 β = ,besides, if sender is in a strange place, there is basically no node having social relationship with the sender, so we set 3 0 β = to find the explicit relationship between users and find the node which have the greatest interest similarity with sender to establish relay communication. So far, we introduced the social connectivity degree and interest similarity degree to measure the UTD, and constructed the utility function of UTD, after the user mobility screening, we get the candidate set G1, then we set UTD threshold value, this paper set it as 0.3, and get the candidate set G2. The specific value can be adjusted according to the actual communication scenario, if there are many selectable nodes in the G2 candidate set and most relay nodes have strong social relationship with the sender, we can increase the threshold value of the utility function and reduce the number of nodes to find a relay node with larger UTD, relay node found in this way will have a higher willingness to participate in the relay communication. Hence, this algorithm can improve the success rate of the communication connection and can improve overall system throughput.

Performance analysis
Assuming that there is no interference between D2D users, the specific situation is shown in Fig.2, dotted line represents the interference from other CUE sender, the solid line represents two users are communicating.

Fig. 3 Interference between cellular users and D2D users
The path loss from the sender i u and the relay node i r is defined as: PL is the reference path loss of near distance communication, When user choose D2D relay communication, decoding and forwarding (DF) mechanism is adopted. When the sender i u sends a relay request, real-time information of the nearby relay node is obtained through base station BS, which contains the social connectivity degree and interest similarity degree of this relay node, the SINR on the link of the relay node i r can be expressed as: Similarly, the SINR on the link of the relay node i s can be expressed as: According to the characteristic of relay communication, the system capacity is determined by the minimum throughput of all hops, and the data transmission rate of D2D relay communication is obtained as follows: Hence, the optimal performance and detection time should be considered comprehensively. Assuming that the D2D user's communication time is T , the time cost of detecting a relay node is set for a fixed value τ , the effective throughput n X when detecting the nth relay node can be denoted by where nτ denotes the total time cost needed to detect a total of n relay nodes, T nτ − denotes the effective communication time of D2D users, hence the effective throughput of the system can be denoted as follows: Y denotes the minimum throughput threshold, If the system's effective throughput e Y is larger than the minimum throughput threshold min Y , It indicates that D2D communication has been successfully established. Assuming that the total number of probes is p N , the number of successful probes is S N , then, the success rate of connection can be denoted as follow: Simulation result

System parameters
Assuming that all users are randomly distributed within the coverage range of a macro cell, considering the interference between cellular users and D2D users, the bandwidth is assigned to the relay user by the base station according to the UTD and the specific indexes are set according to actual situation in reality. The main parameters of simulation are listed in Table 1.

Pseudocode
A Relay Selection Algorithm Based on UTD 1: Set basic communication parameters 2: If the relay node i r is still in the communication range after moving in time t Get the candidate set G1 end 3: Set the weights 1 β ， 2 β to get the social connectivity degree and interest similarity degree 4: Set the weight 3 β to get the utility function of user similarity degree 5: Set UTD threshold Get the candidate set G2 6:Rset the user trust threshold, reduce the number of nodes, find the optimal relay node end 5.3

Analysis of simulation results
This part will illustrate the performance of the UTD algorithm, and we demonstrate the simulation results based on MATLAB software. By comparing the UTD relay selection algorithm with the single social relationship algorithm, it is proved that the throughput and the connection success rate of the UTD algorithm are relatively excellent. The main performance indexes include the system throughput, the success rate of communication connection establishment, the CDF of throughput and connection setup time, and the influence of weights on throughput.
(a) (b) Fig. 4 Throughput of the D2D receiver Fig.4 shows the change of throughput of the D2D receiver. Part (a) shows the throughput of the D2D receiver with the communication distance between 50m and 100m, With the increase of distance, the performance of the UTD algorithm proposed in this paper is better than the single social relationship algorithm, because the UTD algorithm takes into account the implicit social relationship between people-the interest similarity degree, which can help the D2D sender to find more reliable relay nodes within the same distance range, they are willing to participate in relay communications and more willing to help the sender to complete the data transmission, so result in a higher transmission rate. part (b) shows the change of throughput of D2D receiver with the number of relay nodes between 100 to1000, the social circle of the sender is in a limited range, we can see that with the increase of the number of relay nodes, the number of strange nodes will increase, and the total number of interest point will also increase, therefore, the difficulty of the node search will be increased too, leading to a decreasing trend of throughput, it can be seen from the figure that the performance of the UTD algorithm proposed in this paper is better than the single social relationship algorithm, this is because the nodes found by the UTD algorithm have deeper social trust degree, therefore, the relay node will try its best to provide the D2D receiver with higher transmission rates.  Fig. 5 shows the success rate of D2D communication connection establishment under different number of relay nodes. It can be seen that the connection success rate of the UTD algorithm is greater than the single social relationship algorithm in the number of relay nodes from 500 to 900. This is because the UTD algorithm can find more reliable relay nodes and these nodes are more likely to ensure the efficiency of communication process, by mining social trust and common interests among users, the UTD algorithm ensures the stability of relay nodes and upgrades the connection success rate.
(a) (b) Fig. 6 Connection success rate in different transmission distance Similarly, Fig. 6 shows the success rate of the D2D communication connection establishment under different transmission distance, the success rate of both the UTD algorithm and the single social relationship algorithm decreases with the increase of communication distance, compared to a single social relationship between algorithm, the algorithm of the UTD in transmission distance from 100 to 140 meters can keep a high success rate of connection establishment, this is because by mining the implicit social relationship between the user, the UTD algorithm can expand the social circle of the sender and can find more nodes within the same communication distance that can successfully establish the relay communication.  Fig. 7 shows two CDF graphs, in which the part (a) is the CDF curve for throughput, part (b) is the CDF curve of detection time, we can see that the performance of the UTD algorithm is better than the single social relationship algorithm, it has higher throughput and lower connection setup time, this is because the relay node found by UTD algorithm has a strong social trust with the sender, and this node has strong relay willingness and high security, hence the connection setup time and throughput performance are more outstanding.
(a) (b) Fig. 8 The influence of β in throughput Fig. 8 shows the influence of parameter β on system throughput under different number of relay nodes and different communication distance. In this paper, we set three different Values of β , β =0, β =0.5, and β =1.When β = 0, it means that we only consider the social connectivity degree between the user and don't seek the interest similarity degree between users, thus get the green curve, when β = 1, it means that we only consider the interest similarity degree between users, not considering the social connectivity degree between user and get the blue curve, when β = 0.5, it means that we consider both the social connectivity degree and the interest similarity degree between users and get the red curve. It can be seen that when β =0.5, the performance of the system is better, this is because when β =0.5, the UTD algorithm can comprehensive consider the explicit and the implicit social relationship between users, then find a relay node which has a deeper UTD between the sender, hence upgrade the security and quality of communication process.

Conclusion
In D2D relay communication, choosing the best stable relay user is an important way to improve the quality of D2D relay communication. The UTD algorithm combines the social connectivity degree and the interest similarity degree, and introduces the concept of the UTD, considering two aspects of relationship, which are the explicit relationship and the implicit relationship, so the UTD algorithm can adapt to the complex change of modern communication scenario. The UTD algorithm can quickly find the optimal relay user, reducing the detection time, and not only upgrade the connection success rate, but also improve the overall throughput of the system.