Community Detection in Networks using Node Attributes and Modularity

Community detection in network is of vital importance to find cohesive subgroups. Node attributes can improve the accuracy of community detection when combined with link information in a graph. Community detection using node attributes has not been investigated in detail. To explore the aforementioned idea, we have adopted an approach by modifying the Louvain algorithm. We have proposed Louvain-ANDAttribute (LAA) and Louvain-OR-Attribute (LOA) methods to analyze the effect of using node attributes with modularity. We compared this approach with existing community detection approaches using different datasets. We found the performance of both algorithms better than Newman’s Eigenvector method in achieving modularity and relatively good results of gain in modularity in LAA than LOA. We used density, internal and external edge density for the evaluation of quality of detected communities. LOA provided highly dense partitions in the network as compared to Louvain and Eigenvector algorithms and close values to Clauset. Moreover, LOA achieved few numbers of edges between communities. Keywords—Community Detection; Louvain algorithm; Node attributes; and Modularity


INTRODUCTION
Community in a network is the collection of nodes having similar properties or interests or having more connections between them.Detection of a bunch of nodes in a graph aim to identify strongly connected components by separating sparse connections.Several methods and algorithms have been proposed by researchers in this perspective [1], [2].Some of the proposed core methods for graph clustering in literature can be roughly categorized as follows: A few among them just focus on the configuration (physical arrangement of nodes and their relationships) of graph, for example modularity maximization [3], divisive algorithms; minimum cut method [4] and spectral methods [5].Some proposed algorithms use properties associated with nodes only i.e.K-SNAP [6], and others [8][9][10][11][12][13][14], [16][17][18][19][20][21] are a hybrid approach of both node attributes and structural information of graph for detecting dense communities in the graph.Attributes and attribute-based communities can be used in many applications like access control as described in our survey [25].
Modularity has often been used as a quality metric for resulting partitions produced by these methods by comparing the number of links within and between communities.The range of value of modularity is from -1 to 1.The modularity value near 1 shows good quality of partitions and vice-versa.Though optimization of modularity is considered hard w.r.t.computation [7], yet researchers have been trying to achieve reasonable approximate for modularity.
Louvain method [3] provides an efficient and fast way of finding high modularity partitions in a large network.This paper aims at exploring the changes in modularity, the density of communities, internal and external edge density within and between communities when node attributes are combined with Louvain modularity.In this paper, we have applied some modification in Louvain method to find answers of following research questions:  Whether dense communities be detected by using attributes of the nodes?
 What is the effect on the density of communities if attributes and modularity both are used to form communities?
 What is the difference between the density of communities either using node attributes or modularity?
 Can joint and separate approach of both node attributes and modularity provide us better results as compared to only modularity? www.ijacsa.thesai.org What is the effect of average internal and external edge density within and between communities?
After providing the related work in Section II, proposed approach is discussed in Section III.Implementation and Results are shown in Section IV and Section V concludes the paper.

II. RELATED WORK
For community detection, both structural information of network and attributes of the nodes are considered in this research.Some relevant families of methods in this context are discussed here.Partitions carried out on the augmented graph in [8,9].Here, original graph was extended by adding new vertices and new edges for linking original nodes with similar attributes.SA-Cluster approach used random walk distance measure and K-Medoids approach for the measurement of a node"s closeness and to make communities respectively.Further, entropy and density are used to measure the quality of obtained communities [8].Ins-Cluster algorithm was suggested to improve the efficiency of SA-Cluster and to make it scalable [9] but these methods are not applicable in the case of the continuous value of attributes.Both of these approaches are related to categorical attributes only.Yang et al. introduced CESNA for the detection of overlapping communities based on edge structure and node attributes [10].Method proposed for the detection of a subset of nodes that are highly connected and have similar attributes [11].Louvain method was combined with entropy to make communities of a graph but both types of information were not exploited at the same time [12].Dang modified modularity of communities based on node attributes and the links between node pairs concurrently [13].This study is providing modification in Louvain method by proposing two community detection algorithms but non-linked vertices are part of communities.New modularity formula based on inertia named I-Louvain is provided in [14] which try to join most similar elements (relational data and node attributes) rather than focusing on link strengths [15].Instead of selecting initial nodes randomly, Local Outlier Factor technique is used to select core nodes for making communities [16].Further, structural similarity and attribute similarity are recognized by K-neighborhood and similarity score.Node similarity by examining common neighbors between two nodes is calculated and Louvain modularity is combined with similarity score for community detection which results in high complexity of proposed method [17].
Node actions, attributes and structural properties of the network are considered collectively [18].Key nodes in the network are identified by considering similar actions of key nodes with its neighbors and communities are formed around them to divide customers for social marketing.Statistical measures and concepts such as Bayesian approach [19] and Bayesian nonparametric theory [20] has also been used for attribute-based community detection and considering structural properties as well.Graph structure ambiguity is used by Selection method which is used for switching between structure method and attribute methods for community detection [21].It is highly dependent on the selected method for structure analysis and also on the depth of a graph.The TABLE I as shown in paper represents a brief overview of available related work of attribute-based community detection.

