Next Article in Journal
Stability of the Additive Splitting Methods for the Generalized Nonlinear Schrödinger Equation
Previous Article in Journal
Extending the Applicability of a Two-Step Vectorial Method with Accelerators of Order Five for Solving Systems of Equations
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

NSLS: A Neighbor Similarity and Label Selection-Based Algorithm for Community Detection

1
School of Mathematics and Computer Science, Yunnan Minzu University, Kunming 650504, China
2
Fujian Provincial Key Laboratory of Data-Intensive Computing, Quanzhou Normal University, Quanzhou 362000, China
3
School of Mathematics and Computer Science, Quanzhou Normal University, Quanzhou 362000, China
*
Author to whom correspondence should be addressed.
Mathematics 2025, 13(8), 1300; https://doi.org/10.3390/math13081300
Submission received: 13 March 2025 / Revised: 8 April 2025 / Accepted: 11 April 2025 / Published: 16 April 2025
(This article belongs to the Special Issue Data Analysis for Social Networks and Information Systems)

Abstract

:
Community detection is still regarded as one of the most applicable methods for discovering latent information in complex networks. Recently, many similarity-based community detection algorithms have been widely applied to the analysis of complex networks. However, these approaches may also have some limitations, such as relying solely on simple similarity measures, which makes it difficult to differentiate the tightness of the relation between nodes. Aiming at this issue, this paper proposes a community detection algorithm based on neighbor similarity and label selection (NSLS). Initially, the algorithm assigns labels to each node using a new local similarity measure, thereby quickly forming a preliminary community structure. Subsequently, a similarity parameter is introduced to calculate the similarity between nodes and communities, and the nodes are reassigned to more appropriate communities. Finally, dense communities are obtained by a fast-merge method. Experiments on real-world networks show that the proposed method is accurate, compared with recent and classical community detection algorithms.

1. Introduction

Many complex systems in the real world can be modeled as complex networks, such as social networks [1], biological networks [2], information networks [3], and electric power networks [4]. In these networks, the entities in the networks are abstracted as nodes, and the relationships between entities are abstracted as edges.
In recent years, many scholars have begun to focus on network information mining. Network information mining mainly includes important research directions such as link prediction [5], community detection [6], and clustering analysis [7]. Among them, the goal of community detection is to identify these tightly connected communities and reveal the internal structure of the network. Specifically, a community in a network can be regarded as a group of network nodes [8]. The community structure is the connection relationship formed by the community [9]. Community detection not only helps to understand group divisions and node functions but also provides support for applications such as network optimization, information propagation, and personalized recommendations [10].
Until now, many algorithms have been proposed to address the community detection problem, which can be broadly classified into modularity-based algorithms, label propagation algorithms, random walk-based algorithms, and local similarity-based algorithms [11]. These algorithms try to explore communities in networks from various perspectives.
Since the concept of modularity was proposed, many researchers have used it to evaluate the performance of community detection algorithms [12,13]. The CNM algorithm proposed by Clauset et al. [14] performs community detection by gradually merging nodes and optimizing modularity. Later, an improved and fast method called Louvain was suggested by Blondel et al. [15]. The algorithm stands out as an efficient approach to modularity optimization in community detection. It achieves community detection by merging nodes based on maximum modularity. The Leiden algorithm [16] improves the Louvain algorithm by introducing a more refined local optimization and an improved community merging strategy. The MSM algorithm [17] solves the community detection problem by reformulating modularity maximization as a subset identification problem and maximizing its surrogate. However, algorithms based on modularity generally face challenges such as limited resolution and sensitivity to network size [16]. Modularity-based methods suffer from significant limitations, such as ignoring topological information, node similarity, trapping in local maxima, and greedy nature, which lead to inaccurate results.
The Label Propagation Algorithm (LPA) [18] detects communities using an information propagation mechanism. The LPA initially assigns a unique label to each node and iteratively updates the labels until all nodes belong to a single community. Although the LPA has near-linear time complexity, it demonstrates lower accuracy and instability in community detection due to weaknesses associated with random node selection and label update mechanisms. Scholars have studied the improvements in the LPA from the perspectives of using network topological information, improving label propagation rules, and improving community initialization [19,20,21].
Some methods are based on identifying core nodes and expanding local communities from the inside out [22,23]. The performance of these methods relies on accurate core node detection techniques, especially the algorithm based on density peak clustering and label propagation proposed by Li et al. [23]. The user needs to manually adjust the parameters multiple times to determine the number of community centers. The LBLD algorithm selects a limited number of nodes as cores to propagate labels to surrounding nodes [22]. Consequently, not all nodes can receive labels, and the network structure lacks sufficient stability to achieve balanced label propagation, which may lead to inaccuracies. The FSLD method [24] expands communities from boundary nodes inward, which avoids some pitfalls of identifying core nodes, assigning initial labels, and label propagation approaches. However, boundary nodes typically exhibit overlapping characteristics and contain scant information, thus posing significant challenges for accurately assigning them to a well-defined community. FluidC is a propagation-based method that identifies communities by simulating the expansion and contraction of fluids in an environment [25]. LMFLS [6] is a fast algorithm based on local multi-factor node scoring and label selection. These algorithms improve the robustness of the LPA and the accuracy of community partitioning. However, further optimization can be achieved by proposing more refined label selection strategies, improving similarity measures, and considering additional factors.
Random walk-based algorithms detect communities by leveraging the tendency of walkers to remain within a community over short time spans. Walktrap [26] uses random walks to calculate the transition probability between nodes and then measures the similarity between nodes and communities by calculating the distance. Walktrap provides reasonable results over a broader range of community structure strengths, but its performance heavily depends on the degree distribution of the network. Infomap is another random walk-based algorithm that combines encoding with community detection, but it cannot effectively reveal loosely connected communities [27]. Synwalk [28] combines the advantages of Infomap and Walktrap. It applies the concept of random block modeling to random walks to identify communities. Li et al. [29] proposed a new variant of random walk. The core idea of using HoSI is to identify core community members related to the query node and optimize the generated community structure. Random walk-based algorithms need to consider information of all nodes in community discovery, which makes them inefficient on large-scale networks due to their high time complexity. However, these algorithms are sensitive to the selection of initial nodes, which can lead to differences in the results.
Local similarity-based algorithms focus on the local features and neighborhood information of the nodes. The main idea of local methods is to define local metrics and iteratively divide communities based on these metrics [30]. These methods rely heavily on the accuracy of the similarity measurement. Sahu et al. [31] proposed two new similarity metrics and implemented community detection and optimization through a two-phase process. Yang et al. [32] introduced a dynamic time series method to quantify the similarity between nodes in networks. Information derived from the time series of the diffusion model is used to identify communities. SimCMR [33] expands the concept of community detection by evaluating similarities within and between communities. Zhang et al. [34] proposed an evolutionary multi-objective attribute community detection based on a similarity fusion strategy with central nodes. The similarity fusion strategy integrates topological and attribute similarities to effectively identify central nodes.
Based on the above analysis, we propose a novel community detection algorithm. In the initial community detection stage, a new similarity measure is used to select labels for the nodes, thereby forming the initial community structure. In the second phase, we introduce a similarity parameter to adapt to different types of network structures. Nodes are reassigned on the basis of the similarity between nodes and communities. In the final phase, we merge communities by analyzing the relationships between important nodes in neighboring communities. The main contributions of the proposed algorithm are summarized as follows:
  • Two similarity measures are introduced by considering the tightness relation between the nodes in a comprehensive way.
  • The algorithm comprehensively considers the similarity relation between nodes, between nodes and communities, and between communities.
  • We present comparison experiments with twelve methods on real-world datasets with a wide variation range of nodes. The effectiveness of the proposed algorithm on networks of various scales is demonstrated by several experiments on real-world networks.
