Skip to content

Commit 7cb7b4e

Browse files
Add specs because they are still needed for memory estimation!
1 parent b5a2500 commit 7cb7b4e

File tree

5 files changed

+389
-0
lines changed

5 files changed

+389
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.gds.sllp;
21+
22+
public class Constants {
23+
24+
public static final String SLLP_DESCRIPTION="The Speaker Listener Label Propagation algorithm is a fast algorithm for finding overlapping communities in a graph.";
25+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.gds.sllp;
21+
22+
import org.neo4j.gds.GraphAlgorithmFactory;
23+
import org.neo4j.gds.NullComputationResultConsumer;
24+
import org.neo4j.gds.api.Graph;
25+
import org.neo4j.gds.beta.pregel.PregelResult;
26+
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
27+
import org.neo4j.gds.executor.AlgorithmSpec;
28+
import org.neo4j.gds.executor.ComputationResultConsumer;
29+
import org.neo4j.gds.executor.ExecutionContext;
30+
import org.neo4j.gds.executor.ExecutionMode;
31+
import org.neo4j.gds.executor.GdsCallable;
32+
import org.neo4j.gds.mem.MemoryEstimation;
33+
import org.neo4j.gds.procedures.algorithms.centrality.SpeakerListenerLPAMutateResult;
34+
import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
35+
import org.neo4j.gds.sllpa.SpeakerListenerLPA;
36+
import org.neo4j.gds.sllpa.SpeakerListenerLPAConfig;
37+
import org.neo4j.gds.sllpa.SpeakerListenerLPAMemoryEstimateDefinition;
38+
39+
import java.util.stream.Stream;
40+
41+
@GdsCallable(
42+
name = "gds.sllpa.mutate",
43+
aliases = {"gds.alpha.sllpa.mutate"},
44+
description = Constants.SLLP_DESCRIPTION,
45+
executionMode = ExecutionMode.MUTATE_NODE_PROPERTY
46+
)
47+
public class SpeakerListenerLPAMutateSpec implements AlgorithmSpec<SpeakerListenerLPA, PregelResult, SpeakerListenerLPAConfig, Stream<SpeakerListenerLPAMutateResult>, SpeakerListenerLPAMutateSpec.Factory> {
48+
49+
@Override
50+
public String name() {
51+
return "SpeakerListenerLPAStream";
52+
}
53+
54+
@Override
55+
public Factory algorithmFactory(ExecutionContext executionContext) {
56+
return new Factory();
57+
}
58+
59+
@Override
60+
public NewConfigFunction<SpeakerListenerLPAConfig> newConfigFunction() {
61+
return (___,config) -> SpeakerListenerLPAConfig.of(config);
62+
}
63+
64+
@Override
65+
public ComputationResultConsumer<SpeakerListenerLPA, PregelResult, SpeakerListenerLPAConfig, Stream<SpeakerListenerLPAMutateResult>> computationResultConsumer() {
66+
return new NullComputationResultConsumer<>();
67+
}
68+
69+
70+
static class Factory extends GraphAlgorithmFactory<SpeakerListenerLPA,SpeakerListenerLPAConfig> {
71+
72+
@Override
73+
public SpeakerListenerLPA build(
74+
Graph graphOrGraphStore,
75+
SpeakerListenerLPAConfig configuration,
76+
ProgressTracker progressTracker
77+
) {
78+
return null;
79+
}
80+
81+
@Override
82+
public String taskName() {
83+
return "";
84+
}
85+
86+
@Override
87+
public MemoryEstimation memoryEstimation(SpeakerListenerLPAConfig config) {
88+
return new SpeakerListenerLPAMemoryEstimateDefinition().memoryEstimation();
89+
}
90+
}
91+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.gds.sllp;
21+
22+
import org.neo4j.gds.GraphAlgorithmFactory;
23+
import org.neo4j.gds.NullComputationResultConsumer;
24+
import org.neo4j.gds.api.Graph;
25+
import org.neo4j.gds.beta.pregel.PregelResult;
26+
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
27+
import org.neo4j.gds.executor.AlgorithmSpec;
28+
import org.neo4j.gds.executor.ComputationResultConsumer;
29+
import org.neo4j.gds.executor.ExecutionContext;
30+
import org.neo4j.gds.executor.ExecutionMode;
31+
import org.neo4j.gds.executor.GdsCallable;
32+
import org.neo4j.gds.mem.MemoryEstimation;
33+
import org.neo4j.gds.procedures.algorithms.centrality.SpeakerListenerLPAStatsResult;
34+
import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
35+
import org.neo4j.gds.sllpa.SpeakerListenerLPA;
36+
import org.neo4j.gds.sllpa.SpeakerListenerLPAConfig;
37+
import org.neo4j.gds.sllpa.SpeakerListenerLPAMemoryEstimateDefinition;
38+
39+
import java.util.stream.Stream;
40+
41+
@GdsCallable(
42+
name = "gds.sllpa.stats",
43+
aliases = {"gds.alpha.sllpa.stats"},
44+
description = Constants.SLLP_DESCRIPTION,
45+
executionMode = ExecutionMode.STATS
46+
)
47+
public class SpeakerListenerLPAStatsSpec implements AlgorithmSpec<SpeakerListenerLPA, PregelResult, SpeakerListenerLPAConfig, Stream<SpeakerListenerLPAStatsResult>, SpeakerListenerLPAStatsSpec.Factory> {
48+
49+
@Override
50+
public String name() {
51+
return "SpeakerListenerLPAStream";
52+
}
53+
54+
@Override
55+
public Factory algorithmFactory(ExecutionContext executionContext) {
56+
return new Factory();
57+
}
58+
59+
@Override
60+
public NewConfigFunction<SpeakerListenerLPAConfig> newConfigFunction() {
61+
return (___,config) -> SpeakerListenerLPAConfig.of(config);
62+
}
63+
64+
@Override
65+
public ComputationResultConsumer<SpeakerListenerLPA, PregelResult, SpeakerListenerLPAConfig, Stream<SpeakerListenerLPAStatsResult>> computationResultConsumer() {
66+
return new NullComputationResultConsumer<>();
67+
}
68+
69+
70+
static class Factory extends GraphAlgorithmFactory<SpeakerListenerLPA,SpeakerListenerLPAConfig> {
71+
72+
@Override
73+
public SpeakerListenerLPA build(
74+
Graph graphOrGraphStore,
75+
SpeakerListenerLPAConfig configuration,
76+
ProgressTracker progressTracker
77+
) {
78+
return null;
79+
}
80+
81+
@Override
82+
public String taskName() {
83+
return "";
84+
}
85+
86+
@Override
87+
public MemoryEstimation memoryEstimation(SpeakerListenerLPAConfig config) {
88+
return new SpeakerListenerLPAMemoryEstimateDefinition().memoryEstimation();
89+
}
90+
}
91+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.gds.sllp;
21+
22+
import org.neo4j.gds.GraphAlgorithmFactory;
23+
import org.neo4j.gds.NullComputationResultConsumer;
24+
import org.neo4j.gds.api.Graph;
25+
import org.neo4j.gds.beta.pregel.PregelResult;
26+
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
27+
import org.neo4j.gds.executor.AlgorithmSpec;
28+
import org.neo4j.gds.executor.ComputationResultConsumer;
29+
import org.neo4j.gds.executor.ExecutionContext;
30+
import org.neo4j.gds.executor.ExecutionMode;
31+
import org.neo4j.gds.executor.GdsCallable;
32+
import org.neo4j.gds.mem.MemoryEstimation;
33+
import org.neo4j.gds.procedures.algorithms.centrality.SpeakerListenerLPAStreamResult;
34+
import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
35+
import org.neo4j.gds.sllpa.SpeakerListenerLPA;
36+
import org.neo4j.gds.sllpa.SpeakerListenerLPAConfig;
37+
import org.neo4j.gds.sllpa.SpeakerListenerLPAMemoryEstimateDefinition;
38+
39+
import java.util.stream.Stream;
40+
41+
@GdsCallable(
42+
name = "gds.sllpa.stream",
43+
aliases = {"gds.alpha.sllpa.stream"},
44+
description = Constants.SLLP_DESCRIPTION,
45+
executionMode = ExecutionMode.STREAM
46+
)
47+
public class SpeakerListenerLPAStreamSpec implements AlgorithmSpec<SpeakerListenerLPA, PregelResult, SpeakerListenerLPAConfig, Stream<SpeakerListenerLPAStreamResult>, SpeakerListenerLPAStreamSpec.Factory> {
48+
49+
@Override
50+
public String name() {
51+
return "SpeakerListenerLPAStream";
52+
}
53+
54+
@Override
55+
public Factory algorithmFactory(ExecutionContext executionContext) {
56+
return new Factory();
57+
}
58+
59+
@Override
60+
public NewConfigFunction<SpeakerListenerLPAConfig> newConfigFunction() {
61+
return (___,config) -> SpeakerListenerLPAConfig.of(config);
62+
}
63+
64+
@Override
65+
public ComputationResultConsumer<SpeakerListenerLPA, PregelResult, SpeakerListenerLPAConfig, Stream<SpeakerListenerLPAStreamResult>> computationResultConsumer() {
66+
return new NullComputationResultConsumer<>();
67+
}
68+
69+
70+
static class Factory extends GraphAlgorithmFactory<SpeakerListenerLPA,SpeakerListenerLPAConfig> {
71+
72+
@Override
73+
public SpeakerListenerLPA build(
74+
Graph graphOrGraphStore,
75+
SpeakerListenerLPAConfig configuration,
76+
ProgressTracker progressTracker
77+
) {
78+
return null;
79+
}
80+
81+
@Override
82+
public String taskName() {
83+
return "";
84+
}
85+
86+
@Override
87+
public MemoryEstimation memoryEstimation(SpeakerListenerLPAConfig config) {
88+
return new SpeakerListenerLPAMemoryEstimateDefinition().memoryEstimation();
89+
}
90+
}
91+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.gds.sllp;
21+
22+
import org.neo4j.gds.GraphAlgorithmFactory;
23+
import org.neo4j.gds.NullComputationResultConsumer;
24+
import org.neo4j.gds.api.Graph;
25+
import org.neo4j.gds.beta.pregel.PregelResult;
26+
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
27+
import org.neo4j.gds.executor.AlgorithmSpec;
28+
import org.neo4j.gds.executor.ComputationResultConsumer;
29+
import org.neo4j.gds.executor.ExecutionContext;
30+
import org.neo4j.gds.executor.ExecutionMode;
31+
import org.neo4j.gds.executor.GdsCallable;
32+
import org.neo4j.gds.mem.MemoryEstimation;
33+
import org.neo4j.gds.procedures.algorithms.centrality.SpeakerListenerLPAWriteResult;
34+
import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
35+
import org.neo4j.gds.sllpa.SpeakerListenerLPA;
36+
import org.neo4j.gds.sllpa.SpeakerListenerLPAConfig;
37+
import org.neo4j.gds.sllpa.SpeakerListenerLPAMemoryEstimateDefinition;
38+
39+
import java.util.stream.Stream;
40+
41+
@GdsCallable(
42+
name = "gds.sllpa.write",
43+
aliases = {"gds.alpha.sllpa.write"},
44+
description = Constants.SLLP_DESCRIPTION,
45+
executionMode = ExecutionMode.WRITE_NODE_PROPERTY
46+
)
47+
public class SpeakerListenerLPAWriteSpec implements AlgorithmSpec<SpeakerListenerLPA, PregelResult, SpeakerListenerLPAConfig, Stream<SpeakerListenerLPAWriteResult>, SpeakerListenerLPAWriteSpec.Factory> {
48+
49+
@Override
50+
public String name() {
51+
return "SpeakerListenerLPAStream";
52+
}
53+
54+
@Override
55+
public Factory algorithmFactory(ExecutionContext executionContext) {
56+
return new Factory();
57+
}
58+
59+
@Override
60+
public NewConfigFunction<SpeakerListenerLPAConfig> newConfigFunction() {
61+
return (___,config) -> SpeakerListenerLPAConfig.of(config);
62+
}
63+
64+
@Override
65+
public ComputationResultConsumer<SpeakerListenerLPA, PregelResult, SpeakerListenerLPAConfig, Stream<SpeakerListenerLPAWriteResult>> computationResultConsumer() {
66+
return new NullComputationResultConsumer<>();
67+
}
68+
69+
70+
static class Factory extends GraphAlgorithmFactory<SpeakerListenerLPA,SpeakerListenerLPAConfig> {
71+
72+
@Override
73+
public SpeakerListenerLPA build(
74+
Graph graphOrGraphStore,
75+
SpeakerListenerLPAConfig configuration,
76+
ProgressTracker progressTracker
77+
) {
78+
return null;
79+
}
80+
81+
@Override
82+
public String taskName() {
83+
return "";
84+
}
85+
86+
@Override
87+
public MemoryEstimation memoryEstimation(SpeakerListenerLPAConfig config) {
88+
return new SpeakerListenerLPAMemoryEstimateDefinition().memoryEstimation();
89+
}
90+
}
91+
}

0 commit comments

Comments
 (0)