III. THE PROPOSED METHOD FOR COMMUNITY DETECTION
In this work, two methods are provided to find partitions based on node attributes and graph structural properties.For this purpose, we have followed Louvain algorithm"s strategy of community detection with two modifications.LAA and LOA have combined the gain in the modularity with multiple common user"s attributes to detect communities in the network.Louvain algorithm considers each node as a community.By comparing each node with its neighbors, it decides to merge communities with a maximum possible gain in modularity.Once it iterates through all the nodes, it will have merged few nodes together and formed some communities.These resultant communities become the new input of the same procedure.It terminates when there is no more possibility of gain in modularity.Our contribution is that we have considered node attributes with the same strategy by ANDing and ORing attributes of nodes with the modularity formula.
The formula of modularity gain ∆Q is [3]: Where is the sum of weights of links inside community C, is the sum of weights of links incident to nodes in community C, is the sum of the weights of the links incident to node i, is the sum of the weights of the links from i to nodes in C and w denotes the sum of the weights of all the links in the network.
For finding the common attributes of resultant community, we are taking the intersection of the attributes of both communities to be merged.For example, if a community C i with number of attributes is to be merged with a community C j with number of attributes then a resultant community C k will be formed with common number of attributes which can be formulated as follows: ( ) In this paper, nodes are selected to form communities basically on two criteria"s:  In LAA if nodes satisfy both conditions of having some common attributes i.e. ( 2) with the community and also maximizing modularity by being the part of the community.
 In LOA, the node becomes the part of the community whether it has some similar attributes with the community to be merged or it can increase modularity when merging in that community.www.ijacsa.thesai.orgOur idea behind adopting this strategy is that if you want to detect communities of dense connections of nodes having common attributes and also want to consider the effect of neighbor nodes as mentioned in [17] then go for LAA.
Further, if you want to add nodes in communities with common attributes then those nodes can"t be rejected to be the part of communities which can increase the quality of community by maximizing its modularity and this argument provides a base to adopt LOA.We shall use both modified Louvain algorithms to find the answers to our research questions which have been discussed earlier.

IV. IMPLEMENTATION AND RESULTS
We have performed extensive experimentations to compare the performance of our proposed methods LAA and LOA with the state-of-art algorithms Clauset, Newman"s eigenvector and Louvain on real graph datasets.

A. Experimental Datasets:
Five real world datasets with node attributes and relationships are selected for experimental evaluation in this paper.We used London_gang 1 , Italy_gang 2 , Polbooks 3 , Adjnoun [22], and Football [23]. Italy_gang dataset (DS2) describes 67 Italian gang members, their nationalities, and their connections.Attribute data is gang member"s country of origin which is coded numerically.
 Polbooks dataset (DS3) is the graph provided by V. Krebs which tells details about the US politics books purchased by people on Amazon.com.Books are vertices and edges depict frequent co-purchasing of books by the same customers.Attributes of books consist of values "l", "n", or "c" for specifying them in three categories: "liberal", "neutral", or "conservative".
 Adjnoun dataset (DS4) contains the network of common adjective and noun adjacencies for the novel "David Copperfield" by Charles Dickens.Here, vertices show the most regularly used adjectives and nouns in the book.The 0 value of nodes represents adjectives and 1 is used for nouns.Edges are used to denote the pair of words that occur together in the text of the book.
 Football dataset (DS5) is the network of American football games between Division IA colleges during regular season Fall 2000.The values are given to nodes from 0 to 11 representing their conference belongings i.e.Atlantic Coast, Big East, Big Ten, Big Twelve, Conference USA, Independents, Mid-American, Mountain West, Pacific Ten, Southeastern, Sun Belt and Western Athletic respectively.

