Skip to content

Commit

Permalink
Move Misc algorithm specifications to dedicated module
Browse files Browse the repository at this point in the history
  • Loading branch information
vnickolov committed Oct 24, 2024
1 parent ee11a11 commit 2282c0b
Show file tree
Hide file tree
Showing 24 changed files with 193 additions and 128 deletions.
3 changes: 3 additions & 0 deletions algorithm-specifications/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ dependencies {
implementation project(':community-configs')
implementation project(':community-facade-api')

implementation project(':miscellaneous-configs')
implementation project(':miscellaneous-facade-api')

implementation project(':node-embeddings-configs')
implementation project(':node-embeddings-facade-api')

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.gds.indexInverse;

final class Constants {
static final String INDEX_INVERSE_DESCRIPTION = "The IndexInverse procedure indexes directed relationships to allow an efficient inverse access for other algorithms.";

private Constants() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.gds.scaling;

final class Constants {

private Constants() {}

static final String SCALE_PROPERTIES_DESCRIPTION = "Scale node properties";

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.MUTATE_NODE_PROPERTY;
import static org.neo4j.gds.scaling.ScalePropertiesProc.SCALE_PROPERTIES_DESCRIPTION;
import static org.neo4j.gds.scaling.ScalePropertiesProc.validateLegacyScalers;
import static org.neo4j.gds.scaling.Constants.SCALE_PROPERTIES_DESCRIPTION;

@GdsCallable(name = "gds.scaleProperties.mutate", aliases = {"gds.alpha.scaleProperties.mutate"}, description = SCALE_PROPERTIES_DESCRIPTION, executionMode = MUTATE_NODE_PROPERTY)
public class ScalePropertiesMutateSpec implements AlgorithmSpec<ScaleProperties, ScalePropertiesResult, ScalePropertiesMutateConfig, Stream<ScalePropertiesMutateResult>, ScalePropertiesFactory<ScalePropertiesMutateConfig>> {
Expand All @@ -58,11 +57,7 @@ public ScalePropertiesFactory<ScalePropertiesMutateConfig> algorithmFactory(Exec

@Override
public NewConfigFunction<ScalePropertiesMutateConfig> newConfigFunction() {
return (__, userInput) -> {
var config = ScalePropertiesMutateConfig.of(userInput);
validateLegacyScalers(config, allowL1L2Scalers);
return config;
};
return (__, userInput) -> ScalePropertiesMutateConfig.of(userInput);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.STREAM;
import static org.neo4j.gds.scaling.ScalePropertiesProc.SCALE_PROPERTIES_DESCRIPTION;
import static org.neo4j.gds.scaling.ScalePropertiesProc.validateLegacyScalers;
import static org.neo4j.gds.scaling.Constants.SCALE_PROPERTIES_DESCRIPTION;

@GdsCallable(name = "gds.scaleProperties.stats", description = SCALE_PROPERTIES_DESCRIPTION, executionMode = STREAM)
public class ScalePropertiesStatsSpec implements AlgorithmSpec<ScaleProperties, ScalePropertiesResult, ScalePropertiesStatsConfig, Stream<ScalePropertiesStatsResult>, ScalePropertiesFactory<ScalePropertiesStatsConfig>> {
Expand All @@ -51,11 +50,7 @@ public ScalePropertiesFactory<ScalePropertiesStatsConfig> algorithmFactory(Execu

@Override
public NewConfigFunction<ScalePropertiesStatsConfig> newConfigFunction() {
return (__, userInput) -> {
var config = ScalePropertiesStatsConfig.of(userInput);
validateLegacyScalers(config, false);
return config;
};
return (__, userInput) -> ScalePropertiesStatsConfig.of(userInput);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.STREAM;
import static org.neo4j.gds.scaling.ScalePropertiesProc.SCALE_PROPERTIES_DESCRIPTION;
import static org.neo4j.gds.scaling.ScalePropertiesProc.validateLegacyScalers;
import static org.neo4j.gds.scaling.Constants.SCALE_PROPERTIES_DESCRIPTION;

@GdsCallable(name = "gds.scaleProperties.stream", aliases = {"gds.alpha.scaleProperties.stream"}, description = SCALE_PROPERTIES_DESCRIPTION, executionMode = STREAM)
public class ScalePropertiesStreamSpec implements AlgorithmSpec<ScaleProperties, ScalePropertiesResult, ScalePropertiesStreamConfig, Stream<ScalePropertiesStreamResult>, ScalePropertiesFactory<ScalePropertiesStreamConfig>> {
Expand All @@ -58,11 +57,7 @@ public ScalePropertiesFactory<ScalePropertiesStreamConfig> algorithmFactory(Exec

@Override
public NewConfigFunction<ScalePropertiesStreamConfig> newConfigFunction() {
return (__, userInput) -> {
var config = ScalePropertiesStreamConfig.of(userInput);
validateLegacyScalers(config, allowL1L2Scalers);
return config;
};
return (__, userInput) -> ScalePropertiesStreamConfig.of(userInput);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@

import java.util.stream.Stream;

import static org.neo4j.gds.scaling.ScalePropertiesProc.SCALE_PROPERTIES_DESCRIPTION;
import static org.neo4j.gds.scaling.ScalePropertiesProc.validateLegacyScalers;
import static org.neo4j.gds.scaling.Constants.SCALE_PROPERTIES_DESCRIPTION;

@GdsCallable(name = "gds.scaleProperties.write", description = SCALE_PROPERTIES_DESCRIPTION, executionMode = ExecutionMode.WRITE_NODE_PROPERTY)
public class ScalePropertiesWriteSpec implements AlgorithmSpec<ScaleProperties, ScalePropertiesResult, ScalePropertiesWriteConfig, Stream<ScalePropertiesWriteResult>, ScalePropertiesFactory<ScalePropertiesWriteConfig>> {
Expand All @@ -52,11 +51,7 @@ public ScalePropertiesFactory<ScalePropertiesWriteConfig> algorithmFactory(Execu

@Override
public NewConfigFunction<ScalePropertiesWriteConfig> newConfigFunction() {
return (__, userInput) -> {
var config = ScalePropertiesWriteConfig.of(userInput);
validateLegacyScalers(config, false);
return config;
};
return (__, userInput) -> ScalePropertiesWriteConfig.of(userInput);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.gds.undirected;

final class Constants {
static final String TO_UNDIRECTED_DESCRIPTION = "The ToUndirected procedure converts directed relationships to undirected relationships";

private Constants() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.MUTATE_RELATIONSHIP;
import static org.neo4j.gds.walking.CollapsePathMutateProc.DESCRIPTION;
import static org.neo4j.gds.walking.Constants.COLLAPSE_PATH_DESCRIPTION;

@GdsCallable(
name = "gds.collapsePath.mutate",
aliases = "gds.beta.collapsePath.mutate",
description = DESCRIPTION,
description = COLLAPSE_PATH_DESCRIPTION,
executionMode = MUTATE_RELATIONSHIP
)
public class CollapsePathMutateSpec implements AlgorithmSpec<CollapsePath, SingleTypeRelationships, CollapsePathConfig,Stream<CollapsePathMutateResult>, CollapsePathAlgorithmFactory> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.gds.walking;

final class Constants {
static final String COLLAPSE_PATH_DESCRIPTION = "Collapse Path algorithm is a traversal algorithm capable of creating relationships between the start and end nodes of a traversal";

private Constants() {}
}
35 changes: 7 additions & 28 deletions proc/misc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,28 @@ group = 'org.neo4j.gds'
dependencies {
annotationProcessor project(':procedure-collector')

// TODO: remove this fella
implementation project(':algo')

implementation project(':algorithms-machinery')
// implementation project(':algorithms-procedure-facade')
implementation project(':algo-common')
implementation project(':annotations')
implementation project(':config-api')
implementation project(':core')
implementation project(':core-write')
implementation project(':core-utils')
implementation project(':csv')
implementation project(':executor')
implementation project(':logging')
implementation project(':memory-usage')

// implementation project(':opengds-procedure-facade')
implementation project(':neo4j-kernel-adapter')
implementation project(':procedures-facade-api')

implementation project(':operations-facade-api')
implementation project(':proc-common')
implementation project(':proc-embeddings')
implementation project(':progress-tracking')
implementation project(':string-formatting')
implementation project(':transaction')

compileOnly openGds.jetbrains.annotations

compileOnly openGds.immutables.builder
compileOnly openGds.immutables.value.annotations

neodeps().each {
compileOnly(group: 'org.neo4j', name: it, version: ver.'neo4j') {
transitive = false
}
}
compileOnly group: 'org.neo4j', name: 'neo4j-procedure-api', version: ver.neo4j
compileOnly group: 'org.neo4j', name: 'neo4j-kernel-api', version: ver.neo4j

testCompileOnly openGds.immutables.builder


testImplementation project(':core')
testImplementation project(':core-utils')
testImplementation project(':executor')
testImplementation project(':graph-schema-api')
testImplementation project(':ml-core')
testImplementation project(':proc-test')
testImplementation project(':string-formatting')

testImplementation project(':opengds-extension')
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*/
package org.neo4j.gds.indexInverse;

class Constants {
final class Constants {
static final String INDEX_INVERSE_DESCRIPTION = "The IndexInverse procedure indexes directed relationships to allow an efficient inverse access for other algorithms.";

private Constants() {}
}
28 changes: 28 additions & 0 deletions proc/misc/src/main/java/org/neo4j/gds/scaling/Constants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.gds.scaling;

final class Constants {

private Constants() {}

static final String SCALE_PROPERTIES_DESCRIPTION = "Scale node properties";

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.stream.Stream;

import static org.neo4j.gds.procedures.ProcedureConstants.MEMORY_ESTIMATION_DESCRIPTION;
import static org.neo4j.gds.scaling.ScalePropertiesProc.SCALE_PROPERTIES_DESCRIPTION;
import static org.neo4j.gds.scaling.Constants.SCALE_PROPERTIES_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class ScalePropertiesMutateProc {
Expand Down

This file was deleted.

Loading

0 comments on commit 2282c0b

Please sign in to comment.