|
25 | 25 | import org.neo4j.gds.api.Graph; |
26 | 26 | import org.neo4j.gds.api.IdMap; |
27 | 27 | import org.neo4j.gds.api.RelationshipIterator; |
28 | | -import org.neo4j.gds.api.properties.nodes.LongNodePropertyValues; |
29 | 28 | import org.neo4j.gds.api.properties.nodes.NodePropertyValues; |
30 | 29 | import org.neo4j.gds.beta.modularity.ImmutableModularityOptimizationStreamConfig; |
31 | 30 | import org.neo4j.gds.beta.modularity.ModularityOptimization; |
|
35 | 34 | import org.neo4j.gds.core.concurrency.ParallelUtil; |
36 | 35 | import org.neo4j.gds.core.loading.construction.GraphFactory; |
37 | 36 | import org.neo4j.gds.core.loading.construction.RelationshipsBuilder; |
| 37 | +import org.neo4j.gds.core.utils.OriginalIdNodePropertyValues; |
38 | 38 | import org.neo4j.gds.core.utils.paged.HugeLongArray; |
39 | 39 | import org.neo4j.gds.core.utils.partition.Partition; |
40 | 40 | import org.neo4j.gds.core.utils.partition.PartitionUtils; |
41 | 41 | import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; |
42 | | -import org.neo4j.values.storable.Value; |
43 | | -import org.neo4j.values.storable.Values; |
44 | 42 |
|
45 | 43 | import java.util.Optional; |
46 | 44 | import java.util.OptionalLong; |
@@ -98,7 +96,13 @@ public Louvain compute() { |
98 | 96 | long maxCommunityId = buildDendrogram(workingGraph, ranLevels, modularityOptimization); |
99 | 97 |
|
100 | 98 | workingGraph = summarizeGraph(workingGraph, modularityOptimization, maxCommunityId); |
101 | | - nextSeedingValues = new OriginalIdNodePropertyValues(workingGraph); |
| 99 | + nextSeedingValues = new OriginalIdNodePropertyValues(workingGraph) { |
| 100 | + @Override |
| 101 | + public OptionalLong getMaxLongPropertyValue() { |
| 102 | + // We want to use the maxSeedCommunity with value 0 in all subsequent iterations |
| 103 | + return OptionalLong.empty(); |
| 104 | + } |
| 105 | + }; |
102 | 106 |
|
103 | 107 | if (workingGraph.nodeCount() == oldNodeCount |
104 | 108 | || workingGraph.nodeCount() == 1 |
@@ -269,34 +273,6 @@ public void release() { |
269 | 273 | this.rootGraph.releaseTopology(); |
270 | 274 | } |
271 | 275 |
|
272 | | - static class OriginalIdNodePropertyValues implements LongNodePropertyValues { |
273 | | - private final Graph graph; |
274 | | - |
275 | | - public OriginalIdNodePropertyValues(Graph graph) { |
276 | | - this.graph = graph; |
277 | | - } |
278 | | - |
279 | | - @Override |
280 | | - public long longValue(long nodeId) { |
281 | | - return graph.toOriginalNodeId(nodeId); |
282 | | - } |
283 | | - |
284 | | - @Override |
285 | | - public Value value(long nodeId) { |
286 | | - return Values.longValue(longValue(nodeId)); |
287 | | - } |
288 | | - |
289 | | - @Override |
290 | | - public OptionalLong getMaxLongPropertyValue() { |
291 | | - return OptionalLong.empty(); |
292 | | - } |
293 | | - |
294 | | - @Override |
295 | | - public long size() { |
296 | | - return graph.nodeCount(); |
297 | | - } |
298 | | - } |
299 | | - |
300 | 276 | static final class RelationshipCreator implements Runnable { |
301 | 277 |
|
302 | 278 | private final RelationshipsBuilder relationshipsBuilder; |
|
0 commit comments