Skip to content

Commit 5b534e8

Browse files
committed
Add remaining transformer builders
1 parent 71bf8ca commit 5b534e8

File tree

3 files changed

+127
-5
lines changed

3 files changed

+127
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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.procedures.algorithms.pathfinding.write;
21+
22+
import org.neo4j.gds.api.Graph;
23+
import org.neo4j.gds.api.GraphStore;
24+
import org.neo4j.gds.kspanningtree.KSpanningTreeWriteConfig;
25+
import org.neo4j.gds.pathfinding.KSpanningTreeWriteStep;
26+
import org.neo4j.gds.procedures.algorithms.pathfinding.KSpanningTreeWriteResult;
27+
import org.neo4j.gds.result.TimedAlgorithmResult;
28+
import org.neo4j.gds.results.ResultTransformer;
29+
import org.neo4j.gds.results.ResultTransformerBuilder;
30+
import org.neo4j.gds.spanningtree.SpanningTree;
31+
32+
import java.util.stream.Stream;
33+
34+
class KSpanningTreeWriteResultTransformer implements ResultTransformerBuilder<TimedAlgorithmResult<SpanningTree>, Stream<KSpanningTreeWriteResult>> {
35+
36+
KSpanningTreeWriteResultTransformer(KSpanningTreeWriteStep writeStep, KSpanningTreeWriteConfig config) {}
37+
38+
@Override
39+
public ResultTransformer<TimedAlgorithmResult<SpanningTree>, Stream<KSpanningTreeWriteResult>> build(Graph graph, GraphStore graphStore) {
40+
return ar -> Stream.empty();
41+
}
42+
}

procedures/pushback-procedures-facade/src/main/java/org/neo4j/gds/procedures/algorithms/pathfinding/write/PushbackPathFindingWriteProcedureFacade.java

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,15 @@ public Stream<KSpanningTreeWriteResult> kSpanningTree(
155155
requestScopedDependencies.terminationFlag()
156156
);
157157

158-
return Stream.empty();
158+
return businessFacade.kSpanningTree(
159+
GraphName.parse(graphName),
160+
config.toGraphParameters(),
161+
config.relationshipWeightProperty(),
162+
config.toKSpanningTreeParameters(),
163+
config.jobId(),
164+
config.logProgress(),
165+
new KSpanningTreeWriteResultTransformer(writeStep, config)
166+
).join();
159167
}
160168

161169

@@ -204,7 +212,15 @@ public Stream<StandardWriteRelationshipsResult> singlePairShortestPathAStar(
204212
config.jobId()
205213
);
206214

207-
return Stream.empty();
215+
return businessFacade.singlePairShortestPathAStar(
216+
GraphName.parse(graphName),
217+
config.toGraphParameters(),
218+
config.relationshipWeightProperty(),
219+
config.toParameters(),
220+
config.jobId(),
221+
config.logProgress(),
222+
new ShortestPathWriteResultTransformer(writeStep)
223+
).join();
208224
}
209225

210226
public Stream<StandardWriteRelationshipsResult> singlePairShortestPathDijkstra(
@@ -225,7 +241,15 @@ public Stream<StandardWriteRelationshipsResult> singlePairShortestPathDijkstra(
225241
config.jobId()
226242
);
227243

228-
return Stream.empty();
244+
return businessFacade.singlePairShortestPathDijkstra(
245+
GraphName.parse(graphName),
246+
config.toGraphParameters(),
247+
config.relationshipWeightProperty(),
248+
config.toParameters(),
249+
config.jobId(),
250+
config.logProgress(),
251+
new ShortestPathWriteResultTransformer(writeStep)
252+
).join();
229253
}
230254

231255
public Stream<StandardWriteRelationshipsResult> singlePairShortestPathYens(
@@ -247,7 +271,15 @@ public Stream<StandardWriteRelationshipsResult> singlePairShortestPathYens(
247271
config.jobId()
248272
);
249273

250-
return Stream.empty();
274+
return businessFacade.singlePairShortestPathYens(
275+
GraphName.parse(graphName),
276+
config.toGraphParameters(),
277+
config.relationshipWeightProperty(),
278+
config.toParameters(),
279+
config.jobId(),
280+
config.logProgress(),
281+
new ShortestPathWriteResultTransformer(writeStep)
282+
).join();
251283
}
252284

253285
public Stream<StandardWriteRelationshipsResult> singleSourceShortestPathDijkstra(
@@ -269,7 +301,15 @@ public Stream<StandardWriteRelationshipsResult> singleSourceShortestPathDijkstra
269301
config.jobId()
270302
);
271303

272-
return Stream.empty();
304+
return businessFacade.singleSourceShortestPathDijkstra(
305+
GraphName.parse(graphName),
306+
config.toGraphParameters(),
307+
config.relationshipWeightProperty(),
308+
config.toSingleSourceParameters(),
309+
config.jobId(),
310+
config.logProgress(),
311+
new ShortestPathWriteResultTransformer(writeStep)
312+
).join();
273313
}
274314

275315
public Stream<SpanningTreeWriteResult> spanningTree(String graphName, Map<String, Object> configuration) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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.procedures.algorithms.pathfinding.write;
21+
22+
import org.neo4j.gds.api.Graph;
23+
import org.neo4j.gds.api.GraphStore;
24+
import org.neo4j.gds.pathfinding.ShortestPathWriteStep;
25+
import org.neo4j.gds.paths.dijkstra.PathFindingResult;
26+
import org.neo4j.gds.procedures.algorithms.results.StandardWriteRelationshipsResult;
27+
import org.neo4j.gds.result.TimedAlgorithmResult;
28+
import org.neo4j.gds.results.ResultTransformer;
29+
import org.neo4j.gds.results.ResultTransformerBuilder;
30+
31+
import java.util.stream.Stream;
32+
33+
public class ShortestPathWriteResultTransformer implements ResultTransformerBuilder<TimedAlgorithmResult<PathFindingResult>, Stream<StandardWriteRelationshipsResult>> {
34+
public ShortestPathWriteResultTransformer(ShortestPathWriteStep writeStep) {}
35+
36+
@Override
37+
public ResultTransformer<TimedAlgorithmResult<PathFindingResult>, Stream<StandardWriteRelationshipsResult>> build(Graph graph, GraphStore graphStore) {
38+
return ar -> Stream.empty();
39+
}
40+
}

0 commit comments

Comments
 (0)