The remainder of this paper is organized as follows. Section 2 provides a brief review of some concepts. Section 3 shows the details of the proposed community detection algorithm. Some necessary experimental materials are introduced in Section 4. Section 5 provides the experimental results and analysis. Finally, Section 6 concludes the paper and provides a possible direction for future research.

2. Preliminaries

In this section, we introduce some basic concepts involved in this paper, which are complex network, community detection, and modularity. For more detailed descriptions, one can refer to the relevant references [8,20].

2.1. Complex Network

Mathematically, the so-called complex network can be expressed as a 2-tuple G = ( V , E ) , where V = { v 1 , v 2 , , v n } denotes the set of nodes and E = { e i j | i , j = 1 , 2 , , n } denotes the set of edges. In addition, if there exists an edge between nodes v i and v j , then e i j = 1 , otherwise e i j = 0 . Obviously, if the number of nodes and edges of G = ( V , E ) is finite, take n = | V | and m = | E | for example, then the structure of the complex network can be expressed as a matrix, such as:
A = e 11 e 12 e 1 n e 21 e 22 e 2 n e n 1 e n 2 e n n .
Without loss of generality, in what follows, we adhere to the hypothesis that G = ( V , E ) is an undirected and unweighted network.

2.2. Community Detection

For a complex network G = ( V , E ) , the community can be regarded as a network G i = ( V i , E i ) where V i V and E i E . Certainly, the goal of community detection is to find such complex networks, taking G 1 , G 2 , , G k for example, that satisfy the following conditions:
(1)
V i , for i = 1 , 2 , , k .
(2)
i = 1 k G i = G , i . e . , i = 1 k V i = V and i = 1 k E i E .
(3)
V i V j = and E i E j = for any i j .

2.3. Modularity

Given that P = { C 1 , C 2 , , C k } is a community detection result with respect to G = ( V , E ) , modularity can be defined as
Q = 1 2 m i = 1 k 2 L C i D C i 2 2 m ,
where C i P represents the i-th community, and L C i is the number of edges inside the community C i . D C i is the sum of the degrees of the nodes in the community C i , which can be defined as
D C i = v i C i d ( v i ) ,
where d ( v i ) is the degree of node v i and can be calculated as
d ( v i ) = j = 1 n e i j .

3. Our Proposed Approach for Community Detection

This section mainly introduces the motivation, the algorithm execution process, the pseudo-code of the algorithm, and the complexity analysis. The algorithm execution process includes three parts: node selection, node shifting, and community merging, which are discussed in Section 3.2, Section 3.3 and Section 3.4.

3.1. Motivation

Similarity-based community detection algorithms typically cluster nodes with high similarity in the same community. Traditional similarity measures such as Jaccard similarity, Cosine similarity, and SimRank have certain limitations in evaluating the closeness of relationships between nodes. For example, in sparse networks, where connections between nodes are limited, many similarity measures struggle to accurately capture the real community structure. In addition, when community boundaries are blurred, nodes are prone to being incorrectly assigned to the wrong communities.
To address these issues, we adopt two similarity measure methods and a series of basic rules. We only consider the similarity between a node and its most similar node to quickly form more accurate community structures. In addition, a similarity parameter is introduced to regulate the tightness of the nodes within the community. Nodes are reassigned on the basis of the similarity between nodes and communities. The specific rules are discussed in detail in the algorithm section.

3.2. Label Selection

In a complex network, two nodes that share a large number of neighbors are typically more closely connected and tend to be assigned to the same community. We focus on the similarity between a node and its neighbors, as they are closer to each other within the network. The similarity between nodes is defined as follows:
Given a complex network G = ( V , E ) , for node v i V and its neighbor v j N ( v i ) , where N ( v i ) = { v j | e i j 0 , i = 1 , 2 , , n } . The similarity between neighbor nodes is formally defined as
Sim ( v i , v j ) = | N ( v i ) N ( v j ) | | N ( v i ) N ( v j ) | + | N ( v i ) N ( v j ) | ,
where | N ( v i ) N ( v j ) | denotes the number of common neighbors between nodes v i and v j , and | N ( v i ) N ( v j ) | denotes the total number of distinct neighbors of the two nodes.
The importance of a node is not only related to the number of its neighbor nodes but is also closely associated with the structure of its neighbors. The importance of the node v i can be expressed as
I ( v i ) = v j N ( v i ) S i m ( v i , v j ) .
Initially, for any node v i V , a different label l i is assigned to each node, indicating the community to which v i belongs. The label of a node is updated according to its relationship with neighbor nodes. To more accurately capture the intrinsic connections between nodes in the network, only the neighbor with the highest similarity or the highest degree is considered. Nodes with the same label are placed in the same community. The specific label selection rules are as follows:
To avoid repeated updating of nodes, nodes with one neighbor are processed last. For any node v i that satisfies the condition d ( v i ) > 1 , its neighbor v s i m with the highest similarity is identified using the following formula
v s i m = arg max v j N ( v i ) S i m ( v i , v j ) .
If node importance I ( v s i m ) > I ( v i ) , then node v s i m is selected as the most similar node of v i ; otherwise, node v i is its own most similar node. Subsequently, node v i adopts the label of its most similar node. If S i m ( v i , v j ) = 0 , indicating that there are no common neighbors, then the most similar node is identified according to the following formula
v d e g = arg max v j N ( v i ) d ( v j ) ,
where v d e g is the neighbor of node v i with the highest degree. In this case, node v i will receive the label of the most similar node v d e g . Afterward, if the label of any node changes, then all labels will be updated again. For nodes satisfying the condition d ( v i ) = 1 , they directly adopt the label of their sole neighbor. After the label selection stage, the labels of the important nodes are propagated to the surrounding nodes.
In Figure 1a, node v 2 is the most similar node of nodes v 18 , v 22 , and v 20 ; node v 1 is the most similar node of node v 2 . The node selects the label of its most similar node, and they are shown in different colors. Node v 2 selects the label of node v 1 . Consequently, nodes v 18 , v 22 , and v 20 ultimately select the label of node v 1 , as shown in Figure 1b. In Figure 1c, node v 12 selects the label of its only neighbor v 1 .

3.3. Node Shifting

We form preliminary communities based on label selection. On this basis, adjustments can be made to incorrectly assigned nodes according to the similarity measure between the nodes and communities. If most of the neighbors of a node belong to a specific community, the node is likely to belong to the same community. Sahu et al. [31] proposed a new method to measure the similarity between node and community, which classifies nodes according to their degree. Since the preliminary community structure has been obtained, we no longer consider detecting communities based on degree. The similarity is defined as follows:
For any node v i V , the current community of node v i is C j , where C j = { v j 1 , v j 2 , , v j l } , and l represents the number of nodes in community C j . The similarity measure between the node and its community can be defined as follows.
S i m ( v i , C j ) = 1 , | N ( v i ) C j | > d ( v i ) α 0 , otherwise ,
where α is the similarity parameter used to adjust the strictness of the similarity criteria, and it takes values in the range of 1.5 to 3 with an increment of 0.5.
When a node shares a community with the majority of its neighbors, it is likely to belong to its current community. S i m ( v i , C j ) = 1 indicates that node v i still belongs to the current community C j . If S i m ( v i , C j ) = 0 , then node v i will be reassigned to another community. The detailed assignment rules are as follows:
The set of communities P m o s t that satisfies the following condition can be defined as
P m o s t = { C p C p = arg max C i P n e i g h b o r s | N ( v i ) C i | } ,
where P n e i g h b o r s is the set of communities to which the neighbors of node v i belong, C p is the community that has the maximum number of shared neighbors with node v i .
If | P m o s t | = 1 , take P m o s t = { C p } for example, then node v i is assigned to community C p . Otherwise, we assume that P m o s t = { C p 1 , C p 2 , , C p m } . In this case, node v i will be assigned to community C s according to the following formula:
C s = arg max C p i v j N ( v i ) C p i d ( v j ) ,
where C p i { C p 1 , C p 2 , , C p m } .
After one round of node shifting, each node is assigned to a suitable community. Subsequently, we will compare the changes in modularity before and after node shifting. Based on the results of this comparison, we will decide whether to carry out the next round of node shifting.
Taking the Karate network as an example, the similarity parameter is set to α = 2.5 . In Figure 2a, eight communities are identified, and the modularity of the detected communities is 0.2948. In the node shifting stage, nodes are reassigned to the communities with the maximum number of neighbors. After the first round of shifting, the number of communities is reduced to 3. The modularity of the optimized communities is 0.3744. Since the modularity remains at 0.3744 after the second round of node shifting, and the modularity improvement is less than 0.01, the node shifting process is terminated.

