A Parallel Community Detection Algorithm for Big Social Networks

Mining social networks has become an important task in data mining field, which describes users and their roles and relationships in social networks. Processing social networks with graph algorithms is the source for discovering many features. The most important algorithms applied to social networks are community detection algorithms. Communities of social networks are groups of people sharing common interests or activities. DenGraph is one of the density-based algorithms that used to find clusters of arbitrary shapes based on users’ interactions in social networks. However, because of the rapidly growing size of social networks, it is impossible to process a huge graph on a single machine in an acceptable level of execution. In this article, DenGraph algorithm has been redesigned to work in distributed computing environment. We proposed ParaDengraph Algorithm based on Pregel parallel model for large graph processing. Keywords—Data mining; social networks; community detection; distributed computing; Pregel


INTRODUCTION
Social networks have become extremely popular in the last years, and they have important roles in the dissemination of information and innovation.The analysis of such networks attracted more attention in the research area.Social networks are modeled as graphs, also called social graphs.An important property of social networks is that they have communities of entities with strong connections.Communities of social networks are groups of people sharing common interests or activities [1].The typical way to identify communities is graph clustering.
The main techniques of graph clustering are hierarchical clustering, partitioning and density-based clustering.Hierarchical clustering algorithms, such as Newman-Girvan algorithm [2], detect several levels of clusters, where small clusters are included within the large ones.Partitioning algorithms, such as K-mean [3], divide the graph into k clusters, where k is predefined to the algorithm.Density-based algorithms consider a graph as areas of high density (clusters), surrounded by some areas of low density (noise).Not only clusters of arbitrary shape can be discovered, but also outliers and noise [4].This capability makes density-based clustering more appropriate for social networks analysis, since usually there are a very high number of active users, but there is also a high number of users that do not contribute and can result in noise.
DenGraph [5] is a density-based clustering algorithm for community detection in social networks, inspired by the wellknown clustering algorithm for spatial data, DBSCAN [6].The main idea of DenGraph is to find clusters and outliers of weighted social networks, based on the interaction.It requires two parameters: epsilon ε, which is the maximum distance threshold; and η, the minimum number of nodes in the εneighborhood.
However, processing big data such as social networks with millions of vertices and edges by using conventional computation is infeasible, since it is impossible to process a huge graph on a single machine in an acceptable time.Therefore, adapting parallel computing for mining social networks has become an urgent need to address processing massive data.
In this research article, we perform DenGraph algorithm for mining implicit social graphs in distributed environment.Therefore, we propose a parallel density based clustering algorithm for social networks (ParaDengraph) in Pregel [7] model as follows.First, compute the ε-neighborhood to determine core and non-core nodes.Then, generate a new graph of the core nodes.Then, clusters are identified by finding connected components in the core graph.Finally, expand clusters with the non-core nodes.
The article is organized as follows.Section II reviews the related work.ParaDengraph algorithm is then presented in Section III.Finally, ParaDengraph was tested using real social networks, where experiments and evaluation are presented in Sections IV and V.

II. BACKGRAOUND AND RELATED WORK
Density-based algorithms consider a graph as areas of high density (clusters), surrounded by some areas of low density (noise).According to the graph, the algorithm reveals the number of clusters.Not only clusters of arbitrary shape can be discovered, but also outliers and noise.Density-based clustering requires some parameters, and generates clusters such that each cluster is a maximal set of density-connected points.Points that are not contained in any cluster are considered as noise.www.ijacsa.thesai.org

A. DenGraph
Given a graph G = (V,E) consisting of a set of nodes V and a set of weighted undirected edges E, DenGraph [5] algorithm produces clusters {C 1 ,..,C k } and noise nodes, that are not part of any cluster.Other non-noise nodes are either core nodes or border nodes.A node u ∈ V is considered as core node if it has an ε-neighborhood N ε (u)={v ∈ V | ∃(u, v) ∈ E ∧ dist(u, v) ≤ ε} of at least η neighbors (|N ε (u)| ≥ η).A Node that is non-core and connected to at least one core node is considered as border node.A core node along with its border nodes begin a cluster that can be expanded later.
For undirected and weighted graph G = (V, E), the number of interactions between two actors reflects the closeness of them, so the distance between two actors, p and q, is defined as: Where I pq , I qp are the numbers of interactions between actors p and q initiated by p and q, respectively.The actual cluster criterion is based on the concepts: directly densityreachable, density-reachable and density-connected, which are shown in Fig. 1.These three concepts are defined as follows:  Definition 1.Let u, v ∈ V be two nodes.u is directly density-reachable from v within V with respect to ε and η if and only if v is a core node and u is in its εneighborhood, i.e. u ∈ Nε (v).
 Definition 2. Let u, v ∈V be two nodes.u is densityreachable from v within V with respect to ε and η if there is a chain of nodes p 1 , . . ., p n such that p 1 = v, p n = u and for each i = 2, . . .,n it holds that p i is directly density-reachable from p i−1 within V with respect to ε and η.
 Definition 3. Let u, v ∈ V be two nodes.u is densityconnected to v within V with respect to ε and η if and only if there is a node m ∈ V such that u is densityreachable from m and v is density-reachable from m.In general, a set of core and border nodes V C forms a cluster C if each node u ∈ V C is density-connected to each node v ∈ V C .It is usually that an actor in a social network might be part of more than one community.This overlapping was not allowed in the first version of DenGraph algorithm.An extended version, called DenGraph-O, has addressed this drawback by allowing border nodes to belong to more than one cluster and it is described in Table I.

