This repository was archived by the owner on Apr 22, 2020. It is now read-only.
Commit 205877b
Improve Label Propagation (#432)
Orienting on [Near linear time algorithm to detect community structures in large-scale networks][1], change LPA as follows:
- Randomize the order in which we calculate the nodes
- Since we are using iterators and want to avoid the allocation of an extra random-order-array, we're randomly skipping and reinserting elements while iterating. This does not truly shuffle the order but just mixes it up a bit.
- Run in asynchronous mode
- We write and read to the result array directly during iteration, which achieves the asynchronous execution __per-thread__
- Across threads, we may read older data during a single iteration, but this is ok
- We implicitly interpret a stale read as "not yet having been in this iteration" which further simulates shuffling of the input. It is as if this node would have been processed afterwards
- This differes from the stale read issue in #270 in that it's only during a single iteration, not across multiple iterations
- Early terminate if no changes have happened during an iteration
- A change only occurs if a node does not have the label that most of its neighbours have
- The paper suggest to confirm this sitaution after every itertation instead of using the 'label-has-changed' semantics, but this would require 2 passes per iteration, effectively doubling the runtime
- For the sake of performace, we sacrifice situations on which we could converge earlier or at all for completing the algortihm faster
Note that the algorithm does not guarantee a deterministic result, different invocatoins could lead to different clustering, based on the actual graph. This is as designed by the authors of the aforementioned paper.
Fixes #270
[1]: https://arxiv.org/pdf/0709.2938.pdf
* Sometime the cluster converges in just 2 iterations1 parent af61d7a commit 205877b
File tree
7 files changed
+437
-69
lines changed- algo/src/main/java/org/neo4j/graphalgo
- impl
- results
- core/src/main/java/org/neo4j/graphalgo/core/utils
- doc
- tests/src/test/java/org/neo4j/graphalgo
- algo
- impl
7 files changed
+437
-69
lines changedLines changed: 16 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | | - | |
| 12 | + | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
| 54 | + | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 88 | + | |
93 | 89 | | |
94 | 90 | | |
95 | 91 | | |
| |||
122 | 118 | | |
123 | 119 | | |
124 | 120 | | |
125 | | - | |
| 121 | + | |
126 | 122 | | |
127 | 123 | | |
128 | 124 | | |
| |||
133 | 129 | | |
134 | 130 | | |
135 | 131 | | |
136 | | - | |
137 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
138 | 136 | | |
139 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
140 | 144 | | |
141 | 145 | | |
142 | 146 | | |
| |||
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
150 | | - | |
| 154 | + | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| |||
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
161 | | - | |
| 165 | + | |
162 | 166 | | |
163 | 167 | | |
164 | 168 | | |
| |||
0 commit comments