Skip to content

Commit

Permalink
Separate mutate and write steps
Browse files Browse the repository at this point in the history
  • Loading branch information
IoannisPanagiotas committed Sep 4, 2024
1 parent d67611a commit a0774b0
Show file tree
Hide file tree
Showing 97 changed files with 514 additions and 587 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@
import com.carrotsearch.hppc.BitSet;
import org.neo4j.gds.api.Graph;
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.api.ResultStore;
import org.neo4j.gds.api.properties.nodes.LongNodePropertyValues;
import org.neo4j.gds.applications.algorithms.machinery.MutateNodeProperty;
import org.neo4j.gds.applications.algorithms.machinery.MutateOrWriteStep;
import org.neo4j.gds.applications.algorithms.machinery.MutateStep;
import org.neo4j.gds.applications.algorithms.metadata.NodePropertiesWritten;
import org.neo4j.gds.articulationpoints.ArticulationPointsMutateConfig;
import org.neo4j.gds.core.utils.progress.JobId;

class ArticulationPointsMutateStep implements MutateOrWriteStep<BitSet, NodePropertiesWritten> {
class ArticulationPointsMutateStep implements MutateStep<BitSet, NodePropertiesWritten> {
private final MutateNodeProperty mutateNodeProperty;
private final ArticulationPointsMutateConfig configuration;

Expand All @@ -43,9 +41,7 @@ class ArticulationPointsMutateStep implements MutateOrWriteStep<BitSet, NodeProp
public NodePropertiesWritten execute(
Graph graph,
GraphStore graphStore,
ResultStore resultStore,
BitSet result,
JobId jobId
BitSet result
) {
var nodeProperties = new LongNodePropertyValues() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.api.ResultStore;
import org.neo4j.gds.api.properties.nodes.LongNodePropertyValues;
import org.neo4j.gds.applications.algorithms.machinery.MutateOrWriteStep;
import org.neo4j.gds.applications.algorithms.machinery.WriteStep;
import org.neo4j.gds.applications.algorithms.machinery.WriteToDatabase;
import org.neo4j.gds.applications.algorithms.metadata.NodePropertiesWritten;
import org.neo4j.gds.articulationpoints.ArticulationPointsWriteConfig;
import org.neo4j.gds.core.utils.progress.JobId;

import static org.neo4j.gds.applications.algorithms.metadata.Algorithm.ArticulationPoints;

class ArticulationPointsWriteStep implements MutateOrWriteStep<BitSet, NodePropertiesWritten> {
class ArticulationPointsWriteStep implements WriteStep<BitSet, NodePropertiesWritten> {
private final ArticulationPointsWriteConfig configuration;
private final WriteToDatabase writeToDatabase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@

import org.neo4j.gds.api.Graph;
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.api.ResultStore;
import org.neo4j.gds.applications.algorithms.machinery.MutateNodeProperty;
import org.neo4j.gds.applications.algorithms.machinery.MutateOrWriteStep;
import org.neo4j.gds.applications.algorithms.machinery.MutateStep;
import org.neo4j.gds.applications.algorithms.metadata.NodePropertiesWritten;
import org.neo4j.gds.betweenness.BetweennessCentralityMutateConfig;
import org.neo4j.gds.betweenness.BetwennessCentralityResult;
import org.neo4j.gds.core.utils.progress.JobId;

class BetweennessCentralityMutateStep implements MutateOrWriteStep<BetwennessCentralityResult, NodePropertiesWritten> {
class BetweennessCentralityMutateStep implements MutateStep<BetwennessCentralityResult, NodePropertiesWritten> {
private final MutateNodeProperty mutateNodeProperty;
private final BetweennessCentralityMutateConfig configuration;

Expand All @@ -45,9 +43,7 @@ class BetweennessCentralityMutateStep implements MutateOrWriteStep<BetwennessCen
public NodePropertiesWritten execute(
Graph graph,
GraphStore graphStore,
ResultStore resultStore,
BetwennessCentralityResult result,
JobId jobId
BetwennessCentralityResult result
) {
return mutateNodeProperty.mutateNodeProperties(
graph,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
import org.neo4j.gds.api.Graph;
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.api.ResultStore;
import org.neo4j.gds.applications.algorithms.machinery.MutateOrWriteStep;
import org.neo4j.gds.applications.algorithms.machinery.WriteStep;
import org.neo4j.gds.applications.algorithms.machinery.WriteToDatabase;
import org.neo4j.gds.applications.algorithms.metadata.NodePropertiesWritten;
import org.neo4j.gds.betweenness.BetweennessCentralityWriteConfig;
import org.neo4j.gds.core.utils.progress.JobId;

import static org.neo4j.gds.applications.algorithms.metadata.Algorithm.BetweennessCentrality;

class BetweennessCentralityWriteStep implements MutateOrWriteStep<CentralityAlgorithmResult, NodePropertiesWritten> {
class BetweennessCentralityWriteStep implements WriteStep<CentralityAlgorithmResult, NodePropertiesWritten> {
private final WriteToDatabase writeToDatabase;
private final BetweennessCentralityWriteConfig configuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@

import org.neo4j.gds.api.Graph;
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.api.ResultStore;
import org.neo4j.gds.applications.algorithms.machinery.MutateNodeProperty;
import org.neo4j.gds.applications.algorithms.machinery.MutateOrWriteStep;
import org.neo4j.gds.applications.algorithms.machinery.MutateStep;
import org.neo4j.gds.applications.algorithms.metadata.NodePropertiesWritten;
import org.neo4j.gds.core.utils.progress.JobId;
import org.neo4j.gds.influenceMaximization.CELFNodeProperties;
import org.neo4j.gds.influenceMaximization.CELFResult;
import org.neo4j.gds.influenceMaximization.InfluenceMaximizationMutateConfig;

class CelfMutateStep implements MutateOrWriteStep<CELFResult, NodePropertiesWritten> {
class CelfMutateStep implements MutateStep<CELFResult, NodePropertiesWritten> {
private final MutateNodeProperty mutateNodeProperty;
private final InfluenceMaximizationMutateConfig configuration;

Expand All @@ -43,9 +41,7 @@ class CelfMutateStep implements MutateOrWriteStep<CELFResult, NodePropertiesWrit
public NodePropertiesWritten execute(
Graph graph,
GraphStore graphStore,
ResultStore resultStore,
CELFResult result,
JobId jobId
CELFResult result
) {
var nodeProperties = new CELFNodeProperties(result.seedSetNodes(), graph.nodeCount());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.neo4j.gds.api.Graph;
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.api.ResultStore;
import org.neo4j.gds.applications.algorithms.machinery.MutateOrWriteStep;
import org.neo4j.gds.applications.algorithms.machinery.WriteStep;
import org.neo4j.gds.applications.algorithms.machinery.WriteToDatabase;
import org.neo4j.gds.applications.algorithms.metadata.NodePropertiesWritten;
import org.neo4j.gds.core.utils.progress.JobId;
Expand All @@ -32,7 +32,7 @@

import static org.neo4j.gds.applications.algorithms.metadata.Algorithm.CELF;

class CelfWriteStep implements MutateOrWriteStep<CELFResult, NodePropertiesWritten> {
class CelfWriteStep implements WriteStep<CELFResult, NodePropertiesWritten> {
private final WriteToDatabase writeToDatabase;
private final InfluenceMaximizationWriteConfig configuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public <RESULT> RESULT articleRank(
) {
var mutateStep = new PageRankMutateStep(mutateNodeProperty, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateMode(
graphName,
configuration,
ArticleRank,
Expand All @@ -92,7 +92,7 @@ public <RESULT> RESULT articulationPoints(
) {
var mutateStep = new ArticulationPointsMutateStep(mutateNodeProperty, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateMode(
graphName,
configuration,
ArticulationPoints,
Expand All @@ -111,7 +111,7 @@ public <RESULT> RESULT betweennessCentrality(
) {
var mutateStep = new BetweennessCentralityMutateStep(mutateNodeProperty, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateMode(
graphName,
configuration,
BetweennessCentrality,
Expand All @@ -129,7 +129,7 @@ public <RESULT> RESULT celf(
) {
var mutateStep = new CelfMutateStep(mutateNodeProperty, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateMode(
graphName,
configuration,
CELF,
Expand All @@ -147,7 +147,7 @@ public <RESULT> RESULT closenessCentrality(
) {
var mutateStep = new ClosenessCentralityMutateStep(mutateNodeProperty, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateMode(
graphName,
configuration,
ClosenessCentrality,
Expand All @@ -165,7 +165,7 @@ public <RESULT> RESULT degreeCentrality(
) {
var mutateStep = new DegreeCentralityMutateStep(mutateNodeProperty, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateMode(
graphName,
configuration,
DegreeCentrality,
Expand All @@ -183,7 +183,7 @@ public <RESULT> RESULT eigenVector(
) {
var mutateStep = new PageRankMutateStep(mutateNodeProperty, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateMode(
graphName,
configuration,
EigenVector,
Expand All @@ -201,7 +201,7 @@ public <RESULT> RESULT harmonicCentrality(
) {
var mutateStep = new HarmonicCentralityMutateStep(mutateNodeProperty, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateMode(
graphName,
configuration,
HarmonicCentrality,
Expand All @@ -219,7 +219,7 @@ public <RESULT> RESULT pageRank(
) {
var mutateStep = new PageRankMutateStep(mutateNodeProperty, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateMode(
graphName,
configuration,
PageRank,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public <RESULT> RESULT articleRank(
) {
var writeStep = new PageRankWriteStep(writeToDatabase, configuration, ArticleRank);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInWriteMode(
graphName,
configuration,
ArticleRank,
Expand All @@ -111,7 +111,7 @@ public <RESULT> RESULT betweennessCentrality(
) {
var writeStep = new BetweennessCentralityWriteStep(writeToDatabase, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInWriteMode(
graphName,
configuration,
BetweennessCentrality,
Expand All @@ -127,7 +127,7 @@ public <RESULT> RESULT articulationPoints(
ArticulationPointsWriteConfig configuration,
ResultBuilder<ArticulationPointsWriteConfig, BitSet, RESULT, NodePropertiesWritten> resultBuilder
) {
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInWriteMode(
graphName,
configuration,
ArticulationPoints,
Expand All @@ -145,7 +145,7 @@ public <CONFIGURATION extends InfluenceMaximizationWriteConfig, RESULT> RESULT c
) {
var writeStep = new CelfWriteStep(writeToDatabase, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInWriteMode(
graphName,
configuration,
CELF,
Expand All @@ -163,7 +163,7 @@ public <RESULT> RESULT closenessCentrality(
) {
var writeStep = new ClosenessCentralityWriteStep(writeToDatabase, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInWriteMode(
graphName,
configuration,
ClosenessCentrality,
Expand All @@ -181,7 +181,7 @@ public <RESULT> RESULT degreeCentrality(
) {
var writeStep = new DegreeCentralityWriteStep(writeToDatabase, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInWriteMode(
graphName,
configuration,
DegreeCentrality,
Expand All @@ -199,7 +199,7 @@ public <RESULT> RESULT eigenvector(
) {
var writeStep = new PageRankWriteStep(writeToDatabase, configuration, EigenVector);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInWriteMode(
graphName,
configuration,
EigenVector,
Expand All @@ -217,7 +217,7 @@ public <CONFIGURATION extends HarmonicCentralityWriteConfig, RESULT> RESULT harm
) {
var writeStep = new HarmonicCentralityWriteStep(writeToDatabase, configuration);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInWriteMode(
graphName,
configuration,
HarmonicCentrality,
Expand All @@ -235,7 +235,7 @@ public <RESULT> RESULT pageRank(
) {
var writeStep = new PageRankWriteStep(writeToDatabase, configuration, ArticleRank);

return algorithmProcessingTemplateConvenience.processRegularAlgorithmInMutateOrWriteMode(
return algorithmProcessingTemplateConvenience.processRegularAlgorithmInWriteMode(
graphName,
configuration,
PageRank,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@

import org.neo4j.gds.api.Graph;
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.api.ResultStore;
import org.neo4j.gds.applications.algorithms.machinery.MutateNodeProperty;
import org.neo4j.gds.applications.algorithms.machinery.MutateOrWriteStep;
import org.neo4j.gds.applications.algorithms.machinery.MutateStep;
import org.neo4j.gds.applications.algorithms.metadata.NodePropertiesWritten;
import org.neo4j.gds.closeness.ClosenessCentralityMutateConfig;
import org.neo4j.gds.closeness.ClosenessCentralityResult;
import org.neo4j.gds.core.utils.progress.JobId;

class ClosenessCentralityMutateStep implements MutateOrWriteStep<ClosenessCentralityResult, NodePropertiesWritten> {
class ClosenessCentralityMutateStep implements MutateStep<ClosenessCentralityResult, NodePropertiesWritten> {
private final MutateNodeProperty mutateNodeProperty;
private final ClosenessCentralityMutateConfig configuration;

Expand All @@ -45,9 +43,7 @@ class ClosenessCentralityMutateStep implements MutateOrWriteStep<ClosenessCentra
public NodePropertiesWritten execute(
Graph graph,
GraphStore graphStore,
ResultStore resultStore,
ClosenessCentralityResult result,
JobId jobId
ClosenessCentralityResult result
) {
return mutateNodeProperty.mutateNodeProperties(
graph,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
import org.neo4j.gds.api.Graph;
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.api.ResultStore;
import org.neo4j.gds.applications.algorithms.machinery.MutateOrWriteStep;
import org.neo4j.gds.applications.algorithms.machinery.WriteStep;
import org.neo4j.gds.applications.algorithms.machinery.WriteToDatabase;
import org.neo4j.gds.applications.algorithms.metadata.NodePropertiesWritten;
import org.neo4j.gds.closeness.ClosenessCentralityWriteConfig;
import org.neo4j.gds.core.utils.progress.JobId;

import static org.neo4j.gds.applications.algorithms.metadata.Algorithm.ClosenessCentrality;

class ClosenessCentralityWriteStep implements MutateOrWriteStep<CentralityAlgorithmResult, NodePropertiesWritten> {
class ClosenessCentralityWriteStep implements WriteStep<CentralityAlgorithmResult, NodePropertiesWritten> {
private final WriteToDatabase writeToDatabase;
private final ClosenessCentralityWriteConfig configuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@

import org.neo4j.gds.api.Graph;
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.api.ResultStore;
import org.neo4j.gds.applications.algorithms.machinery.MutateNodeProperty;
import org.neo4j.gds.applications.algorithms.machinery.MutateOrWriteStep;
import org.neo4j.gds.applications.algorithms.machinery.MutateStep;
import org.neo4j.gds.applications.algorithms.metadata.NodePropertiesWritten;
import org.neo4j.gds.core.utils.progress.JobId;
import org.neo4j.gds.degree.DegreeCentralityMutateConfig;
import org.neo4j.gds.degree.DegreeCentralityResult;

class DegreeCentralityMutateStep implements MutateOrWriteStep<DegreeCentralityResult, NodePropertiesWritten> {
class DegreeCentralityMutateStep implements MutateStep<DegreeCentralityResult, NodePropertiesWritten> {
private final MutateNodeProperty mutateNodeProperty;
private final DegreeCentralityMutateConfig configuration;

Expand All @@ -45,9 +43,7 @@ class DegreeCentralityMutateStep implements MutateOrWriteStep<DegreeCentralityRe
public NodePropertiesWritten execute(
Graph graph,
GraphStore graphStore,
ResultStore resultStore,
DegreeCentralityResult result,
JobId jobId
DegreeCentralityResult result
) {
return mutateNodeProperty.mutateNodeProperties(
graph,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
import org.neo4j.gds.api.Graph;
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.api.ResultStore;
import org.neo4j.gds.applications.algorithms.machinery.MutateOrWriteStep;
import org.neo4j.gds.applications.algorithms.machinery.WriteStep;
import org.neo4j.gds.applications.algorithms.machinery.WriteToDatabase;
import org.neo4j.gds.applications.algorithms.metadata.NodePropertiesWritten;
import org.neo4j.gds.core.utils.progress.JobId;
import org.neo4j.gds.degree.DegreeCentralityWriteConfig;

import static org.neo4j.gds.applications.algorithms.metadata.Algorithm.DegreeCentrality;

class DegreeCentralityWriteStep implements MutateOrWriteStep<CentralityAlgorithmResult, NodePropertiesWritten> {
class DegreeCentralityWriteStep implements WriteStep<CentralityAlgorithmResult, NodePropertiesWritten> {
private final WriteToDatabase writeToDatabase;
private final DegreeCentralityWriteConfig configuration;

Expand Down
Loading

0 comments on commit a0774b0

Please sign in to comment.