B. Graph Parallel Module: Pregel
Graphs are completely data-driven computations, dictated by vertices and edges structure rather than directly expressed in code.In addition, because of the irregular structure of graph data, scalability can be quite limited by unbalanced computational loads [8].
The Bulk Synchronous Parallel (BSP) model [9] provides the means to design parallel processing algorithms.It addresses the problem of parallelizing tasks across multiple workers by using a message-passing interface (MPI) instead of a shared memory.
Pregel introduced originally by Google [7], addresses distributed processing of large-scale graphs.It is a vertexcentric approach, where user focuses on the local action, processes each item independently, and then the system processes all actions on the large dataset.Select a u ∈ V that is not yet labeled 4.
If u is core vertex then 6.
A new cluster id is generated 7.
u is assigned to the cluster and labeled as "core vertex" 8.
The new id is added to list of cluster-ids for all v 10.
All v are pushed on a stack 11.Repeat 12.
Pop the top vertex v of the stack 13.
Compute the ε-neighborhood of v 14.
If v is core vertex then 15.
Add new cluster-id to list of n 18.
Push n on the stack 20.End 21.
Until (the stack is empty) 23.
If u is not labeled then 25.
End 27.Until (all vertices in V are labeled) 28.End The basic idea is that each node of the graph corresponds to a task.The node generates output messages that are destined for other nodes, and then each node processes the inputs it receives.This computation consists of a sequence of iterations, www.ijacsa.thesai.orgcalled super-steps.During each super-step, the framework in parallel invokes a user-defined function for each vertex.

III. PARADENGRAPH
In this section, we present a parallel density based community detection algorithm in social networks based on Pregel parallel model (ParaDengraph).Given two real parameter ε and η, and undirected weighted graph represented in adjacency lists, ParaDengraph finds clusters and any possible overlapping or noise.
ParaDengraph works as follows: Firstly, cut off the edges with distance more than ε to compute the ε-neighborhood Nε(u) for each node u, and classify it as core or non-core node.Then, generate a new graph of the core nodes only, and use this graph in Pregel model to find all the connected components in the core graph, each of which is a cluster.Finally, process noncore nodes by assigning each non-core node to the cluster(s) of its adjacent core nodes if exist, or mark it as a noise if no core node is adjacent to it.Notice that all steps are executed in parallel.ParaDengraph is divided into the following three stages:

A. Computing ε-neighborhood
ParaDengraph uses a graph parallel model and generate a graph structure from the input adjacency lists.Therefore, many graph functions can simplify the process, such as filtering feature.This step is accomplished by filtering the graph from all edges with distance > ε.The number of the remaining edges that are adjacent to each node is used to classify it.

B. Core Graph Connected Components
Core graph is generated by filtering the graph of the previous step from all nodes with adjacent edges < η.Then, the core graph is processed in Pregel model to find connected components.The connected core nodes form a cluster.Solving such problem requires unknown of iterations (supersteps) to find all the connected core nodes by passing messages.

C. Expanding Clusters
After discovering all connected core nodes and generating all initial clusters, the next step is to process non-core nodes, assigning each to the same cluster of its neighbor core nodes, and mark it as border.Overlapping must be considered when the border node connects to more than one cluster.Note that when a node does not adjacent to any core node (cluster), it must be marked as noise.The proposed algorithm of ParaDengraph is shown in Table II.

IV. EXPERIMENTS
ParaDengraph was tested with two real networks.The whole workflow is shown in Fig. 2. ParaDengraph was implemented with Apache Spark GraphX engine for largescale graph processing and Hadoop distributed file system (HDFS), and was run on a 64-bit PC with Intel® Core™ i5-3337U CPU @ 1.80GHz × 4, 5.7 GB RAM and 732.0 GB HD.

