Skip to content

Commit d5bdbb6

Browse files
committed
Move out internal classes
1 parent e6b6529 commit d5bdbb6

File tree

4 files changed

+106
-32
lines changed

4 files changed

+106
-32
lines changed

algo/src/main/java/org/neo4j/gds/similarity/filteredknn/FilteredKnn.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -270,38 +270,6 @@ public void release() {
270270
return neighbors;
271271
}
272272

273-
static class UniformFilteredKnnSamplerSupplier implements Function<SplittableRandom, FilteredKnnSampler> {
274-
275-
private final Graph graph;
276-
277-
UniformFilteredKnnSamplerSupplier(Graph graph) {
278-
this.graph = graph;
279-
}
280-
281-
@Override
282-
public FilteredKnnSampler apply(SplittableRandom splittableRandom) {
283-
return new UniformFilteredKnnSampler(splittableRandom, graph.nodeCount());
284-
}
285-
}
286-
287-
static class RandomWalkFilteredKnnSamplerSupplier implements Function<SplittableRandom, FilteredKnnSampler> {
288-
289-
private final Graph graph;
290-
private final Optional<Long> randomSeed;
291-
private final int boundedK;
292-
293-
RandomWalkFilteredKnnSamplerSupplier(Graph graph, Optional<Long> randomSeed, int boundedK) {
294-
this.graph = graph;
295-
this.randomSeed = randomSeed;
296-
this.boundedK = boundedK;
297-
}
298-
299-
@Override
300-
public FilteredKnnSampler apply(SplittableRandom splittableRandom) {
301-
return new RandomWalkFilteredKnnSampler(graph.concurrentCopy(), splittableRandom, randomSeed, boundedK);
302-
}
303-
}
304-
305273
private long iteration(HugeObjectArray<FilteredNeighborList> neighbors) {
306274
// this is a sanity check
307275
// we check for this before any iteration and return
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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.filteredknn;
21+
22+
public interface FilteredKnnSamplerSupplier {
23+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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.filteredknn;
21+
22+
import org.neo4j.gds.api.Graph;
23+
24+
import java.util.Optional;
25+
import java.util.SplittableRandom;
26+
import java.util.function.Function;
27+
28+
class RandomWalkFilteredKnnSamplerSupplier implements Function<SplittableRandom, FilteredKnnSampler> {
29+
30+
private final Graph graph;
31+
private final Optional<Long> randomSeed;
32+
private final int boundedK;
33+
34+
RandomWalkFilteredKnnSamplerSupplier(Graph graph, Optional<Long> randomSeed, int boundedK) {
35+
this.graph = graph;
36+
this.randomSeed = randomSeed;
37+
this.boundedK = boundedK;
38+
}
39+
40+
@Override
41+
public FilteredKnnSampler apply(SplittableRandom splittableRandom) {
42+
return new RandomWalkFilteredKnnSampler(graph.concurrentCopy(), splittableRandom, randomSeed, boundedK);
43+
}
44+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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.filteredknn;
21+
22+
import org.neo4j.gds.api.Graph;
23+
24+
import java.util.SplittableRandom;
25+
import java.util.function.Function;
26+
27+
class UniformFilteredKnnSamplerSupplier implements Function<SplittableRandom, FilteredKnnSampler> {
28+
29+
private final Graph graph;
30+
31+
UniformFilteredKnnSamplerSupplier(Graph graph) {
32+
this.graph = graph;
33+
}
34+
35+
@Override
36+
public FilteredKnnSampler apply(SplittableRandom splittableRandom) {
37+
return new UniformFilteredKnnSampler(splittableRandom, graph.nodeCount());
38+
}
39+
}

0 commit comments

Comments
 (0)