3.4. Community Merging

In order to further optimize the community structure, we merge the incorrectly separated communities. Based on references [6,22], the merging method focuses on negotiations between key nodes within the communities to avoid checking each node individually. Specifically, the merging process includes the following two steps:
The first step is to select candidate communities based on the size of the community. Specifically, the largest community is identified, which is the community with the maximum number of nodes. After excluding the largest community, the average size of the remaining communities is calculated, and those smaller than the average size are selected to form the set of candidate communities P c a n d i d a t e .
The second step is to evaluate whether the candidate communities need to merge. During the merger process, we only consider the relationships between the key nodes within the two communities. Based on the two metrics of node importance and degree, the key node v k e y is selected using the following formula
v k e y = arg max v i C j ( d ( v i ) + I ( v i ) ) ,
where C j represents a candidate community and C j P c a n d i d a t e . Then, we find a neighbor node v o p t that satisfies the following condition:
v o p t = arg max v j N ( v k e y ) ( d ( v j ) + I ( v j ) ) ,
where v o p t is the neighbor node of node v k e y that maximizes the sum of its degree and its importance.
If the selected neighbor node v o p t satisfies the following conditions:
(1)
Node v o p t has a different community label from v k e y ;
(2)
The degree of node v k e y is greater than the degree of node v k e y , i.e., d ( v o p t ) > d ( v k e y ) ;
then the label of node v o p t is assigned to node v k e y , thereby merging the two communities. Otherwise, the merging process is not performed.
In the community merging process, the focus is on the key nodes within each community. The merging process is based on comparing the key nodes of two communities. To obtain an accurate community structure, the merging operation is performed twice. As shown in Figure 3a, the key node of the orange candidate community is node v 6 , and its neighbors are v 1 , v 11 , v 7 , and v 17 . The selected neighbor node is node v 1 in the red community. Since the merging conditions are met, the orange community is merged into the red community.

3.5. The Pseudo-Code of the Proposed Algorithm

The proposed algorithm consists of three stages: label selection, node shifting, and community merging, which are outlined in Algorithms 1–3.
In Algorithm 1, L a b e l ( v i ) refers to the label of node v i . L a b e l ( v i ) L a b e l ( v d e g ) shows the label assignment action, that is, node v i receives the label of node v d e g . In Algorithm 2, O l d _ m o d u l a r i t y M o d u l a r i t y ( c o m m u n i t y ) means calculating the modularity of the preliminary community and storing the result in O l d _ m o d u l a r i t y , and N e w _ m o d u l a r i t y M o d u l a r i t y ( c o m m u n i t y ) means calculating the modularity after node shifting and storing the result in N e w _ m o d u l a r i t y .
Algorithm 1: Label selection
Mathematics 13 01300 i001
Algorithm 2: Node shifting
Mathematics 13 01300 i002

3.6. Complexity Analysis

The NSLS algorithm is divided into three stages: label selection, node shifting, and community merging. The number of nodes in the network is n and the average degree is k. In the first stage, for the n 1 nodes with a degree greater than 1, the time complexity for calculating node similarity is at most O n 1 k 2 2 . In the second stage, the time complexity for calculating the similarity between nodes and communities is O ( n k ) . During the node shifting process, the time complexity is O ( r n log n ) , where r is the number of iterations. In the community merging stage, the time complexity for calculating the community sizes is at most O ( n ) . Therefore, the total time complexity of the algorithm is O ( r n log n ) .
Algorithm 3: Community merging
Mathematics 13 01300 i003

4. Experimental Materials

In this section, we introduce some experimental materials such as experiment datasets, benchmark algorithms, and evaluation metrics. The specified experimental platform is summarized in Table 1.

4.1. Datasets

In this article, we perform our experiment with the following 11 real-world datasets, which can be downloaded from the websites http://snap.stanford.edu/data (accessed on 10 November 2024) and http://konect.cc/networks/ (accessed on 10 November 2024). The detailed information of the related datasets is as follows.
Karate: The social network records friendships among 34 members of a karate club from a US university.
Dolphins: The social network depicts frequent interactions among 62 bottlenose dolphins.
Polbooks: The network is composed of books on US politics from 2004.
Football: It is a social network created according to the American College Football League.
Power Grid: The network describes the topology of the Western States Power Grid in the United States.
CA-GRQC: The collaboration network maps scientific collaborations among authors of papers in the category of general relativity and quantum cosmology.
PGP: The communication network records the interactions between users of the Pretty Good Privacy (PGP) algorithm.
Brightkite: The network is built on the Brightkite social platform, which records the bidirectional friendship relationships between users.
DBLP: This is the network of collaborations among the authors of papers indexed on the DBLP website.
Amazon: The network is generated by browsing Amazon pages and collecting suggested goods on each page.
YouTube: The network is built based on the YouTube social platform, where users are connected through friendship relationships.
The basic information of the above datasets is listed in Table 2. Each row contains the name of the dataset, the number of nodes (n), the number of edges (m), and the number of communities (c), listed from left to right.

4.2. Benchmark Algorithms

