From 2f024669b19ed3127de8bfa4f8b3161cb7b7d5b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20J=C3=A4derberg?= Date: Mon, 23 Oct 2023 15:42:00 +0200 Subject: [PATCH] Minor touchups --- .../java/org/neo4j/gds/dag/longestPath/DagLongestPath.java | 7 +++---- .../java/org/neo4j/gds/paths/delta/TentativeDistances.java | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/algo/src/main/java/org/neo4j/gds/dag/longestPath/DagLongestPath.java b/algo/src/main/java/org/neo4j/gds/dag/longestPath/DagLongestPath.java index c7323c73d2..7c61c2cfe2 100644 --- a/algo/src/main/java/org/neo4j/gds/dag/longestPath/DagLongestPath.java +++ b/algo/src/main/java/org/neo4j/gds/dag/longestPath/DagLongestPath.java @@ -113,7 +113,7 @@ private void traverse() { ForkJoinPool forkJoinPool = ExecutorServiceUtil.createForkJoinPool(concurrency); var tasks = ConcurrentHashMap.>newKeySet(); - LongFunction taskProducer = + LongFunction> taskProducer = (nodeId) -> new LongestPathTask( null, nodeId, @@ -125,8 +125,7 @@ private void traverse() { ParallelUtil.parallelForEachNode(nodeCount, concurrency, TerminationFlag.RUNNING_TRUE, nodeId -> { if (inDegrees.get(nodeId) == 0L) { tasks.add(taskProducer.apply(nodeId)); - parentsAndDistances.predecessors().get().set(nodeId, nodeId); - parentsAndDistances.distances().set(nodeId, 0); + parentsAndDistances.set(nodeId, nodeId, 0); } // Might not reach 100% if there are cycles in the graph progressTracker.logProgress(); @@ -146,7 +145,7 @@ private static final class LongestPathTask extends CountedCompleter { private final long sourceId; private final Graph graph; private final HugeAtomicLongArray inDegrees; - private TentativeDistances parentsAndDistances; + private final TentativeDistances parentsAndDistances; LongestPathTask( @Nullable DagLongestPath.LongestPathTask parent, diff --git a/algo/src/main/java/org/neo4j/gds/paths/delta/TentativeDistances.java b/algo/src/main/java/org/neo4j/gds/paths/delta/TentativeDistances.java index d7314e0530..434362ac37 100644 --- a/algo/src/main/java/org/neo4j/gds/paths/delta/TentativeDistances.java +++ b/algo/src/main/java/org/neo4j/gds/paths/delta/TentativeDistances.java @@ -79,7 +79,7 @@ static DistanceAndPredecessor distanceAndPredecessors( return distanceAndPredecessors(size, concurrency, DIST_INF, (a, b) -> Double.compare(a, b) > 0); } - public static DistanceAndPredecessor distanceAndPredecessors( + static DistanceAndPredecessor distanceAndPredecessors( long size, int concurrency, double distanceDefault,