B. Comparison Methods for Evaluation
In this paper, three algorithms are selected for comparing results with LAA and LOA methods which consider only structural similarities.
 Newman's Eigenvector method [2]: This method uses a divisive approach where each split occurs by maximizing the modularity concerning original network.
 Blondel's method [3]: Third method is a Louvain algorithm which has been previously discussed and modified in Section III.

C. Evaluation Metrics
For the evaluation of the quality of clusters, Density proposed by Cheng is used as described in [16].The formula of density is as follows: Where is "t" number of communities found using several algorithms, are both vertices belonging to same community and E is the total number of edges in a graph.The higher value of density indicates the higher number of connection found in resultant clusters.
Two other measures are also used here, to find the internal and external connectedness of communities as described in [24].In this paper, both proposed algorithms LAA and LOA are compared with the baseline algorithms which use structural information of a graph only for community detection.Comparison of algorithms for all selected datasets for this experimental evaluation on the basis of modularity as explained by modularity gain formula (1) can be seen in Table III.The performance of both of our methods out-performs Eigen-vector [2] in modularity calculations.As far as LAA is concerned, its modularity value remains less than Louvain and Clauset in three cases (out of 5) and remains better in most of the cases as compared to LOA.LOA performed average as compared to Louvain and Clauset.One point to mention here is that LOA is very close to Louvain when compared to LAA.
The comparison of communities found by different algorithms in terms of evaluation measure of density explained by ( 3) is shown in Table II.LOA algorithm has detected dense communities as compared to Louvain and Eigenvector and its performance has been very close to Clauset in detecting dense clusters.Whereas LAA shows average performance in this context.Fig. 1 to Fig. 4 all of them explain our results diagrammatically.The evaluation measures for the connectedness of subgraph whether it is internal or external as mentioned in (4) and ( 5) has been shown in Table IV.We have taken average values of internal edge density and external edge density of all communities detected by different algorithms.LAA results for average internal edge density are comparatively better than eigenvector and Clauset methods.LOA results for external edge density are having small values than other methods which are the sign of its good quality of partitions; less number of connection between clusters.As mentioned earlier, we have selected some research questions to answer as a purpose of this experimental study.LAA suggests that detection of dense communities by using attributes is possible, but the density of community cannot always provide us guarantee that density of found clusters will always be high as compared to structure only methods.
If we use either modularity or attributes to form communities then it is likely to have more dense communities than using combined approach.As compared to modularity only approach, combined and split approach can give modularity with minor differences but can give fairly better results than Eigenvector.
By using both node attributes and links information of graph, it is likely to have better results of internal edge density of communities than [1] and [3].By using any one information (whether node information or link information) it seems to have less number of edges between clusters.

D. Limitation
We have found that results of these methods can be dependent on the order in which nodes are considered for selection relying on their attributes.Further, LAA and LOA approaches are compared with structure-based methods only.

V. CONCLUSION
In this paper, the effect of node attributes by combining it with Louvain algorithm"s modularity is focused.We found that LAA and LOA provide reasonable results for community detection evaluation.In future, we are concerned to include attribute only and hybrid methods of community detection (based on both node attribute and graph structure) for comparison with our results.We are also interested in modifying other structure only methods with node and user attributes for such experiments.We shall proceed further for overlapping community detection as well.

Firstly,
Internal Edge Density which is obtained by dividing the number of internal edges of community C by the number of possible internal edges in that cluster.It is very effective to find cohesiveness of a subgraph.It can be formulated as: ⁄ Where represents sum of internal degrees of vertices of C and is the number of vertices in community C. Secondly, External Edge Density is used which can be calculated by dividing the number of external edges of community C by number of all possible external edges.This measure tells us how community is embedded in network.It can be calculated by following formula: ⁄ Where is the sum of external edges of community C vertices and is the number of vertices in community C.

Fig. 1 .
Fig. 1.Performance of algorithms based on Density

Fig. 3 .
Fig. 3. Comparison based on Internal edge density of clusters

TABLE I .
SUMMARY OF AVAILABLE ATTRIBUTE BASED COMMUNITY DETECTION ALGORITHMS Graph G (V, E, A) where V is the set of vertices of a graph, E is the set of edges between them.A is the set of attributes that are associated with V. Output: N i a ij clusters where N i are the number of communities and a ij are attributes in each community i.
Input: Graph G (V, E, A) where V is the set of vertices of a graph, E is the set of edges between them.A is the set of attributes that are associated with V.

TABLE II .
DENSITY COMPARISON OF ALGORITHMS