To systematically evaluate the superiority of the NSLS algorithm, this study selects seven classical community detection methods (Walktrap, CNM, LPA, Infomap, Louvain, Leiden, and FluidC) and five recent algorithms analogous to NSLS (FSLD, DS-LPA, LBLD, LMFLS, and NBCD) as comparative benchmarks. The NSLS method integrates multiple techniques, including modularity optimization, local similarity measurement, and label selection mechanisms, aiming to provide more precise community partitions. This paper covers various community detection algorithms, including different algorithm categories such as label propagation, label diffusion, modularity optimization, core node expansion, local similarity-based methods, random walk-based methods, and hybrid approaches. The main purpose is to comprehensively compare the performance of these community detection methods. A brief description of these benchmark algorithms is provided below.
Walktrap [26]: Walktrap is a community detection algorithm based on random walks. It defines the process of random walks to calculate the similarity between each pair of nodes. Based on this similarity, it constructs a distance matrix and uses hierarchical clustering to merge the nodes step by step until the optimal community partition is achieved.
CNM [14]: CNM is a hierarchical agglomerative method designed for homogeneous networks. It focuses on optimizing modularity through a greedy strategy while maintaining linear time complexity. It aims to maximize the modularity by grouping the nodes in the network to find highly clustered subgraphs.
Infomap [27]: The Infomap algorithm is a community detection algorithm based on information theory. It treats community detection as an encoding problem and obtains the optimal community by minimizing the description length during the random walk process of the nodes.
LPA [18]: The LPA is a community detection algorithm based on label propagation. It is renowned for its simplicity and efficiency, which makes it particularly suitable for large-scale networks. It propagates node information based on the network topology, takes the label with the most occurrences among its neighboring nodes as its own label, and then uses an asynchronous update strategy to make the algorithm converge.
Louvain [15]: This algorithm optimizes a quality function and consists of two phases: the local movement of nodes, where each node is moved to the community that maximizes the gain in the quality function, and aggregation of the network, where a new network is created based on the local partition, with each community becoming a node in the aggregate network. These two phases are repeated until the quality function can no longer be improved.
Leiden [16]: The Leiden algorithm is similar to the Louvain algorithm, as it also discovers communities by iteratively optimizing modularity. However, it introduces additional steps to ensure the connectivity and quality of communities. The algorithm involves three phases: the local movement of nodes, refinement of the partition, and network aggregation based on the refined partition, using the non-refined partition to create an initial partition for the aggregate network.
FluidC [25]: FluidC identifies the community structure of a graph by simulating the expansion and propagation of fluid within the network. It iteratively expands and merges fluid in the graph based on the topological structure and similarity score until a stable state is reached. The algorithm’s similarity score considers both the structural and feature similarities between nodes, allowing it to effectively identify communities within the network.
LBLD [22]: The LBLD algorithm is a fast community detection algorithm. The algorithm assigns nodes with their most similar neighbors to the same community. A new method for constructing rough cores is used to effectively detect some initial seed nodes, and balanced label diffusion is adopted to expand the communities. Finally, the communities are merged.
NBCD [31]: The NBCD algorithm is a community detection algorithm based on neighbor similarity. The precision of community detection is improved by introducing new similarity measures and a node-shifting mechanism. The algorithm is divided into two stages: nodes are clustered based on the similarity of their neighboring nodes, and then the nodes within the detected communities are reshuffled.
FSLD [24]: The FSLD algorithm uses a label diffusion method from marginal nodes by considering local criteria and similarities to discover communities. The algorithm consists of four steps: label diffusion, label update, diffusion of labels to first-degree nodes, and the merging of initial communities.
DS-LPA [23]: The DS-LPA algorithm improves the local density calculation method in the density peak clustering algorithm to identify community centers in the network. Then, the node update order is determined based on local similarity measures, and a stable label propagation strategy is employed to update the labels.
LMFLS [6]: LMFLS is a fast algorithm based on local multi-factor node scoring and label selection. It scores the nodes using multiple factors to obtain node rankings. Then, it employs two label selection strategies to choose optimal labels. Finally, community merging is performed.
Some community detection algorithms may require parameter adjustments before implementation. The Leiden, Louvain, LBLD, LSMD, Infomap, and CNM algorithms contain free parameters. For instance, Leiden and Louvain use randomness parameters to control the seed size and balance exploration and exploitation during the optimization process. In the FluidC and LPA algorithms, the maximum number of iterations needs to be determined, with FluidC set to 100 iterations and the LPA set to 12 iterations. The LBLD algorithm requires adjusting the number of iterations in the label selection stage. The Walktrap algorithm uses the default random walk length of t = 5, as stated in the paper. The parameters for NBCD and DS-LPA are shown in Table 3. For unstable algorithms, the average value of ten runs is adopted as the experimental result.
A detailed overview of the seven algorithms, Walktrap, CNM, LPA, Louvain, Leiden, Infomap, FluidC, as well as their Python implementations, can be found in [35], and on the website https://cdlib.readthedocs.io/en/latest/reference/cd_algorithms/node_clustering.html (accessed on 8 December 2024). The implementations of LBLD and FSLD are available at https://github.com/phdutm2009/community-detetcion-Bouyer (accessed on 4 February 2025). The Python implementation of LMFLS can be obtained from https://github.com/hamid-roghani/LMFLS (accessed on 18 January 2025). The Java implementation of DS-LPA is accessible at https://github.com/Lichuanwei1996/DS-LPA (accessed on 21 December 2024).

4.3. Evaluation Measures

To evaluate the performance of the proposed algorithm, four evaluation indices are adopted in our experiments: Normalized Mutual Information (NMI) [36], Adjusted Rand Index (ARI) [23], Adjusted Mutual Information (AMI) [37], and Modularity (Q) [20]. The NMI, ARI, and AMI are used to evaluate the accuracy of community detection when the ground truth communities of the network are available.
NMI: The NMI is a measure for evaluating the similarity between the communities detected by the algorithm and the ground-truth communities. For the ground-truth communities C R and detected communities C D , the definition of the NMI is as follows:
I ( C R , C D ) = i = 1 | C R | j = 1 | C D | n i j N log N n i j n i m j ,
H ( C R ) = i = 1 | C R | n i N log n i N ,
H ( C D ) = j = 1 | C D | m j N log m j N ,
NMI ( C R , C D ) = I ( C R , C D ) H ( C R ) · H ( C D ) ,
where I ( C R , C D ) represents the mutual information, H ( C R ) and H ( C D ) denote the entropy of C R and C D , respectively. | C R | and | C D | are the number of communities in C R and C D , respectively, n i j is the number of nodes that belong to both the i-th community of C R and the j-th community of C D , n i is the number of nodes in the i-th community of C R , m j is the number of nodes in the j-th community of C D , and N is the total number of nodes in the network.
AMI: If C R and C D are the ground-truth and detected communities, then the AMI is defined as
AMI ( C R , C D ) = 2 ( I ( C R , C D ) E ( I ( C R , C D ) ) ) ( H ( C R ) + H ( C D ) ) 2 E ( I ( C R , C D ) ) ,
where I ( C R , C D ) represents the mutual information between C R and C D . H ( C R ) and H ( C D ) denote the entropy of C R and C D . E ( I ( C R , C D ) ) is the expected mutual information and can be calculated as
E ( I ( C R , C D ) ) = i = 1 | C R | j = 1 | C D | n i j = max ( n i + m j N , 0 ) min ( n i , m j ) n i j N log N · n i j n i m j · Δ i j ,
where Δ i j can be represented as
Δ i j = n i ! m j ! ( N n i ) ! ( N m j ) ! N ! n i j ! ( n i n i j ) ! ( m j n i j ) ! ( N n i m j + n i j ) ! .
The definitions of the symbols in the AMI formula are consistent with those in the NMI formula.
ARI: The ARI is another measure, such as the NMI, that is used to evaluate the similarity of communities. If C R and C D represent the real community and the detected community, respectively, it is calculated as:
ARI ( C R , C D ) = 2 ( N 00 N 11 N 01 N 10 ) ( N 00 + N 01 ) ( N 10 + N 11 ) + ( N 00 + N 10 ) ( N 01 + N 11 ) ,
where N 11 indicates the number of pairs of nodes in the same community in both C R and C D , N 00 indicates the number of pairs of nodes in different communities in both C R and C D , N 01 shows the number of pairs of nodes that are in the same community in C R but are not in the same community in C D , and N 10 represents the number of pairs of nodes that are not in the same community in C R but are in the same community in C D .
Modularity: When ground-truth communities are absent, the modularity measure serves as an important metric to evaluate the effectiveness of community detection algorithms in identifying dense and well-structured communities. Modularity is calculated using Equation (2).

5. Results and Analysis

The results of different algorithms in real-world datasets are evaluated using four metrics: the NMI, AMI, ARI, and modularity. For the DBLP, Amazon, and YouTube datasets, only the top 5000 high-quality communities are used to calculate the NMI, AMI, and ARI. The Walktrap and CNM algorithms cannot be executed on the YouTube dataset due to insufficient memory and time complexity issues. DS-LPA does not run on large-scale datasets due to a Java out-of-memory error. Since the FluidC algorithm requires prior knowledge of the number of communities, we used the real number of communities provided in Table 2 as a parameter for the algorithm.

5.1. NMI Analysis