A. Enron Emails Network
The Enron email network [10] consists of 1,148,072 emails sent between 87,273 employees of Enron.Nodes in the network are individual employees, and edges are individual emails.We run ParaDengraph for many times, changing both parameters: epsilon ε and minimum point η, as shown in Table III.Fig. 3 shows the relation between the values of ParaDengraph parameters and the number of generated clusters of Enron network.

B. Twitter Interactions Network
The second data set was Twitter interaction graph, where nodes represent users and edges represent interactions, such as retweets or replays.ParaDengraph was applied many times to the graph of 9187 nodes as shown in Table IV.The relation between the generated clusters of Twitter graph and the parameters values of ParaDengraph is shown in Fig. 4.
From both Fig. 3 and 4, it can be seen that the resulted clusters were not related directly to the parameters values, since the number of clusters decreased in Enron network with increasing the values, while it increased in the Twitter network.Therefore, the result depends mainly on the graph nature and the core nodes locations to each other's.However, the clear result was the relation between the number of core nodes and the parameters values.The number of core nodes increased when the epsilon value increased, but decreased with increasing the value of minimum points.

V. EVALUATION
For evaluation purpose, both ParaDengraph and Newman Edge Betweenness Clustering (EBC) [2] algorithms were applied to the same social network graph to compare both results and obtain the characteristics of both clustering methods.The previous Enron and Twitter graphs, with 87,273 and 9,187 nodes respectively, are too large to fit in the low capacity of EBC.So, for evaluation, a smaller Twitter data set (539 nodes) was used to run both algorithms.ParaDengraph was applied on the graph with different collections of parameters values, epsilon (ε) and minimum points (η).Since the average noise percentage for all runs (140 runs) was 54.24 %, we chose the closer epsilon value (ε=0.09).The result with ε=0.09 and η=5 was 8 clusters, and 294 nodes as noise.
Then, Newman EBC was applied to the same graph of 539 nodes.Notice that EBC is a hierarchical clustering algorithm.EBC gave the best modularity at level 9 with 17 clusters.While EBC generated 17 clusters, ParaDengraph with the ability of density-based clustering to discover noise generated only 8 clusters.In order to test the effect of noise in the result, a total of 294 noise nodes that discovered by ParaDengraph (ε= 0.09 and η=5) were removed from the original graph, and EBC was applied again.On the graph of 245 nodes (after removing noise), the best modularity was found at level 6 with 10 clusters.The number of clusters decreased from 17 to 10, which was closer to ParaDengraph result (8 clusters).
As a result, we found that ParaDengraph outperformed EBC mainly in two parts.First, EBC failed to deal with large social networks due to its high time complexity.However, ParaDengraph was capable to run with better performance, even in the sequential version.This result proves that densitybased clustering algorithms are more appropriate for large social networks than hieratical clustering algorithms.Second, notice that EBC at the first run on the complete graph (539 nodes) gave a result of 17 clusters.However, the result of the second run on the same graph after excluding all noise (245 nodes) was 10 clusters.In the other hand, ParaDengraph gave both 8 clusters and some noise.We can notice that this result (8 clusters) was too close to the second result of EBC (10 clusters) after removing all noise.

VI. DISCUSSION
In addition to the suitability for large-scale graph computing, which is most critical in dealing with massive networks, ParaDengraph is also able to give reasonable clusters by discovering and excluding noise from the clustering process.This feature is essential in social networks, since there is usually a large number of actors, but there is also a high number of them do not contribute (outliers).While EBC found clusters, it was unable to detect outliers, resulting in more clusters where some may contained only one or very few nodes.However, outliers did not affect the outcome of ParaDengraph.
Moving to the limitations of this proposed algorithm, the most noticeable limitation is that ParaDengraph was proposed based on the static version of DenGraph, where communities are observed as static.However, they are evolving continuously and such dynamic networks require considering the time and changes over time.

VII. CONCLUSION
This article proposed ParaDengraph, a graph-parallel algorithm for community detection in large social networks based on the original sequential algorithm called DenGraph.The suggested algorithm is suitable for large-scale graph computing.ParaDengraph has been applied to two real social networks: Enron emails and Twitter.For evaluation, ParaDengraph was compared with Newman Edge Betweenness Clustering (EBC) algorithm.ParaDengraph outperformed EBC in terms of performance and the ability to generate clusters that are more reasonable by excluding noise from the clustering process.For future work, ParaDengraph can be improved for studying communities on dynamic social networks.

TABLE III .
ENRON NETWORK RUN STATISTICS

TABLE IV .
TWITTER NETWORK RUN STATISTICS