diff --git a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankMutateConfig.java b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankMutateConfig.java index 1d30e005aa..71b2d2d8e7 100644 --- a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankMutateConfig.java +++ b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankMutateConfig.java @@ -26,19 +26,7 @@ @Configuration public interface PageRankMutateConfig extends PageRankConfig, MutateNodePropertyConfig { - private static PageRankMutateConfig of(CypherMapWrapper userInput, boolean checkDampingFactor) { - if (checkDampingFactor && userInput.containsKey("dampingFactor")) { - throw new IllegalArgumentException("Unexpected configuration key: dampingFactor"); - } - + static PageRankMutateConfig of(CypherMapWrapper userInput) { return new PageRankMutateConfigImpl(userInput); } - - static PageRankMutateConfig configWithDampingFactor(CypherMapWrapper userInput) { - return of(userInput, false); - } - - static PageRankMutateConfig configWithoutDampingFactor(CypherMapWrapper userInput) { - return of(userInput, true); - } } diff --git a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankStatsConfig.java b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankStatsConfig.java index d8b8111b61..69169e71d1 100644 --- a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankStatsConfig.java +++ b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankStatsConfig.java @@ -25,20 +25,7 @@ @Configuration public interface PageRankStatsConfig extends PageRankConfig { - private static PageRankStatsConfig of(CypherMapWrapper userInput, boolean checkDampingFactor) { - if (checkDampingFactor && userInput.containsKey("dampingFactor")) { - throw new IllegalArgumentException("Unexpected configuration key: dampingFactor"); - } + public static PageRankStatsConfig of(CypherMapWrapper userInput) { return new PageRankStatsConfigImpl(userInput); } - - static PageRankStatsConfig configWithDampingFactor(CypherMapWrapper userInput) { - return of(userInput, false); - } - - static PageRankStatsConfig configWithoutDampingFactor(CypherMapWrapper userInput) { - return of(userInput, true); - } - - } diff --git a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankStreamConfig.java b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankStreamConfig.java index 1e89175550..d4736c8415 100644 --- a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankStreamConfig.java +++ b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankStreamConfig.java @@ -25,19 +25,8 @@ @Configuration public interface PageRankStreamConfig extends PageRankConfig { - private static PageRankStreamConfig of(CypherMapWrapper userInput, boolean checkDampingFactor) { - if (checkDampingFactor && userInput.containsKey("dampingFactor")) { - throw new IllegalArgumentException("Unexpected configuration key: dampingFactor"); - } - + static PageRankStreamConfig of(CypherMapWrapper userInput) { return new PageRankStreamConfigImpl(userInput); } - static PageRankStreamConfig configWithDampingFactor(CypherMapWrapper userInput) { - return of(userInput, false); - } - - static PageRankStreamConfig configWithoutDampingFactor(CypherMapWrapper userInput) { - return of(userInput, true); - } } diff --git a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankWriteConfig.java b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankWriteConfig.java index 8fbec11dbe..ba4c85f766 100644 --- a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankWriteConfig.java +++ b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankWriteConfig.java @@ -26,18 +26,7 @@ @Configuration public interface PageRankWriteConfig extends PageRankConfig, WritePropertyConfig { - private static PageRankWriteConfig of(CypherMapWrapper userInput, boolean checkDampingFactor) { - if (checkDampingFactor && userInput.containsKey("dampingFactor")) { - throw new IllegalArgumentException("Unexpected configuration key: dampingFactor"); - } + public static PageRankWriteConfig of(CypherMapWrapper userInput) { return new PageRankWriteConfigImpl(userInput); } - - static PageRankWriteConfig configWithDampingFactor(CypherMapWrapper userInput) { - return of(userInput, false); - } - - static PageRankWriteConfig configWithoutDampingFactor(CypherMapWrapper userInput) { - return of(userInput, true); - } } diff --git a/applications/algorithms/centrality/src/main/java/org/neo4j/gds/applications/algorithms/centrality/CentralityAlgorithmsEstimationModeBusinessFacade.java b/applications/algorithms/centrality/src/main/java/org/neo4j/gds/applications/algorithms/centrality/CentralityAlgorithmsEstimationModeBusinessFacade.java index cc04548354..b72e00fbfb 100644 --- a/applications/algorithms/centrality/src/main/java/org/neo4j/gds/applications/algorithms/centrality/CentralityAlgorithmsEstimationModeBusinessFacade.java +++ b/applications/algorithms/centrality/src/main/java/org/neo4j/gds/applications/algorithms/centrality/CentralityAlgorithmsEstimationModeBusinessFacade.java @@ -35,8 +35,8 @@ import org.neo4j.gds.influenceMaximization.CELFMemoryEstimateDefinition; import org.neo4j.gds.influenceMaximization.InfluenceMaximizationBaseConfig; import org.neo4j.gds.mem.MemoryEstimation; -import org.neo4j.gds.pagerank.PageRankConfig; import org.neo4j.gds.pagerank.PageRankMemoryEstimateDefinition; +import org.neo4j.gds.pagerank.RankConfig; public class CentralityAlgorithmsEstimationModeBusinessFacade { private final AlgorithmEstimationTemplate algorithmEstimationTemplate; @@ -136,7 +136,7 @@ public MemoryEstimation pageRank() { return new PageRankMemoryEstimateDefinition().memoryEstimation(); } - public MemoryEstimateResult pageRank(PageRankConfig configuration, Object graphNameOrConfiguration) { + public MemoryEstimateResult pageRank(RankConfig configuration, Object graphNameOrConfiguration) { var memoryEstimation = pageRank(); return algorithmEstimationTemplate.estimate( diff --git a/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/ConfigurationParsersForMutateMode.java b/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/ConfigurationParsersForMutateMode.java index d63332c2de..7ab3cfc8bc 100644 --- a/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/ConfigurationParsersForMutateMode.java +++ b/pipeline/src/main/java/org/neo4j/gds/ml/pipeline/ConfigurationParsersForMutateMode.java @@ -44,6 +44,8 @@ import org.neo4j.gds.louvain.LouvainMutateConfig; import org.neo4j.gds.ml.splitting.SplitRelationshipsMutateConfig; import org.neo4j.gds.modularityoptimization.ModularityOptimizationMutateConfig; +import org.neo4j.gds.pagerank.ArticleRankMutateConfig; +import org.neo4j.gds.pagerank.EigenvectorMutateConfig; import org.neo4j.gds.pagerank.PageRankMutateConfig; import org.neo4j.gds.paths.astar.config.ShortestPathAStarMutateConfig; import org.neo4j.gds.paths.bellmanford.AllShortestPathsBellmanFordMutateConfig; @@ -80,7 +82,7 @@ public Function lookup(Algorithm algorithm) { return switch (algorithm) { case AllShortestPaths -> null; case ApproximateMaximumKCut -> ApproxMaxKCutMutateConfig::of; - case ArticleRank -> PageRankMutateConfig::configWithDampingFactor; + case ArticleRank -> ArticleRankMutateConfig::of; case ArticulationPoints -> ArticulationPointsMutateConfig::of; case AStar -> ShortestPathAStarMutateConfig::of; case BellmanFord -> AllShortestPathsBellmanFordMutateConfig::of; @@ -96,7 +98,7 @@ public Function lookup(Algorithm algorithm) { case DeltaStepping -> AllShortestPathsDeltaMutateConfig::of; case DFS -> DfsMutateConfig::of; case Dijkstra -> ShortestPathDijkstraMutateConfig::of; - case EigenVector -> PageRankMutateConfig::configWithoutDampingFactor; + case EigenVector -> EigenvectorMutateConfig::of; case FastRP -> FastRPMutateConfig::of; case FilteredKNN -> FilteredKnnMutateConfig::of; case FilteredNodeSimilarity -> FilteredNodeSimilarityMutateConfig::of; @@ -120,7 +122,7 @@ public Function lookup(Algorithm algorithm) { case ModularityOptimization -> ModularityOptimizationMutateConfig::of; case NodeSimilarity -> NodeSimilarityMutateConfig::of; case Node2Vec -> Node2VecMutateConfig::of; - case PageRank -> PageRankMutateConfig::configWithDampingFactor; + case PageRank -> PageRankMutateConfig::of; case RandomWalk -> null; case ScaleProperties -> ScalePropertiesMutateConfig::of; case SCC -> SccMutateConfig::of; diff --git a/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankMutateSpec.java b/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankMutateSpec.java index 5be16b1800..6fef0de696 100644 --- a/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankMutateSpec.java +++ b/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankMutateSpec.java @@ -47,7 +47,7 @@ public PageRankAlgorithmFactory algorithmFactory(Execution @Override public NewConfigFunction newConfigFunction() { - return (___, config) -> PageRankMutateConfig.configWithDampingFactor(config); + return (___, config) -> PageRankMutateConfig.of(config); } @Override diff --git a/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankStatsSpec.java b/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankStatsSpec.java index 5a96495bac..506db2be6c 100644 --- a/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankStatsSpec.java +++ b/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankStatsSpec.java @@ -47,7 +47,7 @@ public PageRankAlgorithmFactory algorithmFactory(ExecutionC @Override public NewConfigFunction newConfigFunction() { - return (___, config) -> PageRankStatsConfig.configWithDampingFactor(config); + return (___, config) -> PageRankStatsConfig.of(config); } @Override diff --git a/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankStreamSpec.java b/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankStreamSpec.java index 6d6c6cd803..f7b1325b67 100644 --- a/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankStreamSpec.java +++ b/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankStreamSpec.java @@ -47,7 +47,7 @@ public PageRankAlgorithmFactory algorithmFactory(Execution @Override public NewConfigFunction newConfigFunction() { - return (___,config) -> PageRankStreamConfig.configWithDampingFactor(config); + return (___,config) -> PageRankStreamConfig.of(config); } @Override diff --git a/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankWriteSpec.java b/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankWriteSpec.java index 9192183b9c..4cab577695 100644 --- a/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankWriteSpec.java +++ b/proc/centrality/src/main/java/org/neo4j/gds/pagerank/PageRankWriteSpec.java @@ -47,7 +47,7 @@ public PageRankAlgorithmFactory algorithmFactory(ExecutionC @Override public NewConfigFunction newConfigFunction() { - return (___,config) -> PageRankWriteConfig.configWithDampingFactor(config); + return (___,config) -> PageRankWriteConfig.of(config); } @Override diff --git a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/CentralityProcedureFacade.java b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/CentralityProcedureFacade.java index 7a8e920715..c02a363b66 100644 --- a/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/CentralityProcedureFacade.java +++ b/procedures/algorithms-facade/src/main/java/org/neo4j/gds/procedures/algorithms/centrality/CentralityProcedureFacade.java @@ -204,7 +204,7 @@ public static CentralityProcedureFacade create( estimationModeBusinessFacade, procedureReturnColumns, mutateModeBusinessFacade::pageRank, - PageRankMutateConfig::configWithDampingFactor + PageRankMutateConfig::of ); @@ -297,7 +297,7 @@ public Stream articleRankStatsEstimate( ) { var parsedConfiguration = configurationParser.parseConfiguration( algorithmConfiguration, - PageRankStatsConfig::configWithDampingFactor + ArticleRankStatsConfig::of ); return Stream.of(estimationModeBusinessFacade.pageRank(parsedConfiguration, graphNameOrConfiguration)); @@ -323,7 +323,7 @@ public Stream articleRankStreamEstimate( ) { var parsedConfiguration = configurationParser.parseConfiguration( algorithmConfiguration, - PageRankStreamConfig::configWithoutDampingFactor + ArticleRankStreamConfig::of ); return Stream.of(estimationModeBusinessFacade.pageRank(parsedConfiguration, graphNameOrConfiguration)); @@ -354,7 +354,7 @@ public Stream articleRankWriteEstimate( ) { var parsedConfiguration = configurationParser.parseConfiguration( algorithmConfiguration, - PageRankWriteConfig::configWithoutDampingFactor + ArticleRankWriteConfig::of ); return Stream.of(estimationModeBusinessFacade.pageRank(parsedConfiguration, graphNameOrConfiguration)); @@ -920,7 +920,7 @@ public Stream eigenvectorStatsEstimate( ) { var parsedConfiguration = configurationParser.parseConfiguration( algorithmConfiguration, - PageRankStatsConfig::configWithoutDampingFactor + EigenvectorStatsConfig::of ); return Stream.of(estimationModeBusinessFacade.pageRank(parsedConfiguration, graphNameOrConfiguration)); @@ -947,7 +947,7 @@ public Stream eigenvectorStreamEstimate( ) { var parsedConfiguration = configurationParser.parseConfiguration( algorithmConfiguration, - PageRankStreamConfig::configWithoutDampingFactor + EigenvectorStreamConfig::of ); return Stream.of(estimationModeBusinessFacade.pageRank(parsedConfiguration, graphNameOrConfiguration)); @@ -975,7 +975,7 @@ public Stream eigenvectorWriteEstimate( ) { var parsedConfiguration = configurationParser.parseConfiguration( algorithmConfiguration, - PageRankWriteConfig::configWithoutDampingFactor + EigenvectorWriteConfig::of ); return Stream.of(estimationModeBusinessFacade.pageRank(parsedConfiguration, graphNameOrConfiguration)); @@ -1045,7 +1045,7 @@ public Stream pageRankStats(String graphName, Map pageRankStatsEstimate( ) { var parsedConfiguration = configurationParser.parseConfiguration( algorithmConfiguration, - PageRankStatsConfig::configWithDampingFactor + PageRankStatsConfig::of ); return Stream.of(estimationModeBusinessFacade.pageRank(parsedConfiguration, graphNameOrConfiguration)); @@ -1072,7 +1072,7 @@ public Stream pageRankStream(String graphName, Map pageRankStreamEstimate( ) { var parsedConfiguration = configurationParser.parseConfiguration( algorithmConfiguration, - PageRankStreamConfig::configWithDampingFactor + PageRankStreamConfig::of ); return Stream.of(estimationModeBusinessFacade.pageRank(parsedConfiguration, graphNameOrConfiguration)); @@ -1101,7 +1101,7 @@ public Stream pageRankWrite(String graphName, Map pageRankWriteEstimate( ) { var parsedConfiguration = configurationParser.parseConfiguration( algorithmConfiguration, - PageRankWriteConfig::configWithDampingFactor + PageRankWriteConfig::of ); return Stream.of(estimationModeBusinessFacade.pageRank(parsedConfiguration, graphNameOrConfiguration));