Table 4 shows the performance of different algorithms evaluated with the NMI metric. To better illustrate the community detection results of the NSLS algorithm, Figure 4 shows a visualization of the communities detected in the Karate, Dolphins, Polbooks, and Football datasets, achieving NMI scores of 1.0000, 1.0000, 0.5979, and 0.8974, respectively. Compared with other algorithms, the NSLS algorithm exhibits significant superiority across multiple datasets. The NSLS algorithm successfully identified all communities with 100% accuracy in the Karate and Dolphins datasets. In the Polbooks dataset, NSLS achieved the highest NMI value. In the Football dataset, NSLS ranked third, only 0.0128 lower than the best result achieved by the LBLD algorithm.
In the DBLP dataset, the NMI value of NSLS was only 0.0019 lower than that of the best-performing NBCD. In the Amazon dataset, NSLS achieved the highest NMI value among all algorithms, accurately identifying the community structure. In addition, the results of NSLS significantly outperform those of NBCD, LBLD, FSLD, and LMFLS in the YouTube dataset. The FluidC algorithm achieved the highest value on the YouTube dataset, as the number of communities was predefined during its execution. Obviously, it shows the significant accuracy of NSLS in both small and large datasets.
As can be seen from the Table 4, the proposed NSLS algorithm performs better in community detection compared to the classical algorithms. FluidC performs well on most datasets and can partition nodes more accurately when the number of communities is known. However, this also reveals its dependency on parameters (the number of communities), which may limit its generalizability in practical applications. As an improved version of Louvain, the Leiden algorithm performs slightly better than Louvain on multiple datasets, but the improvement is limited. The CNM, Louvain, and Leiden algorithms neglect the importance and similarity relationships between nodes, while Infomap and Walktrap use random strategies in some cases, resulting in lower accuracy. In contrast to the instability observed in the results of Louvain, Leiden, LPA, and Infomap algorithms across multiple independent runs, the NSLS algorithm proposed in this paper maintains stable community detection results on different executions.
Overall, the NSLS algorithm outperforms several recently published community detection algorithms, including LBLD, NBCD, FSLD, LMFLS, and DS-LPA. Due to limitations in the experimental environment, the network size detected by DS-LPA is relatively small. Compared to the LBLD algorithm, six of the highest results across the seven datasets of different sizes belonged to the NSLS algorithm. The same applies to the comparison with the NBCD algorithm. The NSLS algorithm utilizes more topological information when stabilizing the initial community. A more refined strategy is employed when adjusting node labels, combining similarity measures and modularity optimization. At the same time, the algorithm takes into account the similarity between communities. The synergy and integration of these three phases significantly enhance the overall performance. In general, NSLS not only offers superior accuracy but also demonstrates higher reliability when adapting to networks of various scales and complexities.

5.2. AMI Analysis

To evaluate the precision of each method, the AMI score is computed for identified communities. Table 5 shows the AMI results obtained on seven ground truth datasets.
It is obvious that NSLS achieves the highest results in five out of the seven datasets. In the Karate and Dolphins datasets, the communities detected by the FluidC, LBLD, FSLD, LMFLS, DS-LPA, and NSLS algorithms exhibit perfect alignment with the ground-truth communities. For these two small-scale datasets, the community detection performance of these algorithms is excellent, as they successfully capture the true structure of the network. In the Polbooks, Amazon, and YouTube datasets, NSLS achieved the highest AMI value. In the DBLP dataset, the AMI value of the NSLS algorithm is only 0.0197 lower than that of the better-performing FSLD algorithm, achieving comparable results. This indicates that, for large-scale datasets, NSLS is more successful in identifying partitions that are more similar to the ground-truth communities. By comparing Table 4 and Table 5, the NMI and AMI exhibit overall consistency in evaluating community detection performance. In general, the NSLS algorithm is a relatively successful method for obtaining high accuracy.

5.3. ARI Analysis

Table 6 shows the results of different algorithms evaluated based on the ARI metric. In the Karate and Dolphins benchmark datasets, the NSLS algorithm precisely reproduces the inherent community structures, achieving theoretically optimal matching accuracy. In the Polbooks dataset, NSLS achieved the third-best ARI scores. In the Football dataset, NSLS achieved an ARI of 0.8077, ranking in the upper middle range. In general, the NSLS algorithms exhibited outstanding community detection performance on small- scale datasets.
In the Amazon dataset, the NSLS algorithm performed the best, achieving an ARI score of 0.6865. In addition, it also achieved the highest NMI and AMI scores, demonstrating its strong ability to accurately identify community structures. In the DBLP dataset, although the Leiden algorithm achieved the highest ARI score, the NSLS algorithm had significantly higher values of the NMI and AMI. The Leiden and Louvain algorithms exhibit a tendency to over-merge communities. In contrast, recent algorithms perform better in the DBLP dataset, discovering communities that are closer to the ground truth. In the YouTube dataset, the NSLS algorithm achieved the third highest ARI score. When evaluated using multiple metrics, such as the NMI, AMI, and ARI, the NSLS algorithm consistently demonstrated outstanding community detection performance across multiple datasets. From Table 4, Table 5 and Table 6, it can be concluded that the proposed algorithm NSLS performs better than other community detection algorithms.

5.4. Modularity Analysis

Table 7 shows the modularity value (Q) and the corresponding number of detected communities (C) for each dataset. If the modularity value of a network exceeds 0.3, it is typically considered to have a significant community structure. If high values of modularity correspond to a good community division in a network, then one should be able to identify such good divisions by searching through the possible candidates for ones with high modularity [14].
In the Karate dataset, Leiden has detected four communities and achieved the highest modularity value. In Table 2, the actual number of communities in the Karate dataset is two, and the modularity value is 0.3715. This result is consistent with the modularity values of NBCD, LBLD, and NSLS. In the Dolphins dataset, Informap detected five communities with a modularity of 0.5285. Based on the ground truth of the Dolphins dataset, the actual number of communities is two. The real modularity is 0.3787, which is consistent with the results of LBLD and NSLS. NSLS accurately reveals the actual communities with 100% precision in both the Karate and Dolphins datasets, as illustrated in Figure 4a,c. In the Football dataset, Leiden achieved the highest modularity value of Q = 0.6046 with 10 communities. The real modularity value for the Football dataset is Q = 0.554. NSLS detected 14 communities with a modularity of Q = 0.5536, which is much closer to the real modularity value compared to the LBLD, LPA, and CNM algorithms.
In the Polbooks dataset, the Leiden algorithm achieved the highest modularity value (Q = 0.5269), but this value does not fully reflect the true community division results. The real modularity is 0.4149. FSLD achieved the modularity (Q = 0.4437) closest to the actual value, followed by DS-LPA, LMFLS, NSLS, and LBLD. All five algorithms detected two communities. In terms of the NMI, ARI, and AMI metrics, LMFLS, NSLS, DS-LPA, and LBLD performed the best, with the same number of correctly identified community members. Specifically, the communities partitioned by NSLS and LBLD were exactly the same, while the results of LMFLS were also very close, differing by just one member. DS-LPA followed closely. FSLD correctly identified slightly fewer community members, but its community division results were relatively close to those of the other four algorithms. This observation is consistent with the evaluation results of the NMI values. When there are ground-truth communities, the NMI is an important metric for evaluating the quality of community detection, effectively measuring the consistency between algorithmic results and true partitioning.
In the DBLP dataset, the real number of communities is 13,477. Leiden achieved the highest modularity value, but the algorithm detected 364 communities. Algorithms such as Walktrap, LPA, CNM, Louvain, Leiden, and Informap show a significant discrepancy between the number of detected communities and the real number of communities. In the Amazon dataset, the real number of communities is 75,149. Leiden detected 364 communities but achieved a high modularity value. However, Infomap detected only 13 communities. In large-scale datasets, NSLS achieved results that closely align with actual community structures.
Louvain and Leiden are modularity-based community detection algorithms that achieve relatively high modularity values. In large-scale networks, these methods may produce fragmented communities or overlook meaningful ones, often favoring hub nodes with many connections, thereby forming larger artificial communities and neglecting smaller communities. The NSLS algorithm also considers modularity during the node-shifting phase, but combines similarity measures and adaptive similarity parameters for diverse network structures to adjust community divisions. The core goal of community detection is to reveal the true community structure rather than simply following higher modularity values. The results of NSLS and LBLD are closer to the real communities.

