| Input: , |
| Output: |
(1) | Begin |
(2) | Initialize every node as a cluster; |
(3) | Calculate the encounter probability and times of node m and node n in a period of time t; |
(4) | Get Network topology (, , ) |
(5) | Get Social relationship (, , ) |
(6) | //Compute the node similarity |
| First_phase: |
(7) | Initialize (self, nodes, edges): |
(8) | for (i = 0; i ≤ n; i++) |
(9) | self.communities = {n1, n2, n3}; |
(10) | partition = self.first_phase (network); |
(11) | q = q + self.s_in[i]/2l-self.s_tot[i]/2l; |
(12) | End for |
(13) | Compute modularity_gain (self, node, c, k_i_in): |
(14) | return 2 k_m_in - self.s_tot[c] self.k_m[node]/self.m; |
(15) | If (gain > best modularity_gain) |
(16) | best_community = community; |
(17) | best_partition[best_community].append (node); |
(18) | self.communities[node] = best_community; |
(19) | End If |
| Second_phase: |
(20) | for (i = 0; i < partition.length; i++) |
(21) | Self.communities = (nodes, edges); |
(22) | In_order (nodes, edges); |
(23) | If (modularity_gain>0) |
(24) | return C = {C1, C2, ..., Cn}; |
(25) | else |
(26) | return First_phase: |
(27) | End If |
(28) | End for |
(29) | END |