Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit c3ec2d4

Browse files
knutwalkerjexp
authored andcommitted
Default Betweeness Centrality to parallel implementation (#433)
Fixes #395.
1 parent 205877b commit c3ec2d4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

algo/src/main/java/org/neo4j/graphalgo/BetweennessCentralityProc.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,12 @@ public Stream<BetweennessCentrality.Result> betweennessStream(
8787
.withDirection(configuration.getDirection(DEFAULT_DIRECTION))
8888
.load(configuration.getGraphImpl());
8989

90-
if (configuration.getConcurrency(-1) > 0) {
91-
final ParallelBetweennessCentrality algo = new ParallelBetweennessCentrality(graph,
92-
configuration.getNumber("scaleFactor", 100_000).intValue(),
93-
Pools.DEFAULT,
94-
configuration.getConcurrency())
90+
int concurrency = configuration.getConcurrency();
91+
if (concurrency > 1) {
92+
int scaleFactor = configuration
93+
.getNumber("scaleFactor", 100_000)
94+
.intValue();
95+
final ParallelBetweennessCentrality algo = new ParallelBetweennessCentrality(graph, scaleFactor, Pools.DEFAULT, concurrency)
9596
.withProgressLogger(ProgressLogger.wrap(log, "BetweennessCentrality"))
9697
.withTerminationFlag(TerminationFlag.wrap(transaction))
9798
.withDirection(configuration.getDirection(DEFAULT_DIRECTION))
@@ -181,7 +182,7 @@ public Stream<BetweennessCentralityProcResult> betweenness(
181182

182183
ProcedureConfiguration configuration = ProcedureConfiguration.create(config);
183184

184-
if (configuration.getConcurrency(-1) > 1) {
185+
if (configuration.getConcurrency() > 1) {
185186
return computeBetweennessParallel(label, relationship, configuration);
186187
} else {
187188
return computeBetweenness(label, relationship, configuration);

0 commit comments

Comments
 (0)