Skip to content

Commit fc6ec8d

Browse files
committed
Remove unnecessary RelationshipIntersectConfig
1 parent 3eed844 commit fc6ec8d

14 files changed

+23
-67
lines changed

algo/src/main/java/org/neo4j/gds/triangle/IntersectingTriangleCount.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import org.neo4j.gds.core.utils.paged.ParalleLongPageCreator;
3030
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
3131
import org.neo4j.gds.termination.TerminationFlag;
32-
import org.neo4j.gds.triangle.intersect.ImmutableRelationshipIntersectConfig;
33-
import org.neo4j.gds.triangle.intersect.RelationshipIntersectConfig;
3432
import org.neo4j.gds.triangle.intersect.RelationshipIntersectFactory;
3533
import org.neo4j.gds.triangle.intersect.RelationshipIntersectFactoryLocator;
3634

@@ -58,7 +56,6 @@ public final class IntersectingTriangleCount extends Algorithm<TriangleCountResu
5856

5957
private final Graph graph;
6058
private final RelationshipIntersectFactory intersectFactory;
61-
private final RelationshipIntersectConfig intersectConfig;
6259
private final ExecutorService executorService;
6360
private final AtomicLong queue;
6461

@@ -100,7 +97,6 @@ private IntersectingTriangleCount(
10097
this.intersectFactory = intersectFactory;
10198
this.concurrency = concurrency;
10299
this.maxDegree = maxDegree;
103-
this.intersectConfig = ImmutableRelationshipIntersectConfig.of(maxDegree);
104100
this.triangleCounts = HugeAtomicLongArray.of(graph.nodeCount(), ParalleLongPageCreator.passThrough(concurrency));
105101
this.executorService = executorService;
106102
this.globalTriangleCounter = new LongAdder();
@@ -117,7 +113,7 @@ public TriangleCountResult compute() {
117113
// create tasks
118114
final Collection<? extends Runnable> tasks = ParallelUtil.tasks(
119115
concurrency,
120-
() -> new IntersectTask(intersectFactory.load(graph, intersectConfig))
116+
() -> new IntersectTask(intersectFactory.load(graph, maxDegree))
121117
);
122118
// run
123119
ParallelUtil.run(tasks, executorService);

algo/src/main/java/org/neo4j/gds/triangle/TriangleStream.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@
2626
import org.neo4j.gds.api.RelationshipIntersect;
2727
import org.neo4j.gds.core.concurrency.Concurrency;
2828
import org.neo4j.gds.core.concurrency.ParallelUtil;
29-
import org.neo4j.gds.termination.TerminationFlag;
3029
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
31-
import org.neo4j.gds.triangle.intersect.ImmutableRelationshipIntersectConfig;
32-
import org.neo4j.gds.triangle.intersect.RelationshipIntersectConfig;
30+
import org.neo4j.gds.termination.TerminationFlag;
3331
import org.neo4j.gds.triangle.intersect.RelationshipIntersectFactory;
3432
import org.neo4j.gds.triangle.intersect.RelationshipIntersectFactoryLocator;
3533

@@ -54,7 +52,6 @@ public final class TriangleStream extends Algorithm<Stream<TriangleResult>> {
5452

5553
private final Graph graph;
5654
private final RelationshipIntersectFactory intersectFactory;
57-
private final RelationshipIntersectConfig intersectConfig;
5855
private final ExecutorService executorService;
5956
private final AtomicInteger queue;
6057
private final Concurrency concurrency;
@@ -86,7 +83,6 @@ private TriangleStream(
8683
super(ProgressTracker.NULL_TRACKER);
8784
this.graph = graph;
8885
this.intersectFactory = intersectFactory;
89-
this.intersectConfig = ImmutableRelationshipIntersectConfig.builder().build();
9086
this.executorService = executorService;
9187
this.concurrency = concurrency;
9288
this.nodeCount = Math.toIntExact(graph.nodeCount());
@@ -124,7 +120,7 @@ private void submitTasks() {
124120
queue.set(0);
125121
runningThreads.set(0);
126122
final Collection<Runnable> tasks;
127-
tasks = ParallelUtil.tasks(concurrency, () -> new IntersectTask(intersectFactory.load(graph, intersectConfig)));
123+
tasks = ParallelUtil.tasks(concurrency, () -> new IntersectTask(intersectFactory.load(graph, Long.MAX_VALUE)));
128124
ParallelUtil.run(tasks, false, executorService, null);
129125
}
130126

algo/src/main/java/org/neo4j/gds/triangle/intersect/HugeGraphIntersect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ public boolean canLoad(Graph graph) {
5555
}
5656

5757
@Override
58-
public RelationshipIntersect load(Graph graph, RelationshipIntersectConfig config) {
58+
public RelationshipIntersect load(Graph graph, long maxDegree) {
5959
assert graph instanceof HugeGraph;
6060
var hugeGraph = (HugeGraph) graph;
6161
var topology = hugeGraph.relationshipTopology().adjacencyList();
62-
return new HugeGraphIntersect(topology, config.maxDegree());
62+
return new HugeGraphIntersect(topology, maxDegree);
6363
}
6464
}
6565
}

algo/src/main/java/org/neo4j/gds/triangle/intersect/NodeFilteredGraphIntersect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ public boolean canLoad(Graph graph) {
6363
}
6464

6565
@Override
66-
public RelationshipIntersect load(Graph graph, RelationshipIntersectConfig config) {
66+
public RelationshipIntersect load(Graph graph, long maxDegree) {
6767
assert graph instanceof NodeFilteredGraph;
6868
var nodeFilteredGraph = (NodeFilteredGraph) graph;
6969
var innerGraph = nodeFilteredGraph.graph();
7070

7171
var relationshipIntersect = RelationshipIntersectFactoryLocator
7272
.lookup(innerGraph)
7373
.orElseThrow(() -> new IllegalArgumentException("No intersect factory found for graph type " + innerGraph.getClass()))
74-
.load(innerGraph, config);
74+
.load(innerGraph, maxDegree);
7575

7676
return new NodeFilteredGraphIntersect(nodeFilteredGraph, relationshipIntersect);
7777
}

algo/src/main/java/org/neo4j/gds/triangle/intersect/RelationshipIntersectConfig.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

algo/src/main/java/org/neo4j/gds/triangle/intersect/RelationshipIntersectFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ public interface RelationshipIntersectFactory {
2828

2929
boolean canLoad(Graph graph);
3030

31-
RelationshipIntersect load(Graph graph, RelationshipIntersectConfig config);
31+
RelationshipIntersect load(Graph graph, long maxDegree);
3232
}

algo/src/main/java/org/neo4j/gds/triangle/intersect/UnionGraphIntersect.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ public boolean canLoad(Graph graph) {
6969
}
7070

7171
@Override
72-
public UnionGraphIntersect load(Graph graph, RelationshipIntersectConfig config) {
72+
public UnionGraphIntersect load(Graph graph, long maxDegree) {
7373
assert graph instanceof UnionGraph;
7474
var topology = ((UnionGraph) graph).relationshipTopology();
7575
return new UnionGraphIntersect(
7676
graph::degree,
7777
i -> i,
7878
topology,
79-
config.maxDegree()
79+
maxDegree
8080
);
8181
}
8282
}
@@ -93,14 +93,14 @@ public boolean canLoad(Graph graph) {
9393
}
9494

9595
@Override
96-
public UnionGraphIntersect load(Graph graph, RelationshipIntersectConfig config) {
96+
public UnionGraphIntersect load(Graph graph, long maxDegree) {
9797
assert graph instanceof UnionGraph;
9898
var topology = ((UnionGraph) graph).relationshipTopology();
9999
return new UnionGraphIntersect(
100100
graph::degree,
101101
graph::toRootNodeId,
102102
topology,
103-
config.maxDegree()
103+
maxDegree
104104
);
105105
}
106106
}

algo/src/test/java/org/neo4j/gds/triangle/IntersectingTriangleCountMemoryEstimateDefinitionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void memoryEstimation(long nodeCount) {
3939
GraphDimensions graphDimensions = ImmutableGraphDimensions.builder().nodeCount(nodeCount).build();
4040

4141
long hugeAtomicLongArray = 24 + nodeCount * 8 + 16;
42-
long expected = 72 + hugeAtomicLongArray;
42+
long expected = 64 + hugeAtomicLongArray;
4343

4444
MemoryEstimationAssert.assertThat(memoryEstimation)
4545
.memoryRange(graphDimensions, new Concurrency(1))
@@ -55,7 +55,7 @@ void memoryEstimationLargePages(long nodeCount, long sizeOfHugeArray) {
5555
GraphDimensions graphDimensions = ImmutableGraphDimensions.builder().nodeCount(nodeCount).build();
5656

5757
long hugeAtomicLongArray = 32 + sizeOfHugeArray;
58-
long expected = 72 + hugeAtomicLongArray;
58+
long expected = 64 + hugeAtomicLongArray;
5959

6060
MemoryEstimationAssert.assertThat(memoryEstimation)
6161
.memoryRange(graphDimensions, new Concurrency(1))

algo/src/test/java/org/neo4j/gds/triangle/LocalClusteringCoefficientMemoryEstimateDefinitionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void memoryEstimation(long nodeCount) {
3636
var memoryEstimation = new LocalClusteringCoefficientMemoryEstimateDefinition(null)
3737
.memoryEstimation();
3838

39-
long triangleCountEstimate = 56 + 24 + nodeCount * 8 + 16;
39+
long triangleCountEstimate = 48 + 24 + nodeCount * 8 + 16;
4040
long hugeDoubleArray = 16 + nodeCount * 8 + 16;
4141
long expected = 80 + hugeDoubleArray + triangleCountEstimate;
4242

@@ -68,7 +68,7 @@ void memoryEstimationLargePages(long nodeCount, long sizeOfHugeArray) {
6868
var memoryEstimation = new LocalClusteringCoefficientMemoryEstimateDefinition(null)
6969
.memoryEstimation();
7070

71-
long triangleCountEstimate = 56 + 32 + sizeOfHugeArray;
71+
long triangleCountEstimate = 48 + 32 + sizeOfHugeArray;
7272
long hugeDoubleArray = 24 + sizeOfHugeArray;
7373
long expected = 80 + hugeDoubleArray + triangleCountEstimate;
7474

algo/src/test/java/org/neo4j/gds/triangle/intersect/CompositeIntersectionTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void intersectWithTargets() {
5252

5353
var intersect = new UnionGraphIntersect.UnionGraphIntersectFactory().load(
5454
graph,
55-
ImmutableRelationshipIntersectConfig.builder().build()
55+
Long.MAX_VALUE
5656
);
5757

5858
intersect.intersectAll(start2, (a, b, c) -> {
@@ -76,10 +76,7 @@ void intersectWithTargetsWithMaxDegree() {
7676

7777
var start2 = Math.max(graph.toMappedNodeId(DEGREE + 1), graph.toMappedNodeId(DEGREE));
7878

79-
var intersect = new UnionGraphIntersect.UnionGraphIntersectFactory().load(
80-
graph,
81-
ImmutableRelationshipIntersectConfig.builder().maxDegree(0).build()
82-
);
79+
var intersect = new UnionGraphIntersect.UnionGraphIntersectFactory().load(graph, 0);
8380
assertThatNoException().isThrownBy(
8481
() ->
8582
intersect.intersectAll(start2, (a, b, c) ->

0 commit comments

Comments
 (0)