Network science | ||||
---|---|---|---|---|
Network types | ||||
Graphs | ||||
|
||||
Models | ||||
|
||||
| ||||
The Louvain method for community detection is a method to extract non-overlapping communities from large networks created by Blondel et al.[1] from the University of Louvain (the source of this method's name). The method is a greedy optimization method that appears to run in time [math]\displaystyle{ O(n \cdot \log n) }[/math] where [math]\displaystyle{ n }[/math] is the number of nodes in the network.[2]
The inspiration for this method of community detection is the optimization of modularity as the algorithm progresses. Modularity is a scale value between −0.5 (non-modular clustering) and 1 (fully modular clustering) that measures the relative density of edges inside communities with respect to edges outside communities. Optimizing this value theoretically results in the best possible grouping of the nodes of a given network. But because going through all possible iterations of the nodes into groups is impractical, heuristic algorithms are used.
In the Louvain Method of community detection, first small communities are found by optimizing modularity locally on all nodes, then each small community is grouped into one node and the first step is repeated. The method is similar to the earlier method by Clauset, Newman and Moore[3] that connects communities whose amalgamation produces the largest increase in modularity. The Louvain algorithm was shown to correctly identify the community structure when it exists, in particular in the stochastic block model[4].
The value to be optimized is modularity, defined as a value in the range [math]\displaystyle{ [-1/2,1] }[/math] that measures the density of links inside communities compared to links between communities.[1] For a weighted graph, modularity is defined as:
[math]\displaystyle{ Q = \frac{1}{2m}\sum\limits_{ij}\bigg[A_{ij} - \frac{k_i k_j}{2m}\bigg]\delta (c_i,c_j), }[/math]
where
Based on the above equation, the modularity of a community [math]\displaystyle{ c }[/math] can be calculated as:
[math]\displaystyle{ Q_c = \frac{\Sigma_{in}}{2m} - (\frac{\Sigma_{tot}}{2m})^2, }[/math]
where
In order to maximize modularity efficiently, the Louvain Method has two phases that are repeated iteratively.
First, each node in the network is assigned to its own community. Then for each node [math]\displaystyle{ i }[/math], the change in modularity is calculated for removing [math]\displaystyle{ i }[/math] from its own community and moving it into the community of each neighbor [math]\displaystyle{ j }[/math] of [math]\displaystyle{ i }[/math]. This value is easily calculated by two steps: (1) removing [math]\displaystyle{ i }[/math] from its original community, and (2) inserting [math]\displaystyle{ i }[/math] to the community of [math]\displaystyle{ j }[/math]. The two equations are quite similar, and the equation for step (2) is:[1]
[math]\displaystyle{ \Delta Q = \bigg[ \frac{\Sigma_{in} + 2k_{i,in}}{2m} - \bigg(\frac{\Sigma_{tot} + k_i}{2m}\bigg)^2 \bigg]-\bigg[\frac{\Sigma_{in}}{2m} - \bigg(\frac{\Sigma_{tot}}{2m}\bigg)^2-\bigg(\frac{k_i}{2m}\bigg)^2\bigg] }[/math]
Where [math]\displaystyle{ \Sigma_{in} }[/math] is sum of all the weights of the links inside the community [math]\displaystyle{ i }[/math] is moving into, [math]\displaystyle{ \Sigma_{tot} }[/math] is the sum of all the weights of the links to nodes in the community [math]\displaystyle{ i }[/math] is moving into, [math]\displaystyle{ k_i }[/math] is the weighted degree of [math]\displaystyle{ i }[/math], [math]\displaystyle{ k_{i,in} }[/math] is the sum of the weights of the links between [math]\displaystyle{ i }[/math] and other nodes in the community that [math]\displaystyle{ i }[/math] is moving into, and [math]\displaystyle{ m }[/math] is the sum of the weights of all links in the network. Then, once this value is calculated for all communities [math]\displaystyle{ i }[/math] is connected to, [math]\displaystyle{ i }[/math] is placed into the community that resulted in the greatest modularity increase. If no increase is possible, [math]\displaystyle{ i }[/math] remains in its original community. This process is applied repeatedly and sequentially to all nodes until no modularity increase can occur. Once this local maximum of modularity is hit, the first phase has ended.
In the second phase of the algorithm, it groups all of the nodes in the same community and builds a new network where nodes are the communities from the previous phase. Any links between nodes of the same community are now represented by self-loops on the new community node and links from multiple nodes in the same community to a node in a different community are represented by weighted edges between communities. Once the new network is created, the second phase has ended and the first phase can be re-applied to the new network.
It is important to emphasize that Louvain produces only non-overlapping communities, which means that each node can belong to at most one community. This is highly unrealistic in many real-world applications. For example, in social networks, most people belong to multiple communities: their family, their friends, their co-workers, old school buddies, etc. In biological networks, most genes or proteins belong to more than one pathway or complex. Furthermore, Louvain has been shown to sometimes produce arbitrarily badly connected communities, and has been effectively superseded (at least in the non-overlapping case) by the Leiden algorithm.[8]
When comparing modularity optimization methods, the two measures of importance are the speed and the resulting modularity value. A higher speed is better as it shows a method is more efficient than others and a higher modularity value is desirable as it points to having better-defined communities. The compared methods are, the algorithm of Clauset, Newman, and Moore,[3] Pons and Latapy,[9] and Wakita and Tsurumi.[10]
Karate | Arxiv | Internet | Web nd.edu | Phone | Web uk-2005 | Web WebBase 2001 | |
---|---|---|---|---|---|---|---|
Nodes/links | 34/77 | 9k/24k | 70k/351k | 325k/1M | 2.6M/6.3M | 39M/783M | 118M/1B |
Clauset, Newman, and Moore | .38/0s | .772/3.6s | .692/799s | .927/5034s | -/- | -/- | -/- |
Pons and Latapy | .42/0s | .757/3.3s | .729/575s | .895/6666s | -/- | -/- | -/- |
Wakita and Tsurumi | .42/0s | .761/0.7s | .667/62s | .898/248s | .56/464s | -/- | -/- |
Louvain Method | .42/0s | .813/0s | .781/1s | .935/3s | .769/134s | .979/738s | .984/152mn |
-/- in the table refers to a method that took over 24hrs to run. This table (from[1][12]) shows that the Louvain method outperforms many similar modularity optimization methods in both the modularity and the time categories.
Original source: https://en.wikipedia.org/wiki/Louvain method.
Read more |