A Dynamic Trust Relations-Based Friend Recommendation Algorithm in Social Network Systems

: A discovered algorithm based on the dynamic trust relations of users in a social network system (SNS) was proposed aiming at getting useful information more efficiently in an SNS. The proposed dynamic model combined the interests and trust relations of users to explore their good friends for recommendations. First, the network based on the interests and trust relations of users was set up. Second, the temporal factor was added to the model, then a dynamic model of the degree of the interest and trust relations of the users was calculated. Lastly, the similarities among the users were measured via this dynamic model, and the recommendation list of good friends was achieved. Results showed that the proposed algorithm effectively described the changes in the interest similarities and trust relations of users with time, and the recommended result was more accurate and effective than the traditional ones.


INTRODUCTION
The advent of Web2.0 allowed social networking services (SNS) to gradually penetrate the lives of people.The "37 th Statistical Report on Internet Development in China" released by the China Internet Network Information Center (CNNIC) in January 2016 shows that, as of December 2015, the number of Internet users in China reached 688 million, the Internet penetration rate was 50.3%, and the user base of instant messaging was 624 million.Moreover, in the comprehensive social networking domain, the typical applications are QQ Zone and Weibo, which are each utilized by 65.1% and 33.5% of Internet users [1].However, in an information explosion era, getting information through trusting friends effectively solves the problem of "information overload".Therefore, it is very important to get information effectively, which can be helped by the recommendations of good friends.The key problem of the present paper was how to effectively help users mine the potential good friends in the social networking service.In the existing recommender systems, the recommendation of friends mainly includes contentbased recommendations, common interest-based recommendations, tag-based recommendations, and network topology-based recommendations [2][3][4][5][6][7].However, these methods do not fully consider the trust relations among users, and the good or trusted user behavior in the SNS plays an important role in decisionmaking.Studies show that, when compared with family members, friends have a more far-reaching impact on user behavior and development.The trust relations among friends are important for improving the recommended system performance [8,9].Therefore, in the recommender systems, further improving the recommendation accuracy via the trust relations among users is possible.The recommendations based on social relations are superior to simple content-matching recommendations [10].Li, Y. et al. proposes a personalized social recommendation system based on social relations and recommendation trust [11].Forsati, R. et al. propose a matrix factorization-based model for social rating network recommendations [12].Costa, G. et al. propose a model of Bayesian probabilistic recommendations [13].Ye, M. et al. present a probability model based on social influence selection [14].While the above-mentioned research incorporated the user trust relationship into the friend recommendation model, they did not account for the effect of different trust relations among users regarding the recommendation result accuracy; furthermore, in the SNS recommender systems, social relations among users will change with time.Therefore, user-trusted friends are in a dynamic state.
Aiming at these problems, a trusted network based on the interest and trust relations of users was designed and constructed.The temporal factor was added to the interest and trust relations of users.A dynamic model of interest degree and trust relations of users was built to achieve friend recommendations.

RELATED WORKS 2.1 Definition of Trust
Definition of trust in SNS: the subjective expectation of users of future behavior based on the historical interactive experiences with other users [15].Currently, two methods exist to express trust at home and abroad [16,17].The first is the Discrete digital value method.One stands for fully trusted, 0 for cannot be completely trusted.While it is simple, it cannot completely simulate the real world.The second is the Continuous analog quantity method.The change interval of the analog value is [0, 1], representing the degree of trust that the behavior of other users can cause the target user to tend to trust.It is a more realistic simulation of trust relations in the real world; however, it makes the analog calculation relatively complex.A continuous analog quantity representation was utilized in this paper by analyzing the advantages and disadvantages of the two methods.

Trust and Distrust
Considering the two trust factors, including trust and distrust, the trust-based recommendation was divided into two main categories: trust-based recommendations and distrust-based recommendations.In the distrust-based recommendation method, distrust utilization mainly favored filtering the distrust value, and negative relations were more important than positive ones in the social recommendations [18][19][20][21][22][23][24].Therefore, the recommendation based on trust and distrust was utilized in the present paper.

