Here we detail the three functions implemented in the PeerAgent class and explain the i-Search Mechanism used in the Relationship Finding() function.
3.1 The Update Tvalue() function and Update FriendList() function
The execution of the Update Tvalue() function is initiated by a user i and first it calls the mAsyncRunner.request in the Facebook Graph API to retrieve the JSON object [8], which contains the user i’s Facebook information. We define three parameters Nm,u, Nr,u, and Nl,uwhere Nm,udenotes “the total number of message that a friend u posts on i’s wall”, Nr,u denotes “the total number of message that a friend u replies to i”, and Nl,u denotes
13
14 CHAPTER 3. THE THREE FUNCTIONS IN THE PEERAGENT CLASS
“the total number of “Likes” a friend u gives to i”. The FeedRequestListener class parses the JSON object to obtain the three parameters Nm,u, Nr,u, and Nl,u.
Let Ti,u denote the T value that a user i gives to his friend u. We define the T value calculation function as
The concept of the T value calculation function is from the study [15]. The T value calculation function in the study is used in e-commerce communities and they computes the trust value of a peer u (i.e., a user) by a weighted average of the degree of satisfaction u receives for each transaction. We apply this concept to our P2P-iSN work and design
a similar equation (3.1). We take the parameters (i.e., Nm, Ne, and Nl) of a user’s SNS information which contains the interaction information with friends, and weight these parameters to derive an average interaction score that represent the trust value of the friend.
The Update FriendList() function is invoked by a user and it sends a list of friend’s ID to the Index Peer through the BackgroundService class. The Index Peer returns the IDs which are found in the GlobalID List. These IDs indicate which friends are online.
After receiving these IDs, the “Online” field of the corresponding IDs in the Friend List are set to “On”, while the others are set to “Off”. We use the “Polling” concept to update
3.2. I-SEARCH MECHANISM 15 the Friend List, which is mean that, we do not update the Friend List when user is online or offline because this will enhance Index Peer node overhead.
3.2 i-Search Mechanism
In this chapter, we propose an i-Search mechanism to find a social path between two Peer nodes in P2P-iSN. Though searching in a social graph has been studied in the previous works [16], most of these studies considered a centralized searching, that is, a social graph is well maintained in a central node. Fewer studies have addressed searching in a P2P social network, which is the main focus of this paper.
The concept of the i-Search mechanism is similar to the flooding search that has been widely adopted in the large network studies (e.g., [2]). To convey this social path, we define that a global relationship exists between user 1 and user L + 1. We propose a function Z(P) to measure the strength of the global relationship between user 1 and user L + 1, which is defined by
The i-Search mechanism establishes the social path link by link. When a link is added into a path, global relationship strength is calculated for the new path using the Z(·) function in (3.2). If the global relationship strength for the new path is below a threshold
16 CHAPTER 3. THE THREE FUNCTIONS IN THE PEERAGENT CLASS
∆, the establishment of the social path stops.
Note that ∆ is used to guarantee that the global relationship strength for the con-structed path is strong enough so that users are motivated to use the global social rela-tionship for further SNS applications. We set up ∆ based on the research results in the sociology study [13]. As mentioned in [13], on average, the Ti,jis0.5. If we consider a path P with length|P| = 4, then using the Z(·) function in (3.2), the global relationship strength for the path is Z(P) = 0.54 = 0.0625, which is considered a very weak relation-ship. Therefore, in the performance study later, we set ∆ = 0.53 = 0.125. In other words, it is likely that the social path (searched by the i-Search mechanism) has path length no larger than 3. As mentioned in [9], with path length no larger than 3, the flooding search is considered with low complexity. This is the main reason why we use the flooding search.
Details of the i-Search mechanism are given below: The Index Peer node maintains the online status (including the ID and IP address of the Peer node) for the online Peer nodes. A friend list is maintained in the Peer node, which stores the online information for all friends of the Peer node. To simplify our description, we use “the friend b of a Peer node a” to imply that the social link a→ b exits.
When a Peer node is turned on, it reports its online status to the Index Peer node, and receives the latest online status for his friends from the Index Peer node. With the latest online information, the Peer node can determine whether his friend is online (i.e., a Peer node is turned on). A online Peer node can communicate with his online friends directly. We run a recursive algorithm, the iSearch algorithm, in the Peer node as shown in Algorithm 1. In this algorithm, the set G is the friend list of a Peer node. The input
3.2. I-SEARCH MECHANISM 17 parameter s stores the ID of the Peer node who calls the iSearch algorithm, and r is the ID of the Peer node to be searched. Initially, we set P← ∅.
Algorithm 1: iSearch
Consider the scenario where the Peer node a searches the Peer node d. A user a can
“request” his friend b to execute the iSearch algorithm (i.e., b.iSearch() in Algorithm 1) through the direct communication if b is online. That is, the directional social path P is established along the online Peer nodes.
Note that the i-Search mechanism may find multiple global social relationships be-tween two Peer nodes. For the Peer node who triggers the i-Search mechanism, he can
18 CHAPTER 3. THE THREE FUNCTIONS IN THE PEERAGENT CLASS use the one with the largest global social relationship strength. Furthermore, we can speed up the execution of the i-Search mechanism by caching the searching results on the Peer nodes. To simply our discussion, we do not include the study for the effects of the cache in this paper.