5.5. Running Time Analysis

Table 8 presents the run times of various algorithms in real-world datasets. For the first four small-scale datasets, the running time of all algorithms is less than one second. Due to the extremely short running time, the performance differences between the algorithms are insignificant.
In the YouTube dataset, the CNM algorithm was terminated due to an excessive execution time, while the Walktrap algorithm failed to complete due to insufficient memory. LBLD and NBCD algorithms demonstrated high accuracy in community detection, but the execution time of NBCD was relatively longer. The Leiden and Infomap algorithms, implemented through the CDLIB library [35], rely heavily on C++. However, due to differences in the underlying programming languages, such comparisons inherently involve some bias. Algorithms such as the LPA and Leiden have short execution times. The NSLS algorithm achieves high accuracy in community detection while demonstrating a moderate execution time.

5.6. Parameter Analysis

Figure 5 shows the performance of NSLS for different α values in the datasets considered. We selected four parameter values for the experiments: α = 1.5, 2, 2.5, and 3, which correspond to neighbor similarities of 66.6 % , 50 % , 40 % , and 33.3 % , respectively. Different α values correspond to varying community densities. Specifically, the lower α values (e.g., α = 1.5 ) tend to identify tightly connected communities, whereas the higher α values (e.g., α = 3 ) are more suitable for detecting sparsely connected communities. By considering multiple evaluation metrics (e.g., NMI, ARI, and AMI), it can be found that α = 2.0 is the recommended value. However, it is still recommended to try all possible parameter values.

6. Conclusions and Future Research

This paper proposes a community detection algorithm based on neighbor similarity and label selection. To form a better initial community structure, the algorithm introduces a new similarity measure and assigns nodes and their most similar nodes to the same community. Additionally, the algorithm introduces a similarity parameter α to regulate the tightness of the nodes within the community. To form dense communities, the algorithm also adopts a fast merging strategy. Some experiments on eleven real-world datasets of different scales are applied to fulfill the effectiveness of our proposed algorithms. Experiments show that the NSLS algorithm performs better on more datasets than other community detection algorithms. The NSLS algorithm shows consistent superiority in the four performance metrics.
Although the NSLS algorithm provides accurate results, parameter selection and modularity maximization inevitably increase the computation time. Future research will focus on developing parameter-free detection methods and optimizing label selection strategies to reduce computation time. In addition, we will do our best to study community detection on other types of networks, such as directed networks and weighted networks.

Author Contributions

Conceptualization, S.L. (Shihu Liu); writing—original draft, S.L. (Shihu Liu), H.C., S.L. (Shuang Li) and X.Y.; writing—review and editing, S.L. (Shihu Liu) and H.C.; software, S.L. (Shihu Liu) and X.Y.; formal analysis, H.C. and S.L. (Shihu Liu). All authors have read and agreed to the published version of the manuscript.

Funding

This work is supported by the Xingdian Talent Support Program for Young Talents (No. XDYC-QNRC-2022-0518) and the Open Project of Fujian Provincial Key Laboratory of Data-Intensive Computing (No. SJXY202401).

Data Availability Statement

No new data were created or analyzed in this study.

Acknowledgments

We are hugely grateful to the anonymous reviewers for their constructive comments with respect to the original manuscript.

Conflicts of Interest

The authors declare that there are no conflicts of interest associated with this publication, and there has been no significant financial support for this work that could have influenced its outcome.

