# A Constrained Louvain Algorithm with a Novel Modularity
## 1 Introduction  
Lots of real systems can be expressed as complex networks [1]. In complex networks, besides the small world effect [2, 3] and the power-law feature of degrees' distribution [4, 5], the community structure is considered as a most interesting and important feature [6, 7], for example, the collection of web pages on related topics in the network of the World Wide Web [8, 9], clusters of customers with similar interests in the network of purchase relationships [9], and academic collaborations in a co-authorship network [10]. Community detection is helpful to find these interesting structures and to understand dynamical behaviors on complex networks [11]. Therefore, a community detection algorithm is significantly important. Community detection is thought as a NP-hard problem. Therefore, obtaining a correct community partition is a large challenge. At present, many methods have been developed to detect the community structure, such as divisive algorithms [6, 12], agglomerative algorithms [13, 14, 15], spectral clustering [16, 17, 18] dynamic methods [19, 20, 21], Infomap [22], Label propagation [23], clustering based on density [24], and optimization methods [25, 26, 27]. Among them, the optimization methods are widely focused on. These class methods define the community detection as the optimization problem of an objective function. Two popular optimization methods are the [PERSON]'s fast algorithm [13] and the Louvain algorithm [26]. The [PERSON]'s fast algorithm maximizes the modularity \(Q\)[28] in the merging process of communities in pairs. Finally, the community partition with maximal \(Q\) is thought as a good partition result. The complexity is \(O(m(m+N))\), and \(m,N\) is the number of nodes and edges of a network. Compared with the [PERSON]'s fast algorithm, the complexity of the Louvain algorithm [26] is linear, which has less time cost than the [PERSON]'s fast algorithm. It aims to maximize the modularity \(Q\)[28]. When a node is removed from one community to another one, the calculation of the increase in the modularity is only related to the node and two corresponding communities. Thus, the computational efficiency is obviously better than that of the [PERSON]'s fast algorithm. In addition, the Louvain algorithm can be conveniently parallelized to improve the calculation speed [29, 30, 31]. The Louvain algorithm [26] has been applied to a larger network. However, the accuracy of the detection result is rarely researched [32; 33]. If we do not consider the processing of the network structure [32; 33], the accuracy of the Louvain algorithm can be improved simply from two main points. Firstly, we can select a better objective function as the optimization goal. Currently, in addition to \(Q\), some other quality functions can also be used as the objective functions of optimization, such as modularity \(F\)[34] and \(M\)[35]. However, they have some shortcomings. For example, there exists the resolution limit problem for modularity \(Q\)[36; 37; 38; 39]: when the size of a community is below a certain threshold, it cannot be detected by \(Q\)[36]. This threshold does not depend on a particular network structure, but results only from the comparison between the number of links of interconnected communities and the total number of links of the network. Conversely, in some cases, maximizing \(Q\) tends to split a large community into smaller ones [39; 40]. Moreover, some random networks, which have no apparent community structure, may have unreasonably large values of \(Q\)[41; 42]. \(M\) approaches the infinite when an isolated subgraph within the network emerges as a community, or the whole network constitutes a single community. Thus, we need to design a better quality function as an objective function. Secondly, for the result of the Louvain algorithm, we can combine the feature of the real communities to obtain a better community structure. Currently, two plausible definitions to describe the community feature are weak community and strong community.