Description of the Trust Relationship
The trust relations among users have different description methods from different perspectives.In the present paper, the following descriptions of trust relations were utilized.
(1) Direct Trust and Indirect Trust The trust relations among users could be divided into two categories from the connecting format: direct trust and indirect trust relationships.Trust value exists between the two users: (1) a single direct trust relationship; (2) a single indirect trust relationship; (3) includes both the direct trust and indirect trust relationships.
(2) Explicit Trust and Implicit Trust The trust relationships among users can be divided into two categories from the implication: explicit trust and implicit trust.No significant overlap [25] exists between users of social relationships and similar users, that is, users who have direct trust relationships do not necessarily have a high degree of interest similarities; for example, the direct trust that exists between users and their parents, yet their interests are not necessarily the same.Based on explicit trust, the explicit trust relations between a user and their neighbors were utilized to predict the target user preferences according to the trusting neighbor preference [26,27].In the explicit trust network, the most important thing is calculating the trust value between the non-adjacent user nodes in the trust network and applying the trust propagation and aggregation rules.The recommendation based on implicit trust is recommending the items liked by the trusted neighbor to the target user via the implicit trust relations [28,29], and trust is formed according to the historical transaction behavior of the system users.The explicit trust value improves the cold start user recommendation accuracy, and the implicit trust value improves the recommendation coverage rate.In the present paper, the explicit trust and implicit trust relations were combined. (

3) Global Trust and Local Trust
The trust relations among users can be divided into global trust and local trust [30].The global trust degree indicates the communal trust activity of the users.The local trust degree shows the difference of preferences between pairs of users, that is, the users with the same preference have strong local trust.Therefore, the global trust and local trust were integrated into the friend recommendation.

User Interest Similarity
Some similarity among users was a prerequisite for making good friend recommendations.Interest similarities among users were calculated, and the main principle was: if the user likes the same items, then it demonstrates a similar interest.The good friend recommendation in SNS was divided into direct recommendation and indirect recommendation.The direct recommendation method was recommending friends who were familiar with each other in real society or have a relationship, but who were not connected in the current social network.The indirect recommendation was achieved via a user-based collaborative filtering method [31,32], which predicted whether or not a user had a similar degree of interest with another user by calculating the similarity degree of interest of the user to the other user.The indirect recommendation was utilized in the present paper.

