Social Network Community-Discovery Algorithm Based on a Balance Factor
Algorithm 1
: BComd Algorithm 1
Input: Network G(V, E)
Output: All Communities
Step 1: Calculate the of all nodes in the network. Sort the nodes in V in descending order to obtain sequence l.
Step 2: Use the method in Section 3.2 to divide the nodes in the network into two groups. Delete the nodes in group 2 and the edges linked to them from the network; then delete the nodes in group 2 from sequence l.
Step 3: Select the first node s in l as the core node and remove it from sequence l. At this point, there is only node s in community C. Add () to W.
Step 4: For each node in W, calculate its ∆Q for the scenario in which it joins community C.
Step 5: Select neighbor with the maximum ∆Q from W and calculate its adaptability. a. If the adaptability is positive, add node to community C and remove it from both W and sequence l. . For node z, which was previously in W, we do not need to recalculate its ∆Q but simply update it according to the following equations:
For those nodes newly added to W, calculate their ∆Q. b. If the adaptability is negative, remove node from W.
Repeat Step 5 until there are no nodes in W. At this point, the detection of community C is finished.
Step 6: Go back to Step 3 and repeat the following steps until there are no nodes in sequence l.
Step 7: Add the nodes and edges deleted in Step 2 back to the network. At this point, the network consists of two parts: one with the previously deleted nodes and the other with the multiple communities that have been detected. We treated each previously deleted node as a community with only one node.
Step 8: Compress each community into a single node. The link weights between the new nodes are derived from the sum of the link weights between the nodes in the corresponding two communities. The links between nodes in the same community lead to a self-loop of that community in the new network. The new network is clustered using the Louvain algorithm.
Step 9: Execute the Community Integration Strategy.