diff --git a/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCut.java b/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCut.java index 6f285c7450..5043967011 100644 --- a/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCut.java +++ b/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCut.java @@ -222,7 +222,7 @@ public ApproxMaxKCutResult compute() { progressTracker.endSubTask(); - return ApproxMaxKCutResult.of(candidateSolutions[bestIdx], costs[bestIdx].get()); + return new ApproxMaxKCutResult(candidateSolutions[bestIdx], costs[bestIdx].get()); } } diff --git a/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutResult.java b/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutResult.java index ec5bd5a9c9..eee4824b93 100644 --- a/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutResult.java +++ b/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutResult.java @@ -19,24 +19,9 @@ */ package org.neo4j.gds.approxmaxkcut; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeByteArray; -@ValueClass -public interface ApproxMaxKCutResult { - // Value at index `i` is the idx of the community to which node with id `i` belongs. - HugeByteArray candidateSolution(); - - double cutCost(); - - static ApproxMaxKCutResult of( +public record ApproxMaxKCutResult( HugeByteArray candidateSolution, double cutCost - ) { - return ImmutableApproxMaxKCutResult - .builder() - .candidateSolution(candidateSolution) - .cutCost(cutCost) - .build(); - } -} + ) {} diff --git a/algo/src/main/java/org/neo4j/gds/betweenness/BetwennessCentralityResult.java b/algo/src/main/java/org/neo4j/gds/betweenness/BetwennessCentralityResult.java index f8165d2607..c48adcba11 100644 --- a/algo/src/main/java/org/neo4j/gds/betweenness/BetwennessCentralityResult.java +++ b/algo/src/main/java/org/neo4j/gds/betweenness/BetwennessCentralityResult.java @@ -26,13 +26,9 @@ import java.util.function.LongToDoubleFunction; -public class BetwennessCentralityResult implements CentralityAlgorithmResult { +public record BetwennessCentralityResult(HugeAtomicDoubleArray centralities) implements CentralityAlgorithmResult{ - private final HugeAtomicDoubleArray centralities; - BetwennessCentralityResult(HugeAtomicDoubleArray centralities){ - this.centralities=centralities; - } @Override public NodePropertyValues nodePropertyValues() { return NodePropertyValuesAdapter.adapt(centralities); @@ -43,7 +39,4 @@ public LongToDoubleFunction centralityScoreProvider() { return centralities::get; } - public HugeAtomicDoubleArray centralities(){ - return centralities; - } } diff --git a/algo/src/main/java/org/neo4j/gds/closeness/ClosenessCentralityResult.java b/algo/src/main/java/org/neo4j/gds/closeness/ClosenessCentralityResult.java index 620240c1bb..80f55a2677 100644 --- a/algo/src/main/java/org/neo4j/gds/closeness/ClosenessCentralityResult.java +++ b/algo/src/main/java/org/neo4j/gds/closeness/ClosenessCentralityResult.java @@ -27,14 +27,8 @@ import java.util.function.LongToDoubleFunction; -public class ClosenessCentralityResult implements CentralityAlgorithmResult { +public record ClosenessCentralityResult(HugeDoubleArray centralities) implements CentralityAlgorithmResult { - private final HugeDoubleArray centralities; - - ClosenessCentralityResult(HugeDoubleArray centralities) { - this.centralities = centralities; - } - @Override public NodePropertyValues nodePropertyValues() { return NodePropertyValuesAdapter.adapt(centralities); diff --git a/algo/src/main/java/org/neo4j/gds/conductance/Conductance.java b/algo/src/main/java/org/neo4j/gds/conductance/Conductance.java index 28a1d1a38e..b3359b321d 100644 --- a/algo/src/main/java/org/neo4j/gds/conductance/Conductance.java +++ b/algo/src/main/java/org/neo4j/gds/conductance/Conductance.java @@ -21,7 +21,6 @@ import org.apache.commons.lang3.mutable.MutableLong; import org.neo4j.gds.Algorithm; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.api.Graph; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.collections.hsa.HugeSparseDoubleArray; @@ -190,7 +189,7 @@ private RelationshipCounts accumulateCounts( progressTracker.endSubTask(); - return ImmutableRelationshipCounts.of(internalCountsBuilder.build(), externalCountsBuilder.build()); + return new RelationshipCounts(internalCountsBuilder.build(), externalCountsBuilder.build()); } private ConductanceResult computeConductances( @@ -244,7 +243,7 @@ private ConductanceResult computeConductances( progressTracker.endSubTask(); - return ConductanceResult.of( + return new ConductanceResult( conductancesBuilder.build(), globalConductanceSum.get() / globalValidCommunities.longValue() ); @@ -316,11 +315,10 @@ HugeSparseDoubleArray externalCounts() { } } - @ValueClass - interface RelationshipCounts { - HugeSparseDoubleArray internalCounts(); - HugeSparseDoubleArray externalCounts(); - } + record RelationshipCounts( + HugeSparseDoubleArray internalCounts, + HugeSparseDoubleArray externalCounts){} + } diff --git a/algo/src/main/java/org/neo4j/gds/conductance/ConductanceResult.java b/algo/src/main/java/org/neo4j/gds/conductance/ConductanceResult.java index 0e5320357e..98289c96af 100644 --- a/algo/src/main/java/org/neo4j/gds/conductance/ConductanceResult.java +++ b/algo/src/main/java/org/neo4j/gds/conductance/ConductanceResult.java @@ -19,24 +19,9 @@ */ package org.neo4j.gds.conductance; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.hsa.HugeSparseDoubleArray; -@ValueClass -public interface ConductanceResult { - HugeSparseDoubleArray communityConductances(); - - double globalAverageConductance(); - - static ConductanceResult of( +public record ConductanceResult( HugeSparseDoubleArray communityConductances, double globalAverageConductance - ) { - return ImmutableConductanceResult - .builder() - .communityConductances(communityConductances) - .globalAverageConductance(globalAverageConductance) - .build(); - } - -} + ) {} diff --git a/algo/src/main/java/org/neo4j/gds/degree/DegreeCentralityResult.java b/algo/src/main/java/org/neo4j/gds/degree/DegreeCentralityResult.java index c901704247..9a88fd35cd 100644 --- a/algo/src/main/java/org/neo4j/gds/degree/DegreeCentralityResult.java +++ b/algo/src/main/java/org/neo4j/gds/degree/DegreeCentralityResult.java @@ -24,21 +24,9 @@ import java.util.function.LongToDoubleFunction; -public class DegreeCentralityResult implements CentralityAlgorithmResult { +public record DegreeCentralityResult(long nodeCount, DegreeFunction degreeFunction) implements CentralityAlgorithmResult { - static DegreeCentralityResult EMPTY=new DegreeCentralityResult(0, v -> 0); - - private final DegreeFunction degreeFunction; - private final long nodeCount; - - DegreeCentralityResult(long nodeCount, DegreeFunction degreeFunction){ - this.degreeFunction=degreeFunction; - this.nodeCount=nodeCount; - } - - public DegreeFunction degreeFunction(){ - return degreeFunction; - } + static DegreeCentralityResult EMPTY = new DegreeCentralityResult(0, v -> 0); @Override public NodePropertyValues nodePropertyValues() { diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/fastrp/FastRPResult.java b/algo/src/main/java/org/neo4j/gds/embeddings/fastrp/FastRPResult.java index 6bb290fed9..ea23c0ad1a 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/fastrp/FastRPResult.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/fastrp/FastRPResult.java @@ -21,14 +21,5 @@ import org.neo4j.gds.collections.ha.HugeObjectArray; -public class FastRPResult { - private final HugeObjectArray embeddings; +public record FastRPResult(HugeObjectArray embeddings){} - public FastRPResult(HugeObjectArray embeddings) { - this.embeddings = embeddings; - } - - public HugeObjectArray embeddings() { - return embeddings; - } -} diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSage.java b/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSage.java index ef6c497e80..f57b71b15c 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSage.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSage.java @@ -21,9 +21,9 @@ import org.neo4j.gds.Algorithm; import org.neo4j.gds.api.Graph; +import org.neo4j.gds.collections.ha.HugeObjectArray; import org.neo4j.gds.core.concurrency.Concurrency; import org.neo4j.gds.core.model.Model; -import org.neo4j.gds.collections.ha.HugeObjectArray; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.embeddings.graphsage.GraphSageEmbeddingsGenerator; import org.neo4j.gds.embeddings.graphsage.GraphSageHelper; @@ -86,6 +86,6 @@ public GraphSageResult compute() { graph, features ); - return GraphSageResult.of(embeddings); + return new GraphSageResult(embeddings); } } diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageModel.java b/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageModel.java index 2b58610f77..6a1f3501a7 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageModel.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageModel.java @@ -19,13 +19,8 @@ */ package org.neo4j.gds.embeddings.graphsage.algo; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.embeddings.graphsage.Layer; -@ValueClass -public interface GraphSageModel { - - Layer[] layers(); - - GraphSageTrainConfig config(); -} +public record GraphSageModel( + Layer[] layers, + GraphSageTrainConfig config){} diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageResult.java b/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageResult.java index 58c8dbd6b0..50d4afc432 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageResult.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageResult.java @@ -19,14 +19,9 @@ */ package org.neo4j.gds.embeddings.graphsage.algo; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeObjectArray; -@ValueClass -public interface GraphSageResult { - HugeObjectArray embeddings(); - - static GraphSageResult of(HugeObjectArray embeddings) { - return ImmutableGraphSageResult.of(embeddings); - } +public record GraphSageResult( + HugeObjectArray embeddings) + { } diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashGNNCompanion.java b/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashGNNCompanion.java index e977175336..b01a650503 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashGNNCompanion.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashGNNCompanion.java @@ -22,7 +22,6 @@ import com.carrotsearch.hppc.BitSet; import com.carrotsearch.hppc.BitSetIterator; import org.apache.commons.math3.primes.Primes; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.core.utils.paged.HugeAtomicBitSet; import java.util.SplittableRandom; @@ -69,19 +68,13 @@ static void hashArgMin(BitSet bitSet, int[] hashes, HashGNN.MinAndArgmin result) result.argMin = argMin; } - @ValueClass - interface HashTriple { + record HashTriple(int a,int b,int c) { /* The values a, b and c represent parameters of the hash function: h(x) = x * a + b mod c, where 0 < a, b < c and c is a prime number. */ - int a(); - - int b(); - - int c(); static HashTriple generate(SplittableRandom rng) { int c = Primes.nextPrime(rng.nextInt(1, Integer.MAX_VALUE)); @@ -91,7 +84,7 @@ static HashTriple generate(SplittableRandom rng) { static HashTriple generate(SplittableRandom rng, int c) { int a = rng.nextInt(1, c); int b = rng.nextInt(1, c); - return ImmutableHashTriple.of(a, b, c); + return new HashTriple(a, b, c); } static int[] computeHashesFromTriple(int embeddingDimension, HashTriple hashTriple) { diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashGNNResult.java b/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashGNNResult.java index b06177ae1a..69e9786bde 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashGNNResult.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashGNNResult.java @@ -21,14 +21,4 @@ import org.neo4j.gds.api.properties.nodes.NodePropertyValues; -public class HashGNNResult { - private final NodePropertyValues embeddings; - - public HashGNNResult(NodePropertyValues embeddings) { - this.embeddings = embeddings; - } - - public NodePropertyValues embeddings() { - return embeddings; - } -} +public record HashGNNResult(NodePropertyValues embeddings) {} diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashTask.java b/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashTask.java index dcc4d4a232..e1dad16d4c 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashTask.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/hashgnn/HashTask.java @@ -21,7 +21,6 @@ import org.apache.commons.math3.primes.Primes; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.core.concurrency.Concurrency; import org.neo4j.gds.core.concurrency.RunWithConcurrency; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -35,7 +34,7 @@ import static org.neo4j.gds.embeddings.hashgnn.HashGNNCompanion.HashTriple.computeHashesFromTriple; -class HashTask implements Runnable { +final class HashTask implements Runnable { private static final double MAX_FINAL_INFLUENCE = 1e4; private static final int PRIME_LOWER_BOUND = 50_000; @@ -48,7 +47,7 @@ class HashTask implements Runnable { private List preAggregationHashes; private final ProgressTracker progressTracker; - HashTask( + private HashTask( int embeddingDimension, double scaledNeighborInfluence, int numberOfRelationshipTypes, @@ -95,13 +94,11 @@ public static List compute( return hashTasks.stream().map(HashTask::hashes).collect(Collectors.toList()); } - @ValueClass - interface Hashes { - int[] neighborsAggregationHashes(); - int[] selfAggregationHashes(); - - List preAggregationHashes(); + record Hashes( + int[] neighborsAggregationHashes, + int[] selfAggregationHashes, + List preAggregationHashes){ static long memoryEstimation(int ambientDimension, int numRelTypes) { long neighborAggregation = Estimate.sizeOfIntArrayList(ambientDimension); @@ -148,7 +145,7 @@ public void run() { progressTracker.logSteps(1); } - Hashes hashes() { - return ImmutableHashes.of(neighborsAggregationHashes, selfAggregationHashes, preAggregationHashes); + private Hashes hashes() { + return new Hashes(neighborsAggregationHashes, selfAggregationHashes, preAggregationHashes); } } diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2VecModel.java b/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2VecModel.java index f3c436d74c..bb4cd160bf 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2VecModel.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2VecModel.java @@ -174,7 +174,7 @@ Node2VecResult train() { } progressTracker.endSubTask(); - return ImmutableNode2VecResult.of(centerEmbeddings, lossPerIteration); + return new Node2VecResult(centerEmbeddings, lossPerIteration); } private HugeObjectArray initializeEmbeddings(LongUnaryOperator toOriginalNodeId, long nodeCount, int embeddingDimensions, Random random) { diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2VecResult.java b/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2VecResult.java index c71383239a..f349d99665 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2VecResult.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2VecResult.java @@ -19,15 +19,10 @@ */ package org.neo4j.gds.embeddings.node2vec; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeObjectArray; import org.neo4j.gds.ml.core.tensor.FloatVector; import java.util.List; -@ValueClass -public interface Node2VecResult { - HugeObjectArray embeddings(); - - List lossPerIteration(); -} +public record Node2VecResult(HugeObjectArray embeddings,List lossPerIteration) +{ } diff --git a/algo/src/main/java/org/neo4j/gds/harmonic/HarmonicResult.java b/algo/src/main/java/org/neo4j/gds/harmonic/HarmonicResult.java index 6ec837f4af..5d791b8fc8 100644 --- a/algo/src/main/java/org/neo4j/gds/harmonic/HarmonicResult.java +++ b/algo/src/main/java/org/neo4j/gds/harmonic/HarmonicResult.java @@ -26,13 +26,7 @@ import java.util.function.LongToDoubleFunction; -public class HarmonicResult implements CentralityAlgorithmResult { - - private final HugeAtomicDoubleArray centralities; - - HarmonicResult(HugeAtomicDoubleArray centralities) { - this.centralities = centralities; - } +public record HarmonicResult(HugeAtomicDoubleArray centralities) implements CentralityAlgorithmResult { @Override public NodePropertyValues nodePropertyValues() { diff --git a/algo/src/main/java/org/neo4j/gds/influenceMaximization/CELFResult.java b/algo/src/main/java/org/neo4j/gds/influenceMaximization/CELFResult.java index cc12229960..b8676337e6 100644 --- a/algo/src/main/java/org/neo4j/gds/influenceMaximization/CELFResult.java +++ b/algo/src/main/java/org/neo4j/gds/influenceMaximization/CELFResult.java @@ -23,17 +23,9 @@ import java.util.Arrays; -public class CELFResult { - private final LongDoubleScatterMap seedSetNodes; +public record CELFResult(LongDoubleScatterMap seedSetNodes){ - public CELFResult(LongDoubleScatterMap seedSetNodes){ - this.seedSetNodes=seedSetNodes; - } - - public LongDoubleScatterMap seedSetNodes(){ - return seedSetNodes; - } - public double totalSpread(){ - return Arrays.stream(seedSetNodes.values).sum(); + public double totalSpread() { + return Arrays.stream(seedSetNodes.values).sum(); } } diff --git a/algo/src/main/java/org/neo4j/gds/k1coloring/K1Coloring.java b/algo/src/main/java/org/neo4j/gds/k1coloring/K1Coloring.java index 1c2d4a29da..03da3c2a69 100644 --- a/algo/src/main/java/org/neo4j/gds/k1coloring/K1Coloring.java +++ b/algo/src/main/java/org/neo4j/gds/k1coloring/K1Coloring.java @@ -138,7 +138,7 @@ public K1ColoringResult compute() { progressTracker.endSubTask(); - return K1ColoringResult.of(colors,ranIterations, didConverge); + return new K1ColoringResult(colors,ranIterations, didConverge); } private long updateVolume() { diff --git a/algo/src/main/java/org/neo4j/gds/k1coloring/K1ColoringResult.java b/algo/src/main/java/org/neo4j/gds/k1coloring/K1ColoringResult.java index e425a4586c..d8650d5e39 100644 --- a/algo/src/main/java/org/neo4j/gds/k1coloring/K1ColoringResult.java +++ b/algo/src/main/java/org/neo4j/gds/k1coloring/K1ColoringResult.java @@ -20,44 +20,25 @@ package org.neo4j.gds.k1coloring; import com.carrotsearch.hppc.BitSet; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeLongArray; -@ValueClass @SuppressWarnings("immutables:subtype") -public interface K1ColoringResult { +public record K1ColoringResult(HugeLongArray colors, + long ranIterations, + boolean didConverge) { - HugeLongArray colors(); + public BitSet usedColors() { + var colors = colors(); + var nodeCount = colors.size(); + var usedColors = new BitSet(nodeCount); - long ranIterations(); - - boolean didConverge(); - - default BitSet usedColors(){ - var colors=colors(); - var nodeCount=colors.size(); - var usedColors = new BitSet(nodeCount); - - for (long u=0;u createTasks( diff --git a/algo/src/main/java/org/neo4j/gds/kcore/KCoreDecompositionResult.java b/algo/src/main/java/org/neo4j/gds/kcore/KCoreDecompositionResult.java index fb6d8e1d21..4aeae2014c 100644 --- a/algo/src/main/java/org/neo4j/gds/kcore/KCoreDecompositionResult.java +++ b/algo/src/main/java/org/neo4j/gds/kcore/KCoreDecompositionResult.java @@ -19,16 +19,6 @@ */ package org.neo4j.gds.kcore; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeIntArray; -@ValueClass -public interface KCoreDecompositionResult { - - HugeIntArray coreValues(); - int degeneracy(); - - static KCoreDecompositionResult of(HugeIntArray coreValues, int degeneracy){ - return ImmutableKCoreDecompositionResult.of(coreValues,degeneracy); - } -} +public record KCoreDecompositionResult(HugeIntArray coreValues, int degeneracy){} diff --git a/algo/src/main/java/org/neo4j/gds/labelpropagation/LabelPropagationResult.java b/algo/src/main/java/org/neo4j/gds/labelpropagation/LabelPropagationResult.java index 63cba22709..05b7f0107e 100644 --- a/algo/src/main/java/org/neo4j/gds/labelpropagation/LabelPropagationResult.java +++ b/algo/src/main/java/org/neo4j/gds/labelpropagation/LabelPropagationResult.java @@ -21,27 +21,4 @@ import org.neo4j.gds.collections.ha.HugeLongArray; -public class LabelPropagationResult { - - private final HugeLongArray labels; - private final boolean didConverge; - private final long ranIterations; - - public LabelPropagationResult(HugeLongArray labels, boolean didConverge, long ranIterations) { - this.labels = labels; - this.didConverge = didConverge; - this.ranIterations = ranIterations; - } - - public HugeLongArray labels() { - return labels; - } - - public boolean didConverge() { - return didConverge; - } - - public long ranIterations() { - return ranIterations; - } -} +public record LabelPropagationResult(HugeLongArray labels, boolean didConverge, long ranIterations) {} diff --git a/algo/src/main/java/org/neo4j/gds/leiden/Leiden.java b/algo/src/main/java/org/neo4j/gds/leiden/Leiden.java index e21ca572fa..542453e6cd 100644 --- a/algo/src/main/java/org/neo4j/gds/leiden/Leiden.java +++ b/algo/src/main/java/org/neo4j/gds/leiden/Leiden.java @@ -25,11 +25,11 @@ import org.neo4j.gds.api.Graph; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.api.schema.Direction; +import org.neo4j.gds.collections.ha.HugeDoubleArray; +import org.neo4j.gds.collections.ha.HugeLongArray; import org.neo4j.gds.core.concurrency.Concurrency; import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.RunWithConcurrency; -import org.neo4j.gds.collections.ha.HugeDoubleArray; -import org.neo4j.gds.collections.ha.HugeLongArray; import org.neo4j.gds.core.utils.partition.PartitionUtils; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -252,16 +252,16 @@ private LeidenResult getLeidenResult(boolean didConverge, int iteration) { boolean stoppedAtFirstIteration = didConverge && iteration == 0; if (stoppedAtFirstIteration) { var modularity = modularities[0]; - return LeidenResult.of( + return new LeidenResult( LeidenUtils.createStartingCommunities(rootGraph.nodeCount(), seedValues.orElse(null)), 1, - didConverge, + true, null, new double[]{modularity}, modularity ); } else { - return LeidenResult.of( + return new LeidenResult( dendrogramManager.getCurrent(), iteration, didConverge, diff --git a/algo/src/main/java/org/neo4j/gds/leiden/LeidenResult.java b/algo/src/main/java/org/neo4j/gds/leiden/LeidenResult.java index 0af28fe9ce..11f9165461 100644 --- a/algo/src/main/java/org/neo4j/gds/leiden/LeidenResult.java +++ b/algo/src/main/java/org/neo4j/gds/leiden/LeidenResult.java @@ -19,33 +19,25 @@ */ package org.neo4j.gds.leiden; -import org.immutables.value.Value; import org.jetbrains.annotations.Nullable; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeLongArray; import java.util.function.LongUnaryOperator; -@ValueClass @SuppressWarnings("immutables:subtype") -public interface LeidenResult { - - HugeLongArray communities(); - - int ranLevels(); - - boolean didConverge(); - - @Nullable LeidenDendrogramManager dendrogramManager(); - - double[] modularities(); - - double modularity(); - - default long[] getIntermediateCommunities(long nodeId) { - - if (dendrogramManager() != null) { - var dendrograms = dendrogramManager().getAllDendrograms(); +public record LeidenResult( + HugeLongArray communities, + int ranLevels, + boolean didConverge, + @Nullable LeidenDendrogramManager dendrogramManager, + double[] modularities, + double modularity +){ + + public long[] intermediateCommunities(long nodeId) { + + if (dendrogramManager != null) { + var dendrograms = dendrogramManager.getAllDendrograms(); int levels = ranLevels(); long[] communities = new long[levels]; for (int i = 0; i < levels; i++) { @@ -54,32 +46,13 @@ default long[] getIntermediateCommunities(long nodeId) { return communities; } else { - return new long[]{communities().get(nodeId)}; + return new long[]{communities.get(nodeId)}; } } - @Value.Derived - default LongUnaryOperator communitiesFunction() { - return communities()::get; - } - - static LeidenResult of( - HugeLongArray communities, - int ranLevels, - boolean didConverge, - @Nullable LeidenDendrogramManager dendrogramManager, - double[] modularities, - double modularity - ) { - return ImmutableLeidenResult.of( - communities, - ranLevels, - didConverge, - dendrogramManager, - modularities, - modularity - ); + public LongUnaryOperator communitiesFunction() { + return communities::get; } } diff --git a/algo/src/main/java/org/neo4j/gds/louvain/Louvain.java b/algo/src/main/java/org/neo4j/gds/louvain/Louvain.java index 05a173a5be..8c5f027de5 100644 --- a/algo/src/main/java/org/neo4j/gds/louvain/Louvain.java +++ b/algo/src/main/java/org/neo4j/gds/louvain/Louvain.java @@ -147,7 +147,7 @@ public OptionalLong getMaxLongPropertyValue() { resizeResultArrays(); } progressTracker.endSubTask(); - return LouvainResult.of( + return new LouvainResult( dendrogramManager.getCurrent(), levels(), dendrogramManager, diff --git a/algo/src/main/java/org/neo4j/gds/louvain/LouvainResult.java b/algo/src/main/java/org/neo4j/gds/louvain/LouvainResult.java index 68317f1134..7436772254 100644 --- a/algo/src/main/java/org/neo4j/gds/louvain/LouvainResult.java +++ b/algo/src/main/java/org/neo4j/gds/louvain/LouvainResult.java @@ -19,31 +19,22 @@ */ package org.neo4j.gds.louvain; -import org.immutables.value.Value; import org.jetbrains.annotations.Nullable; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeLongArray; -import java.util.function.LongUnaryOperator; - -@ValueClass @SuppressWarnings("immutables:subtype") -public interface LouvainResult { - - HugeLongArray communities(); - - int ranLevels(); - - LouvainDendrogramManager dendrogramManager(); - - double[] modularities(); - - double modularity(); +public record LouvainResult( + HugeLongArray communities, + int ranLevels, + @Nullable LouvainDendrogramManager dendrogramManager, + double[] modularities, + double modularity + ){ - default long[] getIntermediateCommunities(long nodeId) { + public long[] intermediateCommunities(long nodeId) { - if (dendrogramManager() != null) { - var dendrograms = dendrogramManager().getAllDendrograms(); + if (dendrogramManager!= null) { + var dendrograms = dendrogramManager.getAllDendrograms(); int levels = ranLevels(); long[] communities = new long[levels]; for (int i = 0; i < levels; i++) { @@ -52,38 +43,17 @@ default long[] getIntermediateCommunities(long nodeId) { return communities; } else { - return new long[]{communities().get(nodeId)}; + return new long[]{communities.get(nodeId)}; } } - default long getCommunity(long node){ - return communities().get(node); - } - @Value.Derived - default LongUnaryOperator communitiesFunction() { - return communities()::get; + public long community(long node){ + return communities.get(node); } - @Value.Derived - default long size() { - return communities().size(); - } - - static LouvainResult of( - HugeLongArray communities, - int ranLevels, - @Nullable LouvainDendrogramManager dendrogramManager, - double[] modularities, - double modularity - ) { - return ImmutableLouvainResult.of( - communities, - ranLevels, - dendrogramManager, - modularities, - modularity - ); + public long size() { + return communities.size(); } } diff --git a/algo/src/main/java/org/neo4j/gds/modularity/ModularityCalculator.java b/algo/src/main/java/org/neo4j/gds/modularity/ModularityCalculator.java index 0a4bc87fad..741c7f79b6 100644 --- a/algo/src/main/java/org/neo4j/gds/modularity/ModularityCalculator.java +++ b/algo/src/main/java/org/neo4j/gds/modularity/ModularityCalculator.java @@ -114,7 +114,7 @@ public ModularityResult compute() { communityModularities.set(resultIndex++, CommunityModularity.of(communityId, modularity)); } - return ModularityResult.of( + return new ModularityResult( graph.nodeCount(), graph.relationshipCount(), totalModularity.doubleValue(), diff --git a/algo/src/main/java/org/neo4j/gds/modularity/ModularityResult.java b/algo/src/main/java/org/neo4j/gds/modularity/ModularityResult.java index 6360edbdf5..363f5f8e27 100644 --- a/algo/src/main/java/org/neo4j/gds/modularity/ModularityResult.java +++ b/algo/src/main/java/org/neo4j/gds/modularity/ModularityResult.java @@ -19,35 +19,12 @@ */ package org.neo4j.gds.modularity; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeObjectArray; -@ValueClass -public interface ModularityResult { - long nodeCount(); - - long relationshipCount(); - double totalModularity(); - long communityCount(); - HugeObjectArray modularityScores(); - - static ModularityResult of( +public record ModularityResult( long nodeCount, long relationshipCount, double totalModularity, long communityCount, HugeObjectArray modularityScores - ) { - return ImmutableModularityResult.of( - nodeCount, - relationshipCount, - totalModularity, - communityCount, - modularityScores - ); - } - - static ModularityResult empty() { - return of(0, 0, 0d, 0L, HugeObjectArray.of()); - } -} + ) { } diff --git a/algo/src/main/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationResult.java b/algo/src/main/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationResult.java index f415112481..a2d77d5a60 100644 --- a/algo/src/main/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationResult.java +++ b/algo/src/main/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationResult.java @@ -23,45 +23,18 @@ import java.util.function.LongUnaryOperator; -public class ModularityOptimizationResult { - - private final LongUnaryOperator communityIdLookup; - private final double modularity; - private final int ranIterations; - private final boolean didConverge; - private final long nodeCount; - - public ModularityOptimizationResult( +public record ModularityOptimizationResult( LongUnaryOperator communityIdLookup, double modularity, int ranIterations, boolean didConverge, long nodeCount ) { - this.communityIdLookup = communityIdLookup; - this.nodeCount = nodeCount; - - this.modularity = modularity; - this.ranIterations = ranIterations; - this.didConverge = didConverge; - } - - public double modularity() { - return modularity; - } - - public int ranIterations() { - return ranIterations; - } public long communityId(long nodeId) { return communityIdLookup.applyAsLong(nodeId); } - public boolean didConverge() { - return didConverge; - } - public LongNodePropertyValues asNodeProperties() { return new LongNodePropertyValues() { @Override diff --git a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankResult.java b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankResult.java index 744ed77269..c1372e996c 100644 --- a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankResult.java +++ b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankResult.java @@ -27,29 +27,12 @@ import java.util.function.LongToDoubleFunction; -public class PageRankResult implements CentralityAlgorithmResult { +public record PageRankResult( + HugeDoubleArray scores, + int iterations, + boolean didConverge +) implements CentralityAlgorithmResult { - private final HugeDoubleArray scores; - private final int ranIterations; - private final boolean didConverge; - - public PageRankResult(HugeDoubleArray scores, int ranIterations, boolean didConverge) { - this.scores = scores; - this.ranIterations = ranIterations; - this.didConverge = didConverge; - } - - public int iterations() { - return ranIterations; - } - - public boolean didConverge() { - return didConverge; - } - - public long nodeCount() { - return scores.size(); - } @Override public NodePropertyValues nodePropertyValues() { @@ -61,4 +44,7 @@ public LongToDoubleFunction centralityScoreProvider() { return scores::get; } + public long nodeCount() { + return scores.size(); + } } diff --git a/algo/src/main/java/org/neo4j/gds/scaleproperties/ScaleProperties.java b/algo/src/main/java/org/neo4j/gds/scaleproperties/ScaleProperties.java index b653a2cddd..c2b640590d 100644 --- a/algo/src/main/java/org/neo4j/gds/scaleproperties/ScaleProperties.java +++ b/algo/src/main/java/org/neo4j/gds/scaleproperties/ScaleProperties.java @@ -101,7 +101,7 @@ public ScalePropertiesResult compute() { progressTracker.endSubTask("Scale properties"); progressTracker.endSubTask("ScaleProperties"); - return ScalePropertiesResult.of(scaledProperties, scalerStatistics); + return new ScalePropertiesResult(scaledProperties, scalerStatistics); } private void initializeArrays(HugeObjectArray scaledProperties, int propertyCount) { diff --git a/algo/src/main/java/org/neo4j/gds/scaleproperties/ScalePropertiesResult.java b/algo/src/main/java/org/neo4j/gds/scaleproperties/ScalePropertiesResult.java index 9a9b089c7f..704c3bae84 100644 --- a/algo/src/main/java/org/neo4j/gds/scaleproperties/ScalePropertiesResult.java +++ b/algo/src/main/java/org/neo4j/gds/scaleproperties/ScalePropertiesResult.java @@ -19,22 +19,14 @@ */ package org.neo4j.gds.scaleproperties; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeObjectArray; import java.util.List; import java.util.Map; -@ValueClass -public interface ScalePropertiesResult { - HugeObjectArray scaledProperties(); - - Map>> scalerStatistics(); - - static ScalePropertiesResult of( - HugeObjectArray properties, - Map>> stats +public record ScalePropertiesResult( + HugeObjectArray scaledProperties, + Map>> scalerStatistics ) { - return ImmutableScalePropertiesResult.of(properties, stats); - } + } diff --git a/algo/src/main/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithm.java b/algo/src/main/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithm.java index 3ed5f1357a..531c126ce2 100644 --- a/algo/src/main/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithm.java +++ b/algo/src/main/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithm.java @@ -161,7 +161,7 @@ public SteinerTreeResult compute() { } progressTracker.endSubTask("SteinerTree"); - return SteinerTreeResult.of( + return new SteinerTreeResult( parent, parentCost, totalCost.doubleValue(), diff --git a/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeResult.java b/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeResult.java index 5c84ec8753..197aa51a18 100644 --- a/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeResult.java +++ b/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeResult.java @@ -19,38 +19,14 @@ */ package org.neo4j.gds.steiner; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeDoubleArray; import org.neo4j.gds.collections.ha.HugeLongArray; -@ValueClass @SuppressWarnings("immutables:subtype") -public interface SteinerTreeResult { - - HugeLongArray parentArray(); - - HugeDoubleArray relationshipToParentCost(); - - double totalCost(); - - long effectiveNodeCount(); - - long effectiveTargetNodesCount(); - - - static SteinerTreeResult of( - HugeLongArray parent, +public record SteinerTreeResult( + HugeLongArray parentArray, HugeDoubleArray relationshipToParentCost, double totalCost, long effectiveNodeCount, long effectiveTargetNodesCount - ) { - return ImmutableSteinerTreeResult.of( - parent, - relationshipToParentCost, - totalCost, - effectiveNodeCount, - effectiveTargetNodesCount - ); - } -} + ) {} diff --git a/algo/src/main/java/org/neo4j/gds/triangle/IntersectingTriangleCount.java b/algo/src/main/java/org/neo4j/gds/triangle/IntersectingTriangleCount.java index 8211196227..97ec9d8c00 100644 --- a/algo/src/main/java/org/neo4j/gds/triangle/IntersectingTriangleCount.java +++ b/algo/src/main/java/org/neo4j/gds/triangle/IntersectingTriangleCount.java @@ -125,7 +125,7 @@ public TriangleCountResult compute() { globalTriangleCount = globalTriangleCounter.longValue(); progressTracker.endSubTask(); - return TriangleCountResult.of( + return new TriangleCountResult( triangleCounts, globalTriangleCount ); diff --git a/algo/src/main/java/org/neo4j/gds/triangle/LocalClusteringCoefficient.java b/algo/src/main/java/org/neo4j/gds/triangle/LocalClusteringCoefficient.java index 2c0588f0a3..8201b9791e 100644 --- a/algo/src/main/java/org/neo4j/gds/triangle/LocalClusteringCoefficient.java +++ b/algo/src/main/java/org/neo4j/gds/triangle/LocalClusteringCoefficient.java @@ -81,7 +81,7 @@ public LocalClusteringCoefficientResult compute() { } progressTracker.endSubTask(); - return LocalClusteringCoefficientResult.of( + return new LocalClusteringCoefficientResult( localClusteringCoefficients, averageClusteringCoefficient ); diff --git a/algo/src/main/java/org/neo4j/gds/triangle/LocalClusteringCoefficientResult.java b/algo/src/main/java/org/neo4j/gds/triangle/LocalClusteringCoefficientResult.java index 9dc0e8a50c..e3dded6d5f 100644 --- a/algo/src/main/java/org/neo4j/gds/triangle/LocalClusteringCoefficientResult.java +++ b/algo/src/main/java/org/neo4j/gds/triangle/LocalClusteringCoefficientResult.java @@ -19,24 +19,9 @@ */ package org.neo4j.gds.triangle; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.ha.HugeDoubleArray; -@ValueClass -public interface LocalClusteringCoefficientResult { - - HugeDoubleArray localClusteringCoefficients(); - - double averageClusteringCoefficient(); - - static LocalClusteringCoefficientResult of( +public record LocalClusteringCoefficientResult( HugeDoubleArray localClusteringCoefficients, double averageClusteringCoefficient - ) { - return ImmutableLocalClusteringCoefficientResult - .builder() - .localClusteringCoefficients(localClusteringCoefficients) - .averageClusteringCoefficient(averageClusteringCoefficient) - .build(); - } -} + ){} diff --git a/algo/src/main/java/org/neo4j/gds/triangle/TriangleCountResult.java b/algo/src/main/java/org/neo4j/gds/triangle/TriangleCountResult.java index f037e0b207..345eaad671 100644 --- a/algo/src/main/java/org/neo4j/gds/triangle/TriangleCountResult.java +++ b/algo/src/main/java/org/neo4j/gds/triangle/TriangleCountResult.java @@ -19,24 +19,9 @@ */ package org.neo4j.gds.triangle; -import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.collections.haa.HugeAtomicLongArray; -@ValueClass -public interface TriangleCountResult { - // value at index `i` is number of triangles for node with id `i` - HugeAtomicLongArray localTriangles(); - - long globalTriangles(); - - static TriangleCountResult of( - HugeAtomicLongArray triangles, +public record TriangleCountResult( + HugeAtomicLongArray localTriangles, long globalTriangles - ) { - return ImmutableTriangleCountResult - .builder() - .localTriangles(triangles) - .globalTriangles(globalTriangles) - .build(); - } -} + ) {} diff --git a/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNCompanionTest.java b/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNCompanionTest.java index 874ec19f9b..8c7ba01449 100644 --- a/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNCompanionTest.java +++ b/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNCompanionTest.java @@ -38,7 +38,7 @@ void shouldComputeHashesFromTriple() { int a = rng.nextInt(c - 1) + 1; int b = rng.nextInt(c - 1) + 1; - var hashTriple = ImmutableHashTriple.of(a, b, c); + var hashTriple = new HashGNNCompanion.HashTriple(a, b, c); var hashes = HashGNNCompanion.HashTriple.computeHashesFromTriple(EMBEDDING_DIMENSION, hashTriple); assertThat(hashes.length).isEqualTo(EMBEDDING_DIMENSION); diff --git a/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNMemoryEstimateDefinitionTest.java b/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNMemoryEstimateDefinitionTest.java index 40e0553a7b..42e972a855 100644 --- a/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNMemoryEstimateDefinitionTest.java +++ b/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNMemoryEstimateDefinitionTest.java @@ -39,17 +39,17 @@ class HashGNNMemoryEstimateDefinitionTest { @ParameterizedTest @CsvSource(value = { // BASE - " 10, 4, 10_000, 20_000, 1, 5_924_072, 86_324_072", + " 10, 4, 10_000, 20_000, 1, 5_924_152, 86_324_152", // Should increase fairly little with higher density - " 100, 4, 10_000, 20_000, 1, 7_038_992, 87_438_992", + " 100, 4, 10_000, 20_000, 1, 7_039_792, 87_439_792", // Should increase fairly little with more iterations - " 10, 16, 10_000, 20_000, 1, 5_924_072, 86_324_072", + " 10, 16, 10_000, 20_000, 1, 5_924_152, 86_324_152", // Should increase almost linearly with node count - " 10, 4, 100_000, 20_000, 1, 58_124_432, 862_124_432", + " 10, 4, 100_000, 20_000, 1, 58_124_512, 862_124_512", // Should be unaffected by relationship count - " 10, 4, 10_000, 80_000, 1, 5_924_072, 86_324_072", + " 10, 4, 10_000, 80_000, 1, 5_924_152, 86_324_152", // Should be unaffected by concurrency - " 10, 4, 10_000, 20_000, 8, 5_924_072, 86_324_072", + " 10, 4, 10_000, 20_000, 8, 5_924_152, 86_324_152", }) void shouldEstimateMemory( int embeddingDensity, @@ -91,7 +91,7 @@ void shouldEstimateMemoryWithOutputDimension(){ MemoryEstimationAssert.assertThat(memoryEstimation) .memoryRange(10_000,20_000,new Concurrency(8)) - .hasSameMinAndMaxEqualTo(12_404_072); + .hasSameMinAndMaxEqualTo(12_404_152); } @Test diff --git a/algo/src/test/java/org/neo4j/gds/louvain/LouvainTest.java b/algo/src/test/java/org/neo4j/gds/louvain/LouvainTest.java index 18d02d988a..b9d20f4053 100644 --- a/algo/src/test/java/org/neo4j/gds/louvain/LouvainTest.java +++ b/algo/src/test/java/org/neo4j/gds/louvain/LouvainTest.java @@ -418,7 +418,7 @@ void shouldGiveSameResultWithCalculator() { var result = louvain.compute(); assertThat(result.ranLevels()).isGreaterThan(1); - LongUnaryOperator vToCommunity = v -> result.getCommunity(v); + LongUnaryOperator vToCommunity = v -> result.community(v); var modularityCalculator = ModularityCalculator.create(myGraph, vToCommunity, new Concurrency(4)); double calculatedModularity = modularityCalculator.compute().totalModularity(); assertThat(result.modularity()).isCloseTo(calculatedModularity, Offset.offset(1e-5)); diff --git a/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LeidenMutateStep.java b/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LeidenMutateStep.java index 08cf6bcd04..15747d74f3 100644 --- a/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LeidenMutateStep.java +++ b/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LeidenMutateStep.java @@ -65,7 +65,7 @@ public Pair execute( private NodePropertyValues calculateNodePropertyValues(GraphStore graphStore, LeidenResult result) { if (configuration.includeIntermediateCommunities()) return CommunityCompanion.createIntermediateCommunitiesNodePropertyValues( - result::getIntermediateCommunities, + result::intermediateCommunities, result.communities().size() ); diff --git a/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LeidenWriteStep.java b/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LeidenWriteStep.java index 0dac79777f..d10150c9cc 100644 --- a/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LeidenWriteStep.java +++ b/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LeidenWriteStep.java @@ -71,7 +71,7 @@ public Pair execute( private NodePropertyValues constructNodePropertyValues(GraphStore graphStore, LeidenResult result) { if (configuration.includeIntermediateCommunities()) return CommunityCompanion.createIntermediateCommunitiesNodePropertyValues( - result::getIntermediateCommunities, + result::intermediateCommunities, result.communities().size() ); diff --git a/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LouvainNodePropertyValuesComputer.java b/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LouvainNodePropertyValuesComputer.java index 7ec98f1060..c091c745ec 100644 --- a/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LouvainNodePropertyValuesComputer.java +++ b/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LouvainNodePropertyValuesComputer.java @@ -35,7 +35,7 @@ public NodePropertyValues compute( ) { if (configuration.includeIntermediateCommunities()) return CommunityCompanion.createIntermediateCommunitiesNodePropertyValues( - result::getIntermediateCommunities, + result::intermediateCommunities, result.size() ); diff --git a/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LouvainWriteStep.java b/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LouvainWriteStep.java index 23dbe77a94..c4e591dd50 100644 --- a/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LouvainWriteStep.java +++ b/applications/algorithms/community/src/main/java/org/neo4j/gds/applications/algorithms/community/LouvainWriteStep.java @@ -70,7 +70,7 @@ public NodePropertiesWritten execute( private NodePropertyValues constructNodePropertyValues(GraphStore graphStore, LouvainResult result) { if (configuration.includeIntermediateCommunities()) return CommunityCompanion.createIntermediateCommunitiesNodePropertyValues( - result::getIntermediateCommunities, + result::intermediateCommunities, result.size() ); diff --git a/doc/modules/ROOT/pages/machine-learning/node-embeddings/hashgnn.adoc b/doc/modules/ROOT/pages/machine-learning/node-embeddings/hashgnn.adoc index d511a83592..f9193f2425 100644 --- a/doc/modules/ROOT/pages/machine-learning/node-embeddings/hashgnn.adoc +++ b/doc/modules/ROOT/pages/machine-learning/node-embeddings/hashgnn.adoc @@ -464,7 +464,7 @@ YIELD nodeCount, relationshipCount, bytesMin, bytesMax, requiredMemory [opts="header", cols="1,1,1,1,1"] |=== | nodeCount | relationshipCount | bytesMin | bytesMax | requiredMemory -| 7 | 18 | 2040 | 2040 | "2040 Bytes" +| 7 | 18 | 2056 | 2056 | "2056 Bytes" |=== -- diff --git a/proc/community/src/main/java/org/neo4j/gds/leiden/LeidenCompanion.java b/proc/community/src/main/java/org/neo4j/gds/leiden/LeidenCompanion.java index 593ec52327..f63ee80db5 100644 --- a/proc/community/src/main/java/org/neo4j/gds/leiden/LeidenCompanion.java +++ b/proc/community/src/main/java/org/neo4j/gds/leiden/LeidenCompanion.java @@ -45,7 +45,7 @@ static NodePropertyValues leidenNodeProperties( return new IntermediateCommunityNodeProperties( computationResult.graph().nodeCount(), leidenResult.communities().size(), - leidenResult::getIntermediateCommunities + leidenResult::intermediateCommunities ); } else { return getCommunities(computationResult); diff --git a/proc/community/src/main/java/org/neo4j/gds/louvain/LouvainNodePropertyValuesDelegate.java b/proc/community/src/main/java/org/neo4j/gds/louvain/LouvainNodePropertyValuesDelegate.java index 4826f8b82d..1beaa4ff84 100644 --- a/proc/community/src/main/java/org/neo4j/gds/louvain/LouvainNodePropertyValuesDelegate.java +++ b/proc/community/src/main/java/org/neo4j/gds/louvain/LouvainNodePropertyValuesDelegate.java @@ -66,7 +66,7 @@ public long nodeCount() { @Override public long[] longArrayValue(long nodeId) { - return result.getIntermediateCommunities(nodeId); + return result.intermediateCommunities(nodeId); } }; } diff --git a/proc/community/src/main/java/org/neo4j/gds/louvain/LouvainResultBuilder.java b/proc/community/src/main/java/org/neo4j/gds/louvain/LouvainResultBuilder.java index f4960f3385..8c7f395c6b 100644 --- a/proc/community/src/main/java/org/neo4j/gds/louvain/LouvainResultBuilder.java +++ b/proc/community/src/main/java/org/neo4j/gds/louvain/LouvainResultBuilder.java @@ -51,7 +51,7 @@ static LouvainResultBuilder createForMutate( .withLevels(result.ranLevels()) .withModularity(result.modularity()) .withModularities(result.modularities()) - .withCommunityFunction(result::getCommunity); + .withCommunityFunction(result::community); }); return procResultBuilder; diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LeidenResultBuilderForStreamMode.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LeidenResultBuilderForStreamMode.java index 057f72553a..22f2610c8d 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LeidenResultBuilderForStreamMode.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LeidenResultBuilderForStreamMode.java @@ -55,7 +55,7 @@ public Stream build( .filter(nodePropertyValues::hasValue) .map(nodeId -> { var communities = configuration.includeIntermediateCommunities() - ? leidenResult.getIntermediateCommunities(nodeId) + ? leidenResult.intermediateCommunities(nodeId) : null; var communityId = nodePropertyValues.longValue(nodeId); return LeidenStreamResult.create(graph.toOriginalNodeId(nodeId), communities, communityId); diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LouvainResultBuilderForStreamMode.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LouvainResultBuilderForStreamMode.java index d95b561978..c79a4292a0 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LouvainResultBuilderForStreamMode.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LouvainResultBuilderForStreamMode.java @@ -56,7 +56,7 @@ public Stream build( .filter(nodePropertyValues::hasValue) .map(nodeId -> { var communities = configuration.includeIntermediateCommunities() - ? louvainResult.getIntermediateCommunities(nodeId) + ? louvainResult.intermediateCommunities(nodeId) : null; var communityId = nodePropertyValues.longValue(nodeId); return LouvainStreamResult.create(graph.toOriginalNodeId(nodeId), communities, communityId); diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LouvainResultBuilderForWriteMode.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LouvainResultBuilderForWriteMode.java index e94cf70f27..88cbbfc324 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LouvainResultBuilderForWriteMode.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/LouvainResultBuilderForWriteMode.java @@ -66,7 +66,7 @@ public Stream build( var communityStatistics = CommunityStatistics.communityStats( nodePropertyValues.nodeCount(), - louvainResult::getCommunity, + louvainResult::community, DefaultPool.INSTANCE, configuration.concurrency(), statisticsComputationInstructions diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LouvainResultBuilderForMutateMode.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LouvainResultBuilderForMutateMode.java index 336b141f9b..f0f1e02670 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LouvainResultBuilderForMutateMode.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/community/stubs/LouvainResultBuilderForMutateMode.java @@ -66,7 +66,7 @@ public LouvainMutateResult build( configuration, statisticsComputationInstructions, nodePropertyValues.nodeCount(), - louvainResult::getCommunity + louvainResult::community ); return LouvainMutateResult.create(