References

  1. An, Q.; Wang, P.; Zeng, Y.; Dai, Y. Cooperative Social Network Community Partition: A Data Envelopment Analysis Approach. Comput. Ind. Eng. 2022, 172, 108658. [Google Scholar] [CrossRef]
  2. Doluca, O.; Oğuz, K. APAL: Adjacency Propagation Algorithm for Overlapping Community Detection in Biological Networks. Inf. Sci. 2021, 579, 574–590. [Google Scholar] [CrossRef]
  3. Liu, M.; Liu, J.; Dong, Y.; Mao, R.; Cambria, E. Interest-Driven Community Detection on Attributed Heterogeneous Information Networks. Inf. Fusion 2024, 111, 102525. [Google Scholar] [CrossRef]
  4. Guerrero, M.; Montoya, F.G.; Baños, R.; Alcayde, A.; Gil, C. Community Detection in National-Scale High Voltage Transmission Networks Using Genetic Algorithms. Adv. Eng. Inform. 2018, 38, 232–241. [Google Scholar] [CrossRef]
  5. Liu, Y.; Liu, S.; Yu, F.; Yang, X. Link Prediction Algorithm Based on the Initial Information Contribution of Nodes. Inf. Sci. 2022, 608, 1591–1616. [Google Scholar] [CrossRef]
  6. Li, H.; Nasab, S.S.; Roghani, H.; Roghani, P.; Gheisari, M.; Fernández-Campusano, C.; Abbasi, A.A.; Wu, Z. LMFLS: A New Fast Local Multi-Factor Node Scoring and Label Selection-Based Algorithm for Community Detection. Chaos Solitons Fractals 2024, 185, 115126. [Google Scholar] [CrossRef]
  7. Li, D.X.; Zhou, P.; Zhao, B.W.; Su, X.R.; Li, G.D.; Zhang, J.; Hu, P.W.; Hu, L. Biocaiv: An Integrative Webserver for Motif-Based Clustering Analysis and Interactive Visualization of Biological Networks. BMC Bioinform. 2023, 24, 451. [Google Scholar] [CrossRef]
  8. Fortunato, S. Community Detection in Graphs. Phys. Rep. 2010, 486, 75–174. [Google Scholar] [CrossRef]
  9. Feng, Y.; Chen, H.; Li, T.; Luo, C. A Novel Community Detection Method Based on Whale Optimization Algorithm with Evolutionary Population. Appl. Intell. 2020, 50, 2503–2522. [Google Scholar] [CrossRef]
  10. Javed, M.A.; Younis, M.S.; Latif, S.; Qadir, J.; Baig, A. Community Detection in Networks: A Multidisciplinary Review. J. Netw. Comput. Appl. 2018, 108, 87–111. [Google Scholar] [CrossRef]
  11. Das, S.; Biswas, A. Deployment of Information Diffusion for Community Detection in Online Social Networks: A Comprehensive Review. IEEE Trans. Comput. Soc. Syst. 2021, 8, 1083–1107. [Google Scholar] [CrossRef]
  12. Javadpour Boroujeni, R.; Soleimani, S. The Role of Influential Nodes and Their Influence Domain in Community Detection: An Approximate Method for Maximizing Modularity. Expert Syst. Appl. 2022, 202, 117452. [Google Scholar] [CrossRef]
  13. Jin, D.; Zhang, B.; Song, Y.; He, D.; Feng, Z.; Chen, S.; Li, W.; Musial, K. ModMRF: A Modularity-Based Markov Random Field Method for Community Detection. Neurocomputing 2020, 405, 218–228. [Google Scholar] [CrossRef]
  14. Clauset, A.; Newman, M.E.J.; Moore, C. Finding community structure in very large networks. Phys. Rev. E 2004, 70, 066111. [Google Scholar] [CrossRef]
  15. Blondel, V.D.; Guillaume, J.L.; Lambiotte, R.; Lefebvre, E. Fast Unfolding of Communities in Large Networks. J. Stat. Mech. Theory Exp. 2008, 2008, P10008. [Google Scholar] [CrossRef]
  16. Traag, V.A.; Waltman, L.; Van Eck, N.J. From Louvain to Leiden: Guaranteeing Well-Connected Communities. Sci. Rep. 2019, 9, 5233. [Google Scholar] [CrossRef]
  17. Yuan, Q.; Liu, B. Community Detection via an Efficient Nonconvex Optimization Approach Based on Modularity. Comput. Stat. Data Anal. 2021, 157, 107163. [Google Scholar] [CrossRef]
  18. Raghavan, U.N.; Albert, R.; Kumara, S. Near Linear Time Algorithm to Detect Community Structures in Large-Scale Networks. Phys. Rev. E 2007, 76, 036106. [Google Scholar] [CrossRef] [PubMed]
  19. Laassem, B.; Idarrou, A.; Boujlaleb, L.; Iggane, M. Label Propagation Algorithm for Community Detection Based on Coulomb’s Law. Phys. A Stat. Mech. Its Appl. 2022, 593, 126881. [Google Scholar] [CrossRef]
  20. Zhang, W.; Shang, R.; Jiao, L. Large-Scale Community Detection Based on Core Node and Layer-by-Layer Label Propagation. Inf. Sci. 2023, 632, 1–18. [Google Scholar] [CrossRef]
  21. Zhang, Y.; Liu, Y.; Li, Q.; Jin, R.; Wen, C. LILPA: A Label Importance Based Label Propagation Algorithm for Community Detection with Application to Core Drug Discovery. Neurocomputing 2020, 413, 107–133. [Google Scholar] [CrossRef]
  22. Roghani, H.; Bouyer, A. A Fast Local Balanced Label Diffusion Algorithm for Community Detection in Social Networks. IEEE Trans. Knowl. Data Eng. 2023, 35, 5472–5484. [Google Scholar] [CrossRef]
  23. Li, C.; Chen, H.; Li, T.; Yang, X. A Stable Community Detection Approach for Complex Network Based on Density Peak Clustering and Label Propagation. Appl. Intell. 2022, 52, 1188–1208. [Google Scholar] [CrossRef]
  24. Bouyer, A.; Azad, K.; Rouhi, A. A Fast Community Detection Algorithm Using a Local and Multi-Level Label Diffusion Method in Social Networks. Int. J. Gen. Syst. 2022, 51, 352–385. [Google Scholar] [CrossRef]
  25. Parés, F.; Gasulla, D.G.; Vilalta, A.; Moreno, J.; Ayguadé, E.; Labarta, J.; Cortés, U.; Suzumura, T. Fluid Communities: A Competitive, Scalable and Diverse Community Detection Algorithm. In Complex Networks & Their Applications VI; Springer: Cham, Switzerland, 2018; pp. 229–240. [Google Scholar]
  26. Pons, P.; Latapy, M. Computing Communities in Large Networks Using Random Walks. In Proceedings of the Computer and Information Sciences—ISCIS 2005, Istanbul, Turkey, 26–28 October 2005; Springer: Berlin/Heidelberg, Germany, 2005; pp. 284–293. [Google Scholar]
  27. Rosvall, M.; Bergstrom, C.T. Maps of Random Walks on Complex Networks Reveal Community Structure. Proc. Natl. Acad. Sci. USA 2008, 105, 1118–1123. [Google Scholar] [CrossRef] [PubMed]
  28. Toth, C.; Helic, D.; Geiger, B.C. Synwalk: Community Detection via Random Walk Modelling. Data Min. Knowl. Discov. 2022, 36, 739–780. [Google Scholar] [CrossRef]
  29. Li, B.; Wang, M.; Hopcroft, J.E.; He, K. HoSIM: Higher-order Structural Importance Based Method for Multiple Local Community Detection. Knowl.-Based Syst. 2022, 256, 109853. [Google Scholar] [CrossRef]
  30. Saoud, B.; Moussaoui, A. Node Similarity and Modularity for Finding Communities in Networks. Phys. A Stat. Mech. Its Appl. 2018, 492, 1958–1966. [Google Scholar] [CrossRef]
  31. Sahu, S.; Rani, T.S. A Neighbour-Similarity Based Community Discovery Algorithm. Expert Syst. Appl. 2022, 206, 117822. [Google Scholar] [CrossRef]
  32. Yang, B.; Huang, T.; Li, X. A Time-Series Approach to Measuring Node Similarity in Networks and Its Application to Community Detection. Phys. Lett. A 2019, 383, 125870. [Google Scholar] [CrossRef]
  33. Tunali, V. Large-Scale Network Community Detection Using Similarity-Guided Merge and Refinement. IEEE Access 2021, 9, 78538–78552. [Google Scholar] [CrossRef]
  34. Zhang, W.; Zhao, K.; Shang, R. Evolutionary Multi-Objective Attribute Community Detection Based on Similarity Fusion Strategy with Central Nodes. Appl. Soft Comput. 2024, 150, 111101. [Google Scholar] [CrossRef]
  35. Rossetti, G.; Milli, L.; Cazabet, R. CDLIB: A Python Library to Extract, Compare and Evaluate Communities from Complex Networks. Appl. Netw. Sci. 2019, 4, 52. [Google Scholar] [CrossRef]
  36. Chattopadhyay, S.; Basu, T.; Das, A.K.; Ghosh, K.; Murthy, L.C.A. Towards Effective Discovery of Natural Communities in Complex Networks and Implications in E-Commerce. Electron. Commer. Res. 2021, 21, 917–954. [Google Scholar] [CrossRef]
  37. Vinh, N.X.; Epps, J.; Bailey, J. Information Theoretic Measures for Clusterings Comparison: Variants, Properties, Normalization and Correction for Chance. J. Mach. Learn. Res. 2010, 11, 2837–2854. [Google Scholar]
