File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
algorithms-compute-business-facade/src/main/java/org/neo4j/gds/community Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 5353import org .neo4j .gds .leiden .LeidenResult ;
5454import org .neo4j .gds .louvain .LouvainParameters ;
5555import org .neo4j .gds .louvain .LouvainResult ;
56+ import org .neo4j .gds .modularity .ModularityParameters ;
57+ import org .neo4j .gds .modularity .ModularityResult ;
5658import org .neo4j .gds .result .TimedAlgorithmResult ;
5759import org .neo4j .gds .results .ResultTransformerBuilder ;
5860import org .neo4j .gds .triangle .LocalClusteringCoefficientParameters ;
@@ -414,5 +416,33 @@ public <TR> CompletableFuture<TR> louvain(
414416 ).thenApply (resultTransformerBuilder .build (graphResources ));
415417 }
416418
419+ public <TR > CompletableFuture <TR > modularity (
420+ GraphName graphName ,
421+ GraphParameters graphParameters ,
422+ Optional <String > relationshipProperty ,
423+ ModularityParameters parameters ,
424+ JobId jobId ,
425+ ResultTransformerBuilder <TimedAlgorithmResult <ModularityResult >, TR > resultTransformerBuilder
426+ ) {
427+ // Fetch the Graph the algorithm will operate on
428+ var graphResources = graphStoreCatalogService .fetchGraphResources (
429+ graphName ,
430+ graphParameters ,
431+ relationshipProperty ,
432+ new NodePropertyAnyExistsGraphStoreValidation ("communityProperty" ),
433+ Optional .empty (),
434+ user ,
435+ databaseId
436+ );
437+ var graph = graphResources .graph ();
438+
439+ return computeFacade .modularity (
440+ graph ,
441+ parameters ,
442+ jobId
443+
444+ ).thenApply (resultTransformerBuilder .build (graphResources ));
445+ }
446+
417447
418448}
You can’t perform that action at this time.
0 commit comments