Commit 67ece64
authored
fix(analytical): Fix Louvain algorithm's implementation as the quality bigger than 1.0 (#4426)
## What do these changes do?
When I test Louvain with the [DBLP
dataset](https://snap.stanford.edu/data/com-DBLP.html), I found the
QUALITY is bigger than 1.0 (which is 1.13) in the first iteration, which
is not correct, see
[here](https://en.wikipedia.org/wiki/Louvain_method#:~:text=Modularity%20is%20a%20scale%20value,nodes%20of%20a%20given%20network.)
QUALITY is in [-1, 1].
<img width="1028" alt="f1"
src="https://github.com/user-attachments/assets/aa10112e-2168-49a3-b0bd-1cd83ea06646"
/>
Then I found the Louvain's implementation has some problems, as the
Louvain only supports undirected graph now, the current edge weight in
each edge has calculated one more time as using both outgoing_edges()
and incoming_edges(), fix it , we only need use outgoing_edges() in
undirected graph.1 parent fbbbd93 commit 67ece64
File tree
2 files changed
+2
-12
lines changed- analytical_engine/apps/pregel/louvain
2 files changed
+2
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
226 | 227 | | |
227 | 228 | | |
228 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | 91 | | |
97 | 92 | | |
98 | 93 | | |
| |||
117 | 112 | | |
118 | 113 | | |
119 | 114 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | 115 | | |
127 | 116 | | |
128 | 117 | | |
| |||
0 commit comments