Skip to content

Commit ee11a11

Browse files
committed
Move Similarity algorithm specifications to dedicated module
1 parent 8b65cab commit ee11a11

38 files changed

+139
-469
lines changed

algorithm-specifications/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ dependencies {
2828
implementation project(':path-finding-configs')
2929
implementation project(':path-finding-facade-api')
3030

31+
implementation project(':similarity-configs')
32+
implementation project(':similarity-facade-api')
33+
3134

3235
// `BaseConfig`
3336
implementation project(':config-api')
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
*/
2020
package org.neo4j.gds.similarity.filteredknn;
2121

22-
interface FilteredKnnConstants {
23-
String PROCEDURE_DESCRIPTION =
22+
final class Constants {
23+
static final String FILTERED_KNN_DESCRIPTION =
2424
"The k-nearest neighbor graph algorithm constructs relationships between nodes if the distance " +
2525
"between two nodes is among the k nearest distances compared to other nodes. " +
2626
"KNN computes distances based on the similarity of node properties. " +
2727
"Filtered KNN extends this functionality, allowing filtering on source nodes and target nodes, respectively.";
28+
29+
private Constants() {}
2830
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@GdsCallable(
3535
name = "gds.alpha.knn.filtered.mutate",
3636
aliases = {"gds.knn.filtered.mutate"},
37-
description = FilteredKnnConstants.PROCEDURE_DESCRIPTION,
37+
description = Constants.FILTERED_KNN_DESCRIPTION,
3838
executionMode = MUTATE_RELATIONSHIP
3939
)
4040
public class FilteredKnnMutateSpecification implements AlgorithmSpec<FilteredKnn, FilteredKnnResult, FilteredKnnMutateConfig, Stream<KnnMutateResult>, FilteredKnnFactory<FilteredKnnMutateConfig>> {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@GdsCallable(
3535
name = "gds.alpha.knn.filtered.stats",
3636
aliases = {"gds.knn.filtered.stats"},
37-
description = FilteredKnnConstants.PROCEDURE_DESCRIPTION,
37+
description = Constants.FILTERED_KNN_DESCRIPTION,
3838
executionMode = STATS
3939
)
4040
public class FilteredKnnStatsSpecification implements AlgorithmSpec<FilteredKnn, FilteredKnnResult, FilteredKnnStatsConfig, Stream<KnnStatsResult>, FilteredKnnFactory<FilteredKnnStatsConfig>> {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
@GdsCallable(
3434
name = "gds.knn.filtered.stream",
3535
aliases = {"gds.alpha.knn.filtered.stream"},
36-
description = FilteredKnnConstants.PROCEDURE_DESCRIPTION,
36+
description = Constants.FILTERED_KNN_DESCRIPTION,
3737
executionMode = ExecutionMode.STREAM
3838
)
3939
public class FilteredKnnStreamSpecification implements AlgorithmSpec<FilteredKnn, FilteredKnnResult, FilteredKnnStreamConfig, Stream<SimilarityResult>, FilteredKnnFactory<FilteredKnnStreamConfig>> {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@GdsCallable(
3535
name = "gds.knn.filtered.write",
3636
aliases = {"gds.alpha.knn.filtered.write"},
37-
description = FilteredKnnConstants.PROCEDURE_DESCRIPTION,
37+
description = Constants.FILTERED_KNN_DESCRIPTION,
3838
executionMode = WRITE_RELATIONSHIP
3939
)
4040
public class FilteredKnnWriteSpecification implements AlgorithmSpec<FilteredKnn, FilteredKnnResult, FilteredKnnWriteConfig, Stream<KnnWriteResult>, FilteredKnnFactory<FilteredKnnWriteConfig>> {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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.similarity.filterednodesim;
21+
22+
final class Constants {
23+
static final String FILTERED_NODE_SIMILARITY_DESCRIPTION =
24+
"The Filtered Node Similarity algorithm compares a set of nodes based on the nodes they are connected to. " +
25+
"Two nodes are considered similar if they share many of the same neighbors. " +
26+
"The algorithm computes pair-wise similarities based on Jaccard or Overlap metrics. " +
27+
"The filtered variant supports limiting which nodes to compare via source and target node filters.";
28+
29+
private Constants() {}
30+
}

0 commit comments

Comments
 (0)