MODEL DEVELOPMENT 3.1 Problem Definition
Definition 1. Trust: Trust is a two-tuple T i, j = (TTT, t), where TTT is the trust degree (including explicit trust, implicit trust, and global trust) of user u i and user u j , t refers to a certain time, and The trust graph is a triple G(U, E, T), where U = {u1, u2, ..., um} is a collection of nodes in the graph; E = {e1, e2, ..., em} is a collection of edges in the graph, namely, the relations among users in the social network; and T = {t1, t2, ..., tm} is a collection of weights corresponding to edge E, namely, the collection of trust relations among SNS users.
The definition of the research problem in the present paper was as follows: the user set was assumed to be U = {u1, u2, ..., um}, at time t, the trust of user ui toward user uj is Ti, j = (TTT, t), and predict the Ti, j = (TTT, t'), of user uj at time t'(1 ≤ t ≤ t').

Similarity of Interest
Three methods were utilized to calculate similarity among users: cosine similarity, modified cosine similarity, and Pearson's correlation coefficient similarity.Results showed that the cosine similarity algorithm performed the best, so that algorithm was utilized in the present paper.
User interest similarity: suppose n-dimensional score vectors of user u i and user u j were each i u  and j u  , then the similarity of user u i to user u j : Time weight was considered to add to the user interest similarity calculation.The basic idea of similarity calculation based on time weight: the shorter time interval of the joint conduct of users was the greater the interest weight, and the longer the time interval was, then the smaller the interest weight.The time damping function of user u i and user u j was T k (u i , u j ), and it was expressed as: In Eq. ( 2),     0 1 , wherein k indicated one of the R collections of the joint conduct of the users, when t i = t j the weighted value was biggest.The similarity of user u i and user u j based on time weight T k (u i , u j ) was expressed as: Therefore, the collection of users with similar interests as user u i was obtained as N s = {n 1 , n 2 , ..., n s } ， the collection acted as an expanding node for similar neighbors of the trust network.The first m users constituted the most similar neighbor of the user collection (1 ≤ m ≤ s).

Trust Model
(1) Measurement of Implicit Trust In implicit trust networks, implicit trust relations among users can be mined from historical user data to alleviate data sparsity problems.For example, the grading system of the same item implies trust relations among users; therefore, the rating level of users for the same item could be utilized to measure the implicit trust between the two users.Implicit trust degree T 1 of user u i , u j at time t was expressed as: where denoted the number of same scoring items that both user u i and u j made at time t.If user u j had more scoring than user u i on the same items, then user u j would have a higher trust value than user u i .
(2) Measurement of Explicit Trust In the measurement of explicit trust, the most important things were calculating the trust value between non-adjacent user nodes in the trust network and utilizing the trust propagation and aggregation rules.
 Propagation of trust Research showed that trust transitivity was along a single path, and the trust transfer was conditional.For example, the trust transfer calculation must be conducted in the area of interest of a user; therefore, the recommended result could be of practical value.According to the principle that trust would decay gradually with the propagation path, the trust propagation model in the present paper adopted multiplication operators, that is, it multiplied the trust degree on the trust transfer path.It was assumed that the trust was transitive within the same area of interest, N = {n 1 , n 2 , ..., n s }.The present paper supposed a path length threshold was M, and all of the neighbor nodes within the path length threshold from the source node were calculated [27].
Formal representation of indirect trust transfer in the single path: where N was the neighbor node user u i N = {n 1 , n 2 , ..., n s } of user u i in the same area of interest, PL(u i , u j ) represented the path length from user u i to user u j , which was greater than 1 and less than or equal to the threshold value M.  Aggregation of trust Research showed that more than one trust transfer path between two users exist, so it was also important to calculate the trust from the multipath.Commonly utilized trust aggregation operators include the minimum, maximum, average, weighted sum, weighted average, and other calculation methods.The weighted average method was adopted in the present paper because it gave some of the information a higher weight on the transmission path and its importance could be reflected in the model.
Formal representation of indirect trust aggregation under multipath: where N , was a neighbor node of user, and u i N = {n 1 , n 2 , ..., n s } was in the same area of interest with represented the weight of k transmission paths of indirect contact between user u i and user u j , and PL i (u i , u j ) represented the path length from user u i to user u j , which was less than or equal to the threshold value M. Therefore, the trust degree between two users could be calculated according to the trust propagation under a single path and the multi-path in the trust network.The degree of explicit trust T 2 of user u i , u j at time t was expressed as: where N was a neighbor node of user, u i N = {n 1 , n 2 , ..., n s } was in the same area of interest with user u i , and , , , , represented the degree of explicit trust of user u i and u j at time t.
(3) Measurement of Global Trust In the calculation of the trust value of the target user to the neighboring user, not only should the direct trust (local, implicit) be considered but also the performance of the neighbor user in the system should be considered, namely, the reliability and credibility, that is to say, the global trust.The trust value of the user with greater loyalty in the system should be higher than the user with smaller loyalty.Therefore, the loyalty of user was utilized to represent the global trust; this method was verified effectively in another paper.
Presentation of the loyalty of user i at time t: RFM Behave indicates the participation value of a user; RFM Business denotes the consumption value of a user.
User participation value: wherein the meanings of the respective parameters were as follows: R was the interval of visiting the website the last time; F was the frequency of visiting in the most recent period; M was the number of favorites/label/comments in the most recent period; and α 1 , β 1 , γ 1 were based on the industry background characteristics.User consumption value: wherein the meanings of the respective parameters were as follows: R was the interval of reading/purchasing the last time; F was the frequency of reading/purchasing in the most recent period; M was the number of reading/purchasing in the most recent period; and α 2 , β 2 , γ 2 were based on the industry background characteristics.Degree of explicit trust T 3 of user u j the target user of user u i , at time t was expressed as: where N was a neighbor node of user, u i N = {n 1 , n 2 , ..., n s } was on the same area of interest with user u i , and UL(u j , t) represented the global trust degree of user u j the target user of user u i at time t.
(4) Reconciliation of Trust In summary, the final trust degree of the user u i to user u j at time t was expressed as: , , where T i, j = (TTT, t) indicated the trust degree of user u i toward u j at time t; m i represented weight, 0 T , u u ,t represented explicit trust of user u i toward u j at time t; and   3 i j T , u u ,t represented global trust of user u j , the target user of user u i at time t.

A Hybrid Model of Interest and Trust
Considering the similarity influence in the traditional recommendation algorithm, the harmonic trust on the weight based on the dynamic trust relations was obtained.The final comprehensive weight was determined via the similarity and trust degree.Harmonic average formula to calculate the weight st(u i , u j , t) at time t was utilized and expressed as: The recommendation algorithm would rank the results based on the Eq. ( 13), then take the first k results as the Top-N friend recommendation results to complete the collaborative filtering recommendation based on the dynamic model of interest and trust.

RESEARCH RESULTS AND DISCUSSION 4.1 Key Algorithm
The algorithm was divided into two parts.The first was the calculation of the trust of the users, the core idea of the algorithm was explained in Section 3.2 and Section 3.3.The second part was a collaborative filtering algorithm that combined the interest and trust degrees, and the core idea of the algorithm was explained in detail in Section 3.4.similarity between user u i and user u j cos(Vui, Vuj) cosine angle between vector ui and vector uj simT(u i , u j , t) similarity between user u i and user u j based on time weight; N s collection of similarity of interests of user u i m constituded the collection of the most similar neighbor users (1 ≤ m ≤ s) AM(u i ) number of scoring items of user u i sumAM(u i , u j , t) number of common scoring items of user u i and user u j accept(u i , u j , t) number of same scoring items that the user u i and u j made at time t UL(u j , t) the loyalty of user u j at time t computeT 1 (u i , u j , t) computed implicit trust T 1 of user u i , u j at time t computeT 2 (u i , u j , t) computed explicit trust T 2 of user u i , u j at time t computeT 3 (u i , u j , t) computed total trust T 3 of user u i , u j at time t computeT(u i , u j , t) computed comprehensive trust of user u i , u j at time t

Input:
Datasets: data of all of the users and items in the database.

Output:
T：Final trust degree Algorithm: For u //calculation of the comprehensive trust of user u i toward target user u j ( ) [ ] [ , ]

Output:
Recommand Userlist: list of recommended users.

Related Preparation
(1) Experimental Environment The algorithm was implemented on the JAVA, Windows 7, and 64-bit system platform, with a dual-core 2.93GHz CPU.The Epinions dataset was utilized [33].The data set contained three files:  User rating: contained 841,372 user trust relations (717,667 trust relations and 123,705 untrusted relations).Each trust relationship had a timestamp that ranged from Jan. 10, 2001 to Aug. 12, 2003. Rating: the evaluations of articles by users, including the evaluation records of 755,760 articles by 120,492 users; specifically including score value ranges from 1 to 5, 1 representing not helpful, 5 representing most helpful; recording timestamps. Mc: containing the authors of 1560144 articles and the classification of the articles.The data of 24 consecutive months were collected from the Epinions dataset and were sorted into six-time slices with the same period according to the data timestamp.The period of each time slice was four months.The data of the first five-time slices were the training dataset, and the data of the last time slice was the testing dataset.Also, users whose score records were less than 20 times were filtered out.
(2) Neighbors Selection When implementing the collaborative filtering recommendation algorithm, the similarity and trust degree were also considered.Therefore, the necessity of considering the trust assuming the interest similarity to a certain degree was verified in the present paper, and the selected number of neighbors was determined in the calculation.Therefore, when the number of neighbors was 10, 20, and 30, the comprehensive weight of the interest and trust of the users was calculated and analyzed.The results are shown in Fig. 1.

Figure 1 Interest and trust of users of the comprehensive weight
Fig. 1 shows that the interest and trust of the comprehensive weight of the users were distributed in [0.4-0.8], which proved that the comprehensive weight could differentiate users, and its introduction of interest degree and trust degree into friend recommendations was feasible.Moreover, when the number of neighbors was 30, the distinction degree of the users was more obvious.
(3) Evaluation Standard Prediction accuracy: reflected the ability of the algorithm to recommend a friend to the user.The mean absolute error (MAE) and root-mean-square error (RSME) were defined as follows: where U was the test data set, i u' was the predicted value, and u i was the true value.The smaller the MAE or RMSE was, the higher the prediction accuracy.

Discussion
In the present paper, a recommendation model that the interest and trust relationship of the users dynamically changed with time was proposed, which was denoted as the Dynamic Interest and Trust Algorithm (DIT).The experiment compared DIT with the commonly utilized static collaborative recommendation algorithm Social MF [34] and time-ordered collaborative filtering recommendation algorithm Time SVD ++ [35].
(1) Comparative Analysis of Algorithms Observing the prediction accuracy of different algorithms, the results are shown in Figs. 2 and 3.The MAE and RMSE of each algorithm were lower at NN30 (the number of neighbors was 30) from the Figs. 2 and 3. Since the interest and trust relations of the users changed with time measured by IDT, the prediction accuracy of this algorithm was improved.The interest and trust change of the users with time is shown in Fig. 4, and the comprehensive weight of the interest and trust degree change of the users with time is shown in Fig. 5. Fig. 4 shows that the degree of interest of user X for User A, User B, and User C changed with time.User X had many target users, and User A, User B, and User C were some of them.As shown in the figure, the degree of interest of User X for target User A increased with time, its interest for User B had little change, and the interest decreased with time for User C. Also, the trust degree for the target user showed a similar trend, that is, as time went on, some remained stable, some gradually increased, some gradually reduced, and some showed unstable changes.Therefore, the dynamic changes of interest and trust relations among users were described by the DIT algorithm model.

CONCLUSION
SNS development meant that the recommendation system not only considered the interest of users, but also the trust network formed among users.To describe that interest and trust changes of the user with time, a recommendation algorithm that integrated the dynamic interest and trust relations of users was proposed in the present paper.In this algorithm, the neighbor selection was conducted based on the dynamic interest of the users, and the harmonic weight of implicit trust, explicit trust, and global trust was utilized to measure the trust degree, then the recommendation results were computed based on the dynamic model of the interest and trust relations of the users.Results showed that the algorithm proposed in the present paper could better describe that the degree of interest and trust relations changed with time, and the prediction accuracy was improved with practical value when compared with other related algorithms.

Figure 2 Figure 3
Figure 2 Compared MAE value of the algorithm

Figure 4 Figure 5
Figure 4 Target user degree of interest change with time was a neighbor node of the user, and u i N = {n 1 , n 2 , ..., n s } was in the same area of interest with the user u i and

Table 1
Algorithm 1: Parameter description Parameter Description UserItemPrefTime item, preference, and time feature of users sim(u i , u j )

Table 2
Algorithm 2: Parameter description Parameter Description N s collection of similarity of interest of user u i simT(u i , u j , t) similarity between user u i and user u j based on time weight; T(u i , u j , t) comprehensive trust of user u i toward user u i ; ListP ranking list of interest and trust of target user u j ; ListU ranking list of target user u j Rank(L) rank the list TOP(L, n) get the top n of the list L computeP(u i , u j , t) computed the interest and trust of the target user u j