Figure 1. The visualization results of the label selection steps. (a) Selecting label of the most similar node. (b) Updating the labels of nodes with d ( v i ) > 1 . (c) Updating the labels of nodes with d ( v i ) = 1 .
Figure 1. The visualization results of the label selection steps. (a) Selecting label of the most similar node. (b) Updating the labels of nodes with d ( v i ) > 1 . (c) Updating the labels of nodes with d ( v i ) = 1 .
Mathematics 13 01300 g001
Figure 2. The visualization results before and after the node shifting process. (a) The modularity of the communities after the label selection phase is 0.2948. (b) The modularity of the communities after the node shifting phase is 0.3744.
Figure 2. The visualization results before and after the node shifting process. (a) The modularity of the communities after the label selection phase is 0.2948. (b) The modularity of the communities after the node shifting phase is 0.3744.
Mathematics 13 01300 g002
Figure 3. The visualization results of community merging steps: (a) selecting candidate communities, and (b) merging candidate communities.
Figure 3. The visualization results of community merging steps: (a) selecting candidate communities, and (b) merging candidate communities.
Mathematics 13 01300 g003
Figure 4. Visualization of the detected communities by the NSLS algorithm in Karate, Polbooks, Dolphins, and Football networks.
Figure 4. Visualization of the detected communities by the NSLS algorithm in Karate, Polbooks, Dolphins, and Football networks.
Mathematics 13 01300 g004
Figure 5. Performance of the NSLS algorithm on selected datasets for different α values.
Figure 5. Performance of the NSLS algorithm on selected datasets for different α values.
Mathematics 13 01300 g005
Table 1. Experimental platform.
Table 1. Experimental platform.
ParameterParameter Value
RAM8 GB
Speed2.50 GHz
ProgrammingPython 3.9.19
CPUIntel (R) Core (TM) i5-1155G7
GPUIntel (R) Iris (R) Xe Graphics
SystemWindows 11 system with 4 cores
Table 2. The basic information of real-world datasets.
Table 2. The basic information of real-world datasets.
Datasetnmc
Karate34782
Dolphins621592
Polbooks1054413
Football11561312
Power Grid49416594
CA-GRQC524214,496
PGP10,68024,316
Brightkite58,228214,078
DBLP317,0801,049,86613,477
Amazon334,863925,87275,149
YouTube1,134,8902,987,6248385
Table 3. Parameters used for different algorithms.
Table 3. Parameters used for different algorithms.
DatasetsNBCDDS-LPANSLS
Karate2.02.03.0
Dolphins2.52.53.0
Polbooks1.52.52.0
Football3.01.62.0
DBLP2.02.0
Amazon2.02.0
YouTube1.53.0
Table 4. NMI results of different algorithms on real-world datasets.
Table 4. NMI results of different algorithms on real-world datasets.
DatasetsWalktrapCNMInfomapLPALouvainLeidenFluidC
Karate0.50420.69250.69950.20750.70710.68731.0000
Dolphins0.53760.55710.55650.53240.48380.56291.0000
Polbooks0.54270.53080.55370.43830.53690.57370.4956
Football0.88740.69770.85160.85470.88500.89030.8924
DBLP0.58410.49380.61590.75290.53730.54550.7453
Amazon0.62550.88650.41280.95380.84310.86350.8982
YouTube0.51030.43100.48250.50330.7355
DatasetsLBLDNBCDFSLDLMFLSDS-LPANSLS
Karate1.00001.00001.00001.00001.00001.0000
Dolphins1.00000.65361.00001.00001.00001.0000
Polbooks0.59790.56070.51850.59790.59790.5979
Football0.91020.90950.89480.88460.88730.8974
DBLP0.73960.75690.74590.74820.7550
Amazon0.96760.95960.96040.96190.9680
YouTube0.55260.57080.43870.62220.6593
Table 5. AMI results of different algorithms on real-world datasets.
Table 5. AMI results of different algorithms on real-world datasets.
DatasetsWalktrapCNMInfomapLPALouvainLeidenFluidC
Karate0.47270.68080.68740.15160.69120.67121.0000
Dolphins0.51450.54340.54140.50940.46640.54771.0000
Polbooks0.52840.51590.54010.40560.51860.56110.4854
Football0.85610.65010.81480.81910.85310.86000.8569
DBLP0.11770.36890.46820.45610.42060.43190.4719
Amazon0.01630.80410.36310.88070.75390.77690.6663
YouTube0.37240.22000.37240.39350.2985
DatasetsLBLDNBCDFSLDLMFLSDS-LPANSLS
Karate1.00001.00001.00001.00001.00001.0000
Dolphins1.00000.64421.00001.00001.00001.0000
Polbooks0.59320.54600.51270.59320.59320.5932
Football0.87810.88200.86590.84340.84310.8582
DBLP0.49880.49190.51090.46860.4912
Amazon0.92190.89810.90050.90500.9230
YouTube0.34570.37790.24830.32460.4185
Table 6. ARI results of different algorithms on real-world datasets.
Table 6. ARI results of different algorithms on real-world datasets.
DatasetsWalktrapCNMInfomapLPALouvainLeidenFluidC
Karate0.33310.68030.70220.08790.59980.54141.0000
Dolphins0.31350.46590.37920.29660.34640.39641.0000
Polbooks0.65340.63790.66490.38450.64630.67520.5226
Football0.81540.47410.68030.62050.80350.80690.8098
DBLP0.00590.04530.08840.01170.10380.11300.0110
Amazon0.00110.40850.01220.58030.33170.37940.2307
YouTube0.04470.00800.04220.05010.0538
DatasetsLBLDNBCDFSLDLMFLSDS-LPANSLS
Karate1.00001.00001.00001.00001.00001.0000
Dolphins1.00000.46891.00001.00001.00001.0000
Polbooks0.66710.67970.59890.66710.66710.6671
Football0.85140.84650.78890.76570.81320.8077
DBLP0.02180.01410.02130.01360.0156
Amazon0.68430.61900.62830.63020.6865
YouTube0.02600.04270.00490.02910.0494
Table 7. Experimental results on real-world datasets based on modularity.
Table 7. Experimental results on real-world datasets based on modularity.
DatasetsWalktrapCNMLPALouvain
C Q C Q C Q C Q
Karate50.353230.380730.112140.4151
Dolphins70.499140.495570.497450.5188
Polbooks40.507040.502080.481850.5268
Football100.602960.549790.5521100.6043
Power Grid3640.8310430.934614060.6060410.9357
CA-GRQC8160.78254170.81969910.75543920.8611
PGP15740.78941930.849420590.7381960.8832
Brightkite68920.572114180.614656440.57907220.6893
DBLP30,4250.671930470.732343,1900.64942060.8225
Amazon14,9040.849413460.870537,4260.72632420.9263
YouTube113,8110.328757910.7231
DatasetsLeidenInfomapNBCDLBLD
CQCQCQCQ
Karate40.419830.402020.371520.3715
Dolphins50.527750.528540.526520.3787
Polbooks40.526940.526240.477420.4569
Football100.604690.5864110.6032130.5807
Power Grid420.938050.76377390.72963410.8219
CA-GRQC3950.86573770.83747470.79155610.7918
PGP960.8851620.857710520.80623580.8159
Brightkite6900.69625640.382623950.642312510.5785
DBLP2560.83045430.817323,7040.685318,3940.6948
Amazon3640.9319130.786024,4430.769015,5010.8040
YouTube56250.73159260.694453,2780.648725,1690.5206
DatasetsFSLDLMFLSDS-LPANSLS
CQCQCQCQ
Karate20.371520.371520.371520.3715
Dolphins20.378720.378720.378720.3787
Polbooks20.443720.456920.456920.4569
Football100.5908130.5592120.5653140.5536
Power Grid4660.78223420.81663610.8178
CA-GRQC4190.73605930.80065570.8097
PGP5730.73735590.80243180.8407
Brightkite10790.562016440.622420310.6312
DBLP15,4870.669023,0180.697526,9900.6405
Amazon28,0600.726419,9080.781413,0080.8124
YouTube13,9420.434817,9060.428438,2270.6120
Table 8. The running time (s) of different algorithms on real-world datasets.
Table 8. The running time (s) of different algorithms on real-world datasets.
DatasetsWalktrapCNMInfomapLPALouvainLeiden
Karate0.00180.00610.00200.00230.00200.0010
Dolphins0.01080.01230.00430.00310.00400.0010
Polbooks0.01200.04130.00660.00560.00700.0011
Football0.01800.05110.01150.00420.00600.0010
DBLP2676.100364,618.897430.9595140.7686152.97445.7168
Amazon1857.809719,759.376342.962930.7070100.36295.4184
YouTubeN/AN/A126.0924174.9820418.135820.1317
DatasetsFluidCLBLDNBCDFSLDLMFLSNSLS
Karate0.00130.00500.00400.00130.00200.0209
Dolphins0.00200.00210.02250.00300.00800.0249
Polbooks0.00500.00600.09900.00600.02290.0891
Football0.01160.00600.02770.00590.01890.0854
DBLP66.223619.40911135.81482815.6651122.8283462.2714
Amazon46.064016.1649921.01043160.495558.3681458.5498
YouTube293.9875351.242810,723.350120,820.3919434.3692966.3772
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Liu, S.; Chen, H.; Li, S.; Yang, X. NSLS: A Neighbor Similarity and Label Selection-Based Algorithm for Community Detection. Mathematics 2025, 13, 1300. https://doi.org/10.3390/math13081300

AMA Style

Liu S, Chen H, Li S, Yang X. NSLS: A Neighbor Similarity and Label Selection-Based Algorithm for Community Detection. Mathematics. 2025; 13(8):1300. https://doi.org/10.3390/math13081300

Chicago/Turabian Style

Liu, Shihu, Hui Chen, Shuang Li, and Xiyang Yang. 2025. "NSLS: A Neighbor Similarity and Label Selection-Based Algorithm for Community Detection" Mathematics 13, no. 8: 1300. https://doi.org/10.3390/math13081300

APA Style

Liu, S., Chen, H., Li, S., & Yang, X. (2025). NSLS: A Neighbor Similarity and Label Selection-Based Algorithm for Community Detection. Mathematics, 13(8), 1300. https://doi.org/10.3390/math13081300

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop