Evolution of weights on a connected finite graph
Abstract
On a connected finite graph, we propose an evolution of weights including Ollivier’s Ricci flow as a special case. During the evolution process, on each edge, the speed of change of weight is exactly the difference between the Wasserstein distance related to two probability measures and certain graph distance. Here the probability measure may be chosen as an -lazy one-step random walk, an -lazy two-step random walk, or a general probability measure. Based on the ODE theory, we show that the initial value problem has a unique global solution.
A discrete version of the above evolution is applied to the problem of community detection. Our algorithm is based on such a discrete evolution, where probability measures are chosen as -lazy one-step random walk and -lazy two-step random walk respectively. Note that the later measure has not been used in previous works [23, 16, 2, 20]. Here, as in [20], only one surgery needs to be performed after the last iteration. Moreover, our algorithm is much easier than those of [16, 2, 20], which were all based on Lin-Lu-Yau’s Ricci curvature. The code is available at https://github.com/mjc191812/Evolution-of-weights-on-a-connected-finite-graph.
keywords:
weighted graph; Ollivier’s Ricci flow; Lin-Lu-Yau’s Ricci flow; community detectionMSC:
[2020] 05C21; 05C85; 35R02; 68Q061 Introduction
In 1982, Ricci flow was first introduced by Hamilton [14] to deform a metric on a Riemannian manifold according to the differential equation involving a one-parameter family of metrics on a time interval, namely
where is the Ricci curvature of the metric . Generally speaking, Ricci flow smooths the metric, but it may lead to singularities. It was used in a genius way by Perelman [26] for solving the Poincaré conjecture. Moreover, it was used by Brendle and Schoen [4] for solving the differentiable sphere theorem.
Also, Ricci flow can be applied to discrete geometry, which includes complex networks and weighted finite graphs. To be more specific, we assume that is a connected weighted finite graph. Here denotes the vertex set, represents the edge set and stands for the weights on edges. In 2009, Ollivier [24] suggested a Ricci flow
(1.1) |
where, for each , is its Ollivier’s Ricci curvature, and is a parameter. Ni et al [23] found that discrete Ricci flow can be applied to detect community structures in networks, similar to classical Ricci flow on manifolds.
Community detection is an important research area in network analysis, aiming to identify clusters or groups of nodes that are more densely connected internally than with the rest of the network. This concept is crucial in various fields, including sociology [28, 31], biology [12, 3], and computer science[29]. Lots of algorithms [32, 11, 21, 18, 5, 25, 12] have been developed to detect and separate communities. Most of these algorithms focus on identifying dense clusters in a graph, using randomized approaches like label propagation or random walks, optimizing centrality measures such as betweenness centrality, or considering measures like modularity. Ricci curvature, introduced by Forman [10], Ollivier [24] and Lin-Lu-Yau [19], acknowledged as an essential tool in graph theory, facilitates deeper insights into network structures and provides an innovative approach to community detection. In 2019, based on (1.1) and a surgery process, Ni et al [23] established a very effective method of community detection. In 2021, Bai et al [1] studied a star coupling Ricci curvature based on Olloivier’s Ricci curvature. In 2022, this community detection method was extended by Lai et al [16] to a normalized Ricci flow based on [19, 1]. Experiments in [16] had shown that their methods were still effective. Very recently, the authors in the current paper [20] proposed a modified Ricci flow and a quasi-normalized Ricci flow for arbitrary weighted graphs. Notably, the results on global existence and uniqueness of solutions in [20] do not rely on the exit condition suggested by Bai et al. [2].
Although literatures [23] and [16] have shown great success in their applications, they lack theoretical support. In order to make up for this shortcoming, recently, concerning Lin-Lu-Yau’s Ricci curvature , Bai et al [2] obtained the existence and uniqueness of global solutions to the Ricci flow
(1.2) |
and the normalized Ricci flow
(1.3) |
under an exit condition: if , then the edge is deleted, where and is a path connecting and . Notice that in all of the above mentioned articles, the authors ask for surgery while extending solutions.
In [20], we find that if is replaced by on the right hand sides of (1.2) and analog of (1.3), namely
(1.4) |
and
(1.5) |
then both (1.4) and (1.5) have unique global solutions for each and all . In this setting, we removed the exit condition in [2], and did not require surgery in the process of flowing. Meanwhile, experiments show that (1.4) and (1.5) have the same impressive performance as (1.2) and (1.3), and have better modularity.
Currently, there is no existence result for solution to Ollivier’s Ricci flow (1.1). To ensure the global existence of the solution, we can modify the equation (1.1) by replacing the term with . Then we prove the existence and uniqueness of global solutions to the modified Ricci flow. In fact, we shall consider a more general evolution of weights on a connected weighted finite graph , which reads as
(1.6) |
where and denotes the Wasserstein distance between two probability measures and . One can easily see that if is an -lazy one-step random walk, then (1.6) reduces to . Through a large number of experiments, we conclude that (1.6) is effective in community detection. We look at how key factors, like and the number of iterations, affect the results. After being tested on real data and compared with existing methods, our approach demonstrates strong performance, especially in measuring modularity.
Before ending this introduction, we mention another interesting curvature flow, the Bakry-Émery curvature flow, studied by Cushing et al. Interested readers are referred to [7, 8] for details. The remaining part of this paper is organized as follows: In Section 2, we state our main results for the evolution of weights; In Section 3, we prove the Lipschitz property of the Wasserstein distance; The proof of Theorems 2.1 and 2.2 will be given in Section 4; In Section 5, We construct several examples of converging flow; Experiments will be done in Section 6.
2 Notations and main results
Let be a connected weighted graph, denotes the set of all vertices, denotes the set of all edges, and denotes the vector of weights on edges. Clearly, each function corresponds to a vector in . Nevertheless, when the weights change, can be regarded as a vector-valued function, namely
Here and in the sequel, . A function is said to be locally Lipschitz in with respect to , if for any fixed domain , there exists a constant depending only on such that for any vertex ,
(2.1) |
where represents the function obtained by replacing with in the expression of .
Throughout this paper, we use the the distance between two vertices and defined by
(2.2) |
where the infimum is taken over all paths connecting and . Obviously, the function is considered not only as a vector , but also a vector-valued function , in particular, each is a function of . Given and in . Let and be two distance functions determined by and respectively. Then, by ([20], Lemma 2.1), for any two fixed vertices and ,
(2.3) |
Thus the distance function is Lipschitz in .
We are now defining a set of functions
(2.4) |
Note that for any fixed , each is a probability measure. In practical problems, probability measures involving the weights are more meaningful. For example, given any number , the -lazy one-step random walk reads as
(2.5) |
Obviously belongs to . Denote the one-step neighbor of by , and the two-step neighbor of by . Similarly, an -lazy two-step random walk is represented by
(2.6) |
One can easily check that for all and all . Clearly, and are also two functions of , and both of them are locally Lipschitz in with respect to .
Let and be two probability measures. A coupling between and is defined as a map satisfying for all ,
While the Wasserstein distance between and reads
where the infimum is taken over all couplings between and .
Assuming that , we consider an evolution of weights according to
(2.7) |
Our first result reads as follows.
Theorem 2.1.
Let be a connected weighted finite graph, where is the vertex set, is the edge set, and is an arbitrary weight on . If satisfies that for each vertex , is locally Lipschitz with respect to , then the flow (2.7) has a unique solution for .
Analogous to [20], we consider a quasi-normalized flow
(2.8) |
Theorem 2.2.
As we mentioned above, -lazy random walks and are locally Lipschitz in . As a consequence, both and are appropriate candidates for satisfying the assumptions in Theorems 2.1 and 2.2. Both the proofs of Theorems 2.1 and 2.2 are based on the following lines: Consider the differential system
where represents the right hand side of the system (2.7) or (2.8). We first prove the local Lipschitz continuity of . Together with the ODE theory ([30], Chapter 6), this implies the local existence and uniqueness of solutions. Next, we prove there exists a constant such that
This leads to long time existence of solutions. More details are left to Section 4.
Addressing the convergence of solutions to systems (2.7) or (2.8) poses a significant challenge, and we do not know how to obtain general convergence results except for a few special cases involving particular graphs (see Section 5 below). Even so, the global existence of solution is sufficient for practical applications, such as in community detection problems, which will be discussed in Section 6.
3 A key lemma
In this section, we prove a key lemma to be used later. Using the same notations as in Section 2. we have the following:
Lemma 3.1.
If and, for each vertex , the probability measure is locally Lipschitz in , then the Wasserstein distance is also locally Lipschitz in .
Proof.
Given two vertices , and two weights , in . Assume that Wasserstein distances and are determined by and respectively, as well as and . With no loss of generality, we assume there exist some constants and such that for each ,
(3.1) |
By the Kantorovich-Rubinstein duality formula,
(3.2) | |||
(3.3) |
where
the distance functions and are determined by and respectively.
Now we distinguish two cases to proceed.
Case 1. .
In view of (3.2), there exists some such that
By ([20], Lemma 2.1), we have for all vertices and ,
It then follows that
Set
Since
for all , we have . By our assumption is locally Lipschitz in with respect to , there exists a constant , depending only on and , such that for all and satisfying (3.1),
As a consequence, we obtain
where is the number of all vertices of .
Case 2. .
By swapping the positions of and , we have by the same argument as in Case 1,
Combining Cases 1 and 2, we complete the proof of the lemma.
4 Proof of Theorems 2.1 and 2.2
Proof of Theorem 2.1.
We divide the proof into two parts.
Part 1. Short time existence.
Set , . Given any vector . In fact, the evolution of weights (2.7) is the ordinary differential system
(4.1) |
where and is a map represented by
where and , . From Lemma 3.1 and
([20], Lemma 2.1), we know that all , , are locally Lipschitz in
, and so is . By the ODE theory ([30], Chapter 6), there exists a constant such that the ordinary differential system (4.1) has a unique
solution on .
Part 2. Long time existence.
According to the conclusion of the first part, we may define
If , then (4.1) has a unique solution on the time interval ; moreover, according to the ODE theory ([30], Chapter 6), we have either
(4.2) |
or
(4.3) |
where and .
Let be fixed. Since
(4.4) |
this together with (4.1) implies
Thus we have
(4.5) |
Noting also that each coupling between and satisfies and , and that for all vertices , we obtain
(4.6) | |||||
where, in the first equality, is taken from all couplings between probability measures and . In view of (4.1), it follows that
Then integration by parts gives
(4.7) |
Combining (4.5) and (4.7), we have
for all , which contradicts (4.2) and (4.3).
Therefore , and thus (4.1) has a unique solution on .
Proof of Theorem 2.2.
Given . Let be a vector-valued function written as , where
and . From Lemma 3.1 and ([20], Lemma 2.1), we conclude that is locally Lipschitz in , namely if satisfies , then there exists a constant depending only on such that
Hence, according to the ODE theory ([30], Chapter 6), there exists some such that the flow (2.8) has a unique solution on . Let
If , then (2.8) has a unique solution for all . However, the ODE theory ([30], Chapter 6) implies either
(4.8) |
or
(4.9) |
In view of (4.4) and (4.6), we obtain for each ,
This together with (2.8) gives for each ,
(4.10) |
and
(4.11) |
From the left side of (4.10), we conclude that for all and each , contradicting (4.8). While from (4.11), we conclude that
for all , contradicting (4.9). Therefore , as we desired.
5 Examples
According to Theorems 2.1 and 2.2, we know that both of evolutions of weights
(2.7) and (2.8) have unique global solutions. However, in general, we do not ensure that these solutions
converge. In this section, we shall only construct examples of convergent solutions to (2.7) for special graphs and constant
initial weights, but leave the case (2.8) to interested readers.
Example 1. Let be a line segment illustrated in Figure 1, where , , and is the initial weight of the edge . For any , the -lazy one-step random walks are written as
Write and . For , one calculates the Wasserstein distance between and as , and the graph distance . As a consequence, the flow (2.7) becomes
Thus for all . Similarly, one derives that for , (2.7) has the unique
solution for all . In both cases, along the flow (2.7), converges to zero exponentially.
Example 2. Let be a three-point path in Figure 2, where , , and is the initial weight. Let , and , where
and
Assuming that , we have for , for , and the Wasserstein distance for , for , and . Obviously, the initial value problem
has a solution
(5.1) |
From Theorem 2.1, we know that (2.7) has a unique global solution. Hence (5.1)
is the solution of (2.7) with the initial weights .
Example 3. Let be a triangle in Figure 3, where , , . Assume that is another weight of , under which we have
This leads to
For , the initial value problem
has a solution . For , the initial value problem
has a solution . Let ,
and . Then the unique global solution of the flow (2.7) is
.
Example 4. is a square in Figure 4, , , . For weights , we have for ,
and
This together with the differential equation
gives
(5.2) |
Set for all . The evolution problem (2.7) has a unique global solution
with given as in (5.2).
Example 5. is complete graph with 4 vertices in Figure 5, , , . For weights , we have for ,
Moreover, we calculate
Setting for all , we have that the evolution problem (2.7) has a unique global solution , where
Example 6. Let be a star in Figure 6, , , . For weights , we have for ,
We also have
and thus
. Setting for all , we derive that the flow (2.7) has a unique global solution , where
6 Experimental results
In this section, we first discretize systems (2.7) and (2.8), and then apply the corresponding algorithms to community detection. Next, we use the usual criteria and real-world datasets to evaluate the accuracy of our method in community detection. Then, we examine how some key parameters influence the accuracy of algorithm. Finally, our approach is compared with existing methods.
6.1 Discretization and algorithm design
If we choose to be -lazy one-step random walk (2.5), then the system (2.7) is a modification of (1.1), namely
(6.1) |
While the system (2.8) becomes a quasi-normalized version of (6.1), which reads as
(6.2) |
If we choose as an -lazy two-step random walk given by (2.6), then we have special cases of (2.7) and (2.8) as follows:
(6.3) |
(6.4) |
A discrete version of (6.1) can be written as
where is a step size of discretization. Since other discrete versions of (6.2)-(6.4) are very similar, we omitted them here. To balance the computer’s calculation accuracy and error, we set step size .
The pseudo-code in Algorithm 1 below demonstrates the iterations process for the discrete versions of (6.1) and (6.2), and the surgery in the final iteration.
Now we demonstrate a simple application of Algorithm 1. Let be as in Figure 7, be the weight of edge and be Ollivier’s Ricci curvature given by (6.2) with . Red and blue represent the edges within the two communities, and green edges are the edges connecting the two communities. The initial weight on each edge is assumed to be 1. The weights and curvatures of edges not shown can be derived from the symmetry. The first graph is the initial calculated curvature and weight. The second graph is the result after thirty iterations by (6.2). The bottom graph is the community detection result after the surgery.
Similar to Algorithm 1, the discrete versions of (6.3) and (6.4) can be applied to design Algorithm 2.
Our algorithms are primarily complex due to the tasks of finding the shortest path in the graph and solving a linear programming problem. The time complexities for these tasks are and respectively. Here, represents the average degree of the network, and and represent the number of edges and vertices in the network, respectively. Despite the sparse connectivity of the network, where , often surpasses in most scenarios. Consequently, the computational complexity of our approach is .
6.2 Real-world datasets and criteria
For the real-world datasets, we select three distinct scale community graphs. We shall use three different metrics to assess the precision of community detection in real-world datasets. We choose the adjusted Rand index (ARI) [15] and normalized mutual information (NMI) [9] as the criteria for evaluating the quality of clustering accuracy when compared to the ground truth. Furthermore, we choose modularity [5, 22] to measure the robustness of the community structure of a given graph without relying on ground-truth clustering. Basic information for real-world networks is listed in Table 1.
networks | vertexes | edges | #Class | AvgDeg | density | Diameter |
---|---|---|---|---|---|---|
Karate | 34 | 78 | 2 | 4.59 | 0.139 | 5 |
Football | 115 | 613 | 12 | 10.66 | 0.094 | 4 |
775 | 14006 | 18 | 36.15 | 0.047 | 8 |
The Karate dataset, referenced as [33], was collected from the members of a university karate club by Wayne Zachary in the 1970s. This network consists of 34 members and 78 edges, where the vertices represent individual members and the edges denote the connections between them. This data set is generally used to find the two groups of people into which the karate club fission after a conflict between two faculties.
In the football dataset, referenced as [12], the focus is on the NCAA football Division I games schedule for the 2000 season. It includes 115 teams (vertices) and 613 matches (edges). Each vertex represents a specific team, and the edges indicate the matches played between these teams. The dataset identifies 12 ground-truth communities or conferences. Since teams tend to play more frequently within their own conference, this network clearly exhibits a community structure.
After analyzing the NCAA Football League Network, we expanded our analysis to three larger-scale networks. These networks present additional challenges, particularly in terms of computational efficiency. The Facebook network dataset, known as [17], is derived from the Stanford Network Analysis Project and captures interaction networks within an online social networking platform. The benchmark community ground truth in this dataset is meticulously organized based on well-defined themes such as interests and affiliations.
Next, we describe the three criteria for evaluation employed in our assessment process. To be more specific, we let and be two partitions of the set of vertices (nodes). Denote the number of vertices in , while and represent the numbers of vertices in and , respectively. All these quantities are listed in Table 2.
sums | |||||
---|---|---|---|---|---|
sums |
Then the explicit expressions of the above mentioned three criteria are written below.
-
1.
Adjusted Rand Index
where is the number of different pairs from vertices, while symbols , and have the same meaning. The Adjusted Rand Index (ARI) is a statistical measure used in data clustering analysis. It quantifies the similarity between two partitions of a dataset by comparing the assignments of data points to clusters. The ARI value ranges from -1 to 1, where a value of 1 indicates a perfect match between the partitions and a value close to 0 indicates a random assignment of data points to clusters.
-
2.
Normalized Mutual Information
The Normalized Mutual Information (NMI) is a metric commonly utilized to evaluate the effectiveness of community detection algorithms. It facilitates the comparison of two clusters or communities by producing a value within the range of 0 to 1. A higher NMI value signifies a stronger resemblance between the two partitions or communities.
-
3.
Modularity
where represents the number of communities, is the number of connections within the th community, is the total degree of vertices in the th community, and is a resolution parameter, with a default value of . The parameter spans from to , with values approaching signifying a more robust community structure and superior partition quality. A positive value indicates an excess of edges within groups compared to what would be expected by chance. Modularity assesses how edges connect within specific groups compared to random link distribution among all nodes.
The ARI is a pair-counting measure that compares the number of element pairs correctly grouped together or separated in two partitions. It adjusts for the likelihood that some agreement might occur by chance, thereby offering a more reliable comparison between partitions than raw accuracy scores. Its sensitivity to cluster size differences makes it a particularly useful tool in cases where clusters vary significantly in size.
NMI, in contrast, originates from information theory, where it captures the shared information content between two partitions. By normalizing this shared information with respect to the entropy of each partition, NMI ensures consistency even as the number of communities changes, providing robustness to fluctuations in community structure.
Modularity Q offers an edge-centric perspective. It measures how well a network is partitioned into communities by comparing the observed fraction of intra-community edges with what would be expected in a random network. A higher Q value implies a more distinct community structure, independent of ground truth labels. This makes modularity particularly valuable in exploratory analyses where community structure is unknown.
To ensure clarity and coherence in the discussion, the following terminology will be used throughout:
-
1.
one_evol designates the modified Ollivier’s Ricci flow (6.1), incorporating an -lazy one-step random walk.
-
2.
The quasi-normalized form of this -lazy one-step random walk (6.2 )will be referred to as qn1_evol.
-
3.
When the system (6.3) utilizes an -lazy two-step random walk, it will be labeled two_evol.
-
4.
The quasi-normalized variant of two-step system (6.4) will be called qn2_evol.
6.3 Analysis of key parameters
In Algorithms 1 and 2, parameters and the maximum iteration significantly influence the final results. In this section, we shall examine the impact of these two parameters on the experimental outcomes, detailed in Sections 6.3.1 and 6.3.2, respectively.
6.3.1 Impact of on experimental results
Note that all of the aforementioned systems rely on the selection of . Extensive experiments conducted by C. C. Ni et al [23] have shown that when applying community detection based on (1.1) with an -lazy one-step random walk , yields the best results. Next, we shall study the impact of the alpha value on the -lazy two-step random walk system (6.3) and (6.4). The value range of is limited to . The experimental results are listed in Figures 8 and 9.


In Figure 8, the graph shows that ARI remains stable around 0.9 across different values, indicating that the clustering quality produced by the two_evol algorithm does not significantly change with variations in . This suggests a high degree of consistency in clustering performance. Similar to ARI, the NMI values are almost constant at around 0.9, indicating that the clustering similarity remains high regardless of the value, and thus the algorithm produces highly stable clustering results. The Modularity line shows minimal fluctuation, maintaining a value close to 0.9 across all values. This indicates that the quality of community detection within the network remains steady even as changes, and the modularity is robust to parameter variations. The cost time shows a distinct variation from . At , the cost time peaks sharply, reaching around 1000 ms. However, as approaches , the cost time rapidly decreases to nearly 100 ms.
In Figure 9, ARI remains very stable, consistently near 0.9, indicating minimal impact of on the clustering quality in the qn2_evol algorithm. NMI also stays steady at approximately 0.9, similar to the first graph, further reinforcing the stability of the algorithm with respect to clustering similarity. Modularity shows little variation, remaining close to 0.9 across different values, suggesting that the quality of community detection in qn2_evol is largely unaffected by changes in . Compared to two_evol, the cost time for qn2_evol is notably lower, hovering around 400 ms for most values. Similar to two_evol, the computation time significantly decreases to nearly zero as approaches 1, although the overall computational cost for qn2_evol remains much lower across the entire range of values. This suggests that qn2_evol is generally more efficient than two_evol, especially in terms of computational cost, making it potentially more suitable for applications where efficiency is a priority.
The ARI, NMI, and modularity curves in both graphs remain consistently high and stable (around 0.9), indicating that both algorithms maintain strong clustering performance across all values. This stability suggests that the clustering quality and the effectiveness of network partitioning are not highly sensitive to changes in the parameter. Therefore, the choice of does not substantially affect the algorithms’ ability to produce accurate and consistent clustering.
Cost time varies significantly with , showing a sharp peak for two_evol around = 0.5, while qn2_evol displays lower and more stable computational costs. For both algorithms, the computational cost drops sharply at approaches 1, implying that the algorithms become much more efficient at this value. However, qn2_evol consistently exhibits lower computational complexity than two_evol, suggesting that it may be a more efficient algorithm overall.
The sharp drop in computation time at approaches 1 suggests that this particular value of could be leveraging some form of internal optimization in both algorithms, drastically reducing the time complexity. When approaches 1, the expression in (2.6) becomes relatively straightforward. This phenomenon provides a guideline for selecting values that optimize computational efficiency without sacrificing clustering performance.
In the subsequent sections, we stick to as our experiment parameter setting to maintain consistency in algorithms for -lazy one-step random walk and two-step random walk.
6.3.2 Effect of iterations on experimental results
The impact of iterations on experimental results is illustrated in Figures 10 through 13 below. Our analysis indicates that the application of normalization had a negligible impact on the final results of community detection, regardless of whether it was implemented. In other words, Figures 10 and 11 display the same pattern, while Figures 12 and 13 are nearly identical. Based on this observation, we focus comparison on the qn1_evol and qn2_evol algorithms.






In Figure 11 (a), modularity starts below 0.8, increases over the first few iterations, and stabilizes around 0.85. ARI and NMI have some fluctuations in the initial few iterations, with ARI settling around 0.48 and NMI stabilizing at around 0.4. (b) indicates all three metrics (modularity, ARI, NMI) are stable throughout the iterations, starting at higher values (modularity 0.9, ARI 0.85, NMI 0.8) and maintaining these levels across all iterations. While (c) shows that modularity starts slightly above 0.8 and stabilizes around 0.85, while ARI and NMI remain stable throughout (ARI 0.85 and NMI 0.75).






In Figure 13 (a), modularity starts around 0.8, increases and stabilizes around 0.85 after some oscillation. ARI and NMI exhibit minor fluctuations at the beginning, with ARI settling around 0.6 and NMI around 0.45. (b) shows all metrics are stable, with Modularity 0.9, ARI 0.85, and NMI 0.8 from the beginning until the end of the iterations. (c) says modularity starts at about 0.9 and gradually decreases to stabilize around 0.85. ARI and NMI remain stable throughout, with ARI 0.85 and NMI 0.75.
When evaluating qn1_evol on the small karate network in Figure 11 (a), the modularity score exhibited rapid growth in the initial iterations, reaching a stable value of approximately 0.85 after five iterations. This suggests that the algorithm can efficiently optimize modularity, demonstrating a capacity for quick convergence. Such convergence implies that the algorithm is effective in detecting community structures within the network. However, the adjusted Rand index (ARI) metric displays noticeable volatility during the early stages, with an initial increase followed by a sharp decline, eventually stabilizing at a lower value near 0.4. This indicates that the algorithm undergoes substantial changes early on, leading to an initial improvement in performance but later succumbing to overfitting, which results in diminished accuracy in the long term. In practical scenarios, this issue could be mitigated by fine-tuning the number of iterations. Similarly, the normalized mutual information (NMI) measure follows a comparable pattern to ARI, experiencing minor fluctuations at the start but generally stabilizing around 0.5.
For the qn2_evol algorithm on the same karate network in Figure 13 (a), the modularity indicator shows a slower increase compared to qn1_evol, but it eventually stabilizes at a similar final value of 0.85. This more gradual rise can be attributed to the algorithm’s conservative optimization strategy, likely incorporating regularization to prevent excessive fluctuations caused by rapid adjustments. While the slower growth may seem less efficient, the steadier performance implies greater robustness in optimizing modularity. The ARI score for this algorithm remains consistently around 0.4, with little variation, suggesting a stable, though less adaptable, approach. Similarly, the NMI score exhibits minimal change from the outset, hovering around 0.5, indicating limitations in the algorithm’s ability to maintain cluster consistency in smaller networks.
In the evaluation of medium-sized networks, such as the football network depicted in Figures 11 (b) and 13 (b), as well as large networks, exemplified by Facebook in Figures 11 (c) and 13 (c), both qn1_evol and qn2_evol demonstrate comparable performance across the three primary metrics. In both cases, the algorithms converge on optimal results after relatively few iterations, underscoring their efficiency in community detection. Despite minor fluctuations in certain indicators as the number of iterations increases, both algorithms demonstrate strong overall consistency, highlighting their stability and robustness in handling networks of varying sizes.
In summary, tests on networks of different sizes show that the qn1_evol and qn2_evol algorithms work similarly for community detection. Both algorithms reach their results quickly and require fewer iterations, which makes them efficient and stable. Although there are slight changes in the indicators during the process, they maintain overall consistency, demonstrating their reliability. The qn1_evol algorithm optimizes modularity faster in small networks but can overfit. In contrast, the qn2_evol algorithm takes a more careful approach, providing better stability. These findings suggest that both algorithms perform well in community detection for various network sizes, especially in medium to large networks.
6.4 -lazy one-step random walk
In this subsection, the experimental results are shown in various charts comprising three parts: (a) histograms of Ricci curvatures and edge weights before discrete flow; (b) histograms of Ricci curvatures and edge weights after discrete flow; (c) evaluation metrics after surgery. The results of the -lazy one-step random walk on three real-world datasets are presented from Figures 14 to 16 below.



In Figure 14 (a), the initial curvature distribution across edges spans from approximately -70 to 0, with most values clustering near 0 and a few showing highly negative curvatures, around -70. These significantly negative curvatures may highlight regions within the graph where structural imbalance is prominent. Additionally, most edge weights are near zero, while a smaller subset approaches values of 3 to 3.5, signaling varying connectivity strengths across the graph.
After five iterations, Figure 14 (b) illustrates a markedly narrower curvature distribution, now ranging between -25 and 0. The Ricci flow process effectively mitigates extreme negative curvatures, bringing more edges close to zero curvature, which suggests an improved structural balance. The edge weight distribution, though still skewed toward low values, demonstrates a slight shift toward higher weights, indicating that iterative weight adjustments may contribute to stabilizing graph connectivity.
Figure 14 (c) tracks the behavior of various metrics as the edge weight threshold decreases. Initially, three metrics show consistency at higher thresholds, rising to an optimal point before dropping off as the cutoff approaches zero. This suggests that excessive removal of low-weight edges can disrupt community structure, emphasizing the importance of balanced pruning in preserving the graph’s integrity.



In Figure 15 (a), initial Ricci curvature values range widely from approximately -140 to 0, with most edges exhibiting curvatures near 0 and a smaller portion reaching significantly negative values around -140. This distribution suggests areas of substantial geometric imbalance within the graph, as these highly negative curvatures indicate regions of structural tension or weak connectivity. The distribution of edge weights is also skewed, with most weights close to zero, and a few reaching approximately 5, which implies a sparse, weakly connected network before applying the discrete flow.
After the Ricci flow, as illustrated in Figure 15 (b), the curvature values become more compressed, spanning a reduced range from -35 to 0. This reduction in extreme negative values and more even curvature distribution signal that the flow has effectively smoothed the graph’s geometry, diminishing pronounced imbalances. Though edge weights remain predominantly low, there is a minor shift towards higher weights, indicating a subtle increase in connectivity strength and enhanced structural balance across the graph.
In Figure 15 (c), modularity sharply rises as edge weight cutoffs decrease from 5 to around 3, then stabilizes at an elevated level, suggesting that removing weaker edges sharpens community clarity. Beyond a weight threshold of about 3, further pruning yields diminishing modularity gains. A similar trend is seen in the adjusted Rand index (ARI), which increases with edge removal, aligning with the effects seen in normalized mutual information (NMI). NMI increases as weak edges are eliminated but stabilizes near 0.9, before declining when edge removal is too aggressive. This suggests that excessive pruning may compromise the integrity of community structure, emphasizing the need for balanced edge retention to preserve overall connectivity.



In Figure 16 (a), the initial Ricci curvature distribution is notably narrow, with most values clustering near zero, suggesting a largely uniform structural balance in the Facebook graph. A limited number of edges have slightly negative curvatures, yet the overall variation is minimal before the flow application. The edge weight distribution is skewed toward lower values, with the majority of weights near zero and only a few higher-weight edges reaching up to 8 or 9. This distribution implies that, although the graph has a few strong connections, most edges represent weak connections prior to the flow.
After Ricci flow, as depicted in Figure 16 (b), the range of Ricci curvatures expands considerably, now extending from -50 to 0. This broader distribution introduces more negative curvature values, suggesting that the Ricci flow enhances geometric diversity and potentially strengthens structural balance within the graph. Edge weights remain largely consistent with their initial spread; low-weight edges are still prevalent, while a small portion maintains higher weights. This pattern implies that, with limited iterations, the Ricci flow mainly adjusts curvature while leaving the edge weight distribution largely unchanged, reflecting a refined structural equilibrium.
Figure 16 (c) illustrates that modularity increases as weak edges are pruned, signifying enhanced community clarity. However, further pruning beyond certain thresholds yields diminishing returns, with modularity eventually stabilizing. The adjusted Rand index (ARI) also rises as weaker edges are removed but drops sharply at very low cutoffs, indicating a sensitivity of community structure to aggressive edge removal. Normalized mutual information (NMI) follows a similar trend, rising with edge pruning and stabilizing over a range of cutoffs, suggesting that moderate pruning strengthens community integrity. However, excessive removal ultimately weakens the structure, underscoring the need for balanced edge retention to maintain cohesive community structures.
6.5 -lazy two-step random walk
Based on equations (6.3), (6.4), and Algorithm 2, we only focus on the distance and Wasserstein distance , where belongs to . To maintain consistency with previous discussions, throughout this subsection, we continue to use the symbol of Ricci curvature
It is important to note that introducing Ricci curvature is not essential in this context. The results of the -lazy two-step random walk on three real-world datasets are presented from Figures 17 to 19. Since the experimental results for the three datasets exhibit similar trends, we only discuss the experimental results of two_evol on football. Figure 18 presents the histograms of Ricci curvatures and edge weights before and after applying the discrete flow, as well as the changes in modularity, ARI, and NMI with respect to the edge weight cutoff. Readers interested in further analysis will find similar patterns in Figures 17 and 19, suggesting a consistent effect of two_evol across different networks.









Before applying the discrete Flow, both the distribution of Ricci curvatures and the edge weights exhibit notable imbalances in Figure 18 (a). The Ricci curvatures are broadly distributed, with most values concentrated in the negative range between -100 and 0, indicating significant negative curvature across the network. This suggests that the community structures in the initial network are sharply divided, with uneven geometric characteristics. Similarly, the edge weights show a concentration near zero, pointing to weak associations across much of the network. Only a few edges have higher weights, reflecting stronger connections in certain local areas, but overall, the network is characterized by sparse and weakly connected components.
After the application of Discrete Ricci Flow, the network structure undergoes a significant transformation. According to Figure 18 (b), the curvature distribution becomes more balanced, with values mostly ranging between -35 and 0, indicating a homogenization of the network’s geometric properties. This suggests that the flow has smoothed out the community boundaries, leading to a more cohesive and uniform structure. In parallel, the edge weight distribution remains centered around lower values, but there is an increase in the number of edges with higher weights. This shift indicates that Discrete Ricci Flow not only balances the network but also strengthens the associations within it, particularly in areas that previously had weak connections.
In terms of evaluation metrics in Figure 18 (c), modularity, Adjusted Rand Index (ARI), and Normalized Mutual Information (NMI) all display clear improvements following the application of Discrete Ricci Flow, as illustrated in the corresponding plots. As the edge weight cutoff decreases, modularity rapidly increases before stabilizing, indicating a more defined and pronounced community structure. Similarly, ARI shows a sharp increase before leveling off, reflecting improved clustering consistency, where the detected community structures align more closely with the true community divisions. Finally, the NMI follows a comparable trajectory, with its values rising and stabilizing at a high level, highlighting the enhanced information-theoretic similarity between the observed and actual community structures. These results collectively demonstrate that Discrete Ricci Flow not only optimizes the network’s geometric structure but also improves its functional characteristics, as evidenced by the refined community detection metrics.
Initially, all these indicators are zero because only a few edges are removed, and there is minimal community structure. However, the indicators gradually increase, reach a peak, and then stabilize as the cutoff value increases. When the cutoff approaches , most of the edges are deleted, leading to a rapid drop in these indicators, essentially reaching zero.
The application of discrete Ricci Flow leads to a significant improvement in the network’s geometric structure, as evidenced by the more uniform distribution of Ricci curvatures and the better-balanced edge weight distribution. The evaluation metrics demonstrate that community detection improves substantially as the edge weights are adjusted, with the metrics stabilizing at high values. This confirms the effectiveness of discrete Ricci Flow in enhancing both the performance and consistency of community detection algorithms.
6.6 Comparison with other methods
We shall compare our methods of community detection with three traditional machine learning methods, namely the Girvan Newman algorithm based on edge betweenness [12], the greedy modularity algorithm based on modularity maximization [5, 27], and the label propagation algorithm based on stochastic methods [6]. We also use another five different models based on Ricci curvature for comparison, including unnormalized discrete Ollivier’s Ricci flow (DORF) [23], normalized discrete Ollivier’s Ricci flow (NDORF), normalized discrete Lin-Lu-Yau’s Ricci flow (NDSRF) [16], and modifications of discrete Lin-Lu-Yau’s Ricci flow (Rho; RhoN) [20]. The results in Table 3 demonstrate the effectiveness of our evolutionary algorithms (the last four methods) in detecting communities in real-world scenarios.
Methods\Networks | Karate club | Football | |||||||
---|---|---|---|---|---|---|---|---|---|
ARI | NMI | Q | ARI | NMI | Q | ARI | NMI | Q | |
Girvan Newman | 0.77 | 0.73 | 0.48 | 0.14 | 0.36 | 0.50 | 0.03 | 0.16 | 0.01 |
Greedy Modularity | 0.57 | 0.56 | 0.58 | 0.47 | 0.70 | 0.82 | 0.49 | 0.68 | 0.55 |
Label Propagation | 0.38 | 0.36 | 0.54 | 0.75 | 0.87 | 0.90 | 0.39 | 0.65 | 0.51 |
DORF | 0.59 | 0.57 | 0.69 | 0.93 | 0.94 | 0.91 | 0.67 | 0.73 | 0.68 |
NDORF | 0.59 | 0.57 | 0.69 | 0.93 | 0.94 | 0.91 | 0.68 | 0.73 | 0.68 |
NDSRF | 0.59 | 0.57 | 0.68 | 0.93 | 0.94 | 0.91 | 0.68 | 0.73 | 0.68 |
Rho | 0.77 | 0.68 | 0.82 | 0.89 | 0.92 | 0.90 | 0.64 | 0.72 | 0.63 |
RhoN | 0.77 | 0.68 | 0.84 | 0.89 | 0.93 | 0.92 | 0.69 | 0.72 | 0.95 |
one_evol | 0.59 | 0.57 | 0.87 | 0.90 | 0.93 | 0.91 | 0.70 | 0.72 | 0.95 |
qn1_evol | 0.59 | 0.57 | 0.87 | 0.90 | 0.93 | 0.91 | 0.70 | 0.72 | 0.95 |
two_evol | 0.38 | 0.49 | 0.85 | 0.90 | 0.93 | 0.91 | 0.70 | 0.72 | 0.95 |
qn2_evol | 0.38 | 0.49 | 0.85 | 0.90 | 0.93 | 0.91 | 0.70 | 0.72 | 0.95 |



The comparative performance of various algorithms on real-world networks, as depicted in the above Table 3 and Figures 20 to 22 below, underscores the distinct advantages of evolutionary algorithms, particularly in large scale networks. Algorithms such as one_evol, qn1_evol, two_evol, and qn2_evol consistently achieve superior results in modularity, as seen in Figure 22, reaching a peak modularity value of 0.95 on the Facebook network. This performance highlights evolutionary algorithms’ efficacy in optimizing community structures, especially where well-defined, connected communities are essential.
Traditional algorithms like Girvan Newman, though effective on smaller networks such as Karate Club (ARI = 0.77, NMI = 0.73), show limited scalability. For instance, on the Facebook network, its ARI drops to 0.03, and modularity Q falls to 0.01, underscoring its difficulty in managing the complexity of larger social networks. Similarly, though algorithms of DORF, NDORF, and NDSRF perform robustly on medium networks like Football (ARI = 0.93, NMI = 0.94), they fall short of the modularity optimization achieved by our evolutionary methods on larger network Facebook.
Evolutionary algorithms excel due to their ability to balance multiple performance metrics, consistently achieving the highest modularity values without sacrificing accuracy on smaller networks. On the Facebook and Football networks, they maintain strong ARI and NMI values alongside top modularity scores, indicating both accurate community detection and quality optimization of partitions. Despite their less optimal performance on smaller networks like Karate Club, evolutionary algorithms remain resilient across varying network sizes, demonstrating adaptability and superior optimization for large-scale, real-world network analysis.
In summary, traditional methods such as Girvan Newman and those based on Ricci curvature, like the DORF series, Rho, and RhoN, have their strengths in specific contexts. However, evolutionary algorithms stand out as versatile and effective option, particularly for complex networks. Their consistent performance in achieving the highest modularity scores across various networks, along with competitive accuracy, makes them the preferred choice for network analysis when the primary goal is to optimize community structure.
7 Concluding remarks
In this study, we propose an evolution system for evolving weight of edge on connected finite graph according to the difference between two distances. One is the Wasserstein distance between two probability measures, the other is the distance between two vertices on the edge. Moreover, the corresponding initial value problem has been proven to have a unique global solution. Discrete version of this kind of evolution system can provide more effective algorithms for community detection than many algorithms in the same topic. Note that our systems do not require Ricci curvature on the graph. Extensive experiments on real-world datasets demonstrate that our algorithm is both easy to implement and robust across a range of parameter choices. This robustness underscores the practical applicability of our approach in accurately identifying community structures with minimal tuning. Future work may extend this method to larger, more complex networks, further enhancing its utility across diverse applications in network science.
Acknowledgements
This research was partly supported by Public Computing Cloud, Renmin University of China.
Data availability All data needed are available freely. One can find the codes of our algorithms at https://github.com/mjc191812/Evolution-of-weights-on-a-connected-finite-graph.
Declarations
Conflict of interest The authors declared no potential conflicts of interest with respect to the research, authorship, and publication of this article.
Ethics approval The research does not involve humans and/or animals. The authors declare that there are no ethics issues to be approved or disclosed.
References
- [1] S. Bai, A. Huang, L. Lu, S. T. Yau, On the sum of ricci-curvatures for weighted graphs, Pure Appl. Math. Q. 17 (2021) 1599-1617.
- [2] S. Bai, Y. Lin, L. Lu, Z. Wang, S. Yau, Ollivier Ricci-flow on weighted graphs, arXiv: 2010.01802v8, 2024.
- [3] S. S. Bhowmick, B. S. Seah, Clustering and summarizing protein-protein interaction networks: a survey, IEEE Trans. Knowl. Data Eng. 28 (2015) 638-658.
- [4] S. Brendle, R. Schoen, Manifolds with -pinched curvature are space forms, J. Amer. Math. Soc. 22 (2009) 287-307.
- [5] A. Clauset, M. Newman, C. Moore, Finding community structure in very large networks, Phys. Rev. E 70 (2004) 066111.
- [6] G. Cordasco, L. Gargano, Community detection via semi-synchronous label propagation algorithms, 2010 IEEE International Workshop on: Business Applications of Social Network Analysis (BASNA), 1-8.
- [7] D. Cushing, S. Kamtue, S. Liu, F. Münch, N. Peyerimhoff, H. Snodgrass, Bakry-Émery curvature sharpness and curvature flow in finite weighted graphs, I. Theory, arXiv: 2204.10064, 2022.
- [8] D. Cushing, S. Kamtue, S. Liu, F. Münch, N. Peyerimhoff, H. Snodgrass, Bakry-Émery curvature sharpness and curvature flow in finite weighted graphs, II. Implementation, arXiv: 2212.12401, 2022.
- [9] L. Danon, J. Duch, A. Díaz-Guilera, A. Arenas, Comparing community structure identification, J. Stat. Mech. Theory Exp. 2005 (2005) P09008.
- [10] R. Forman, Bochner’s method for cell complexes and combinatorial Ricci curvature, Discrete Comput. Geom. 29 (2003) 323-374.
- [11] S. Fortunato, Community detection in graphs, Phys. Rep. 486 (2010) 75-174.
- [12] M. Girvan, M. E. J. Newman, Community structure in social and biological networks, Proc. Natl. Acad. Sci. 99 (2002) 7821-7826.
- [13] L. Guillaume, Fast unfolding of communities in large networks, J. Stat. Mech. Theory Exp. 2008 (2008) P1008.
- [14] R. Hamilton, Three-manifolds with positive ricci curvature, J. Differ. Geom. 17 (1982) 255-306.
- [15] L. Hubert, P. Arabie, Comparing partitions, J. Classif. 2 (1985) 193-218.
- [16] X. Lai, S. Bai, Y. Lin, Normalized discrete Ricci flow used in community detection, Phys. A 597 (2022) 127251.
- [17] J. Leskovec, SNAP datasets: Stanford large network dataset collection, http://snap.stanford.edu/data, 2014.
- [18] J. Leskovec, K. J. Lang, M. Mahoney, Empirical comparison of algorithms for network community detection, Proc. 19th Int. Conf. World Wide Web 2010 (2010) 631-640.
- [19] Y. Lin, L. Lu, S. T. Yau, Ricci curvature of graphs, Tohoku Math. J. 63 (2011) 605-627.
- [20] J. Ma, Y. Yang, A modified Ricci flow on arbitrary weighted graph, arXiv: 2408.09435v1, 2024.
- [21] M. Newman, Modularity and community structure in networks, Proc. Natl. Acad. Sci. 103 (2006) 8577-8582.
- [22] M. Newman, Networks: an introduction, Oxford Univ. Press, 2010.
- [23] C. C. Ni, Y. Y. Lin, F. Luo, J. Gao, Community detection on networks with ricci flow, Sci. Rep. 9 (2019) 9984.
- [24] Y. Ollivier, Ricci curvature of markov chains on metric spaces, J. Funct. Anal. 256 (2009) 810-864.
- [25] L. Peel, D. Larremore, A. Clauset, The ground truth about metadata and community detection in networks, Sci. Adv. 3 (2016) 08.
- [26] G. Perelman, The entropy formula for the ricci flow and its geometric applications, arXiv: math/0211159, 2002.
- [27] J. Reichardt, S. Bornholdt, Statistical mechanics of community detection, Phys. Rev. E 74 (2006) 016110.
- [28] O. Serrat, Knowledge solutions: Tools, methods, and approaches to drive organizational performance, Springer, 2017.
- [29] S. Tauro, C. Palmer, G. Siganos, et al., A simple conceptual model for the internet topology, GLOBECOM’01 IEEE Global Telecommun. Conf. 3 (2001) 1667-1671.
- [30] G. Wang, Z. Zhou, S. Zhu, S. Wang, Ordinary differential equations, (in Chinese), Higher Education Press, 2006.
- [31] S. Wasserman, Social network analysis: Methods and applications, Cambridge Univ. Press, 1994.
- [32] Z. Yang, R. Algesheimer, C. Tessone, A comparative analysis of community detection algorithms on artificial networks, Sci. Rep. 6 (2016) 30750.
- [33] W. Zachary, An information flow model for conflict and fission in small groups, J. Anthropol. Res. 33 (1977) 452-473.