/
ForceAtlas2.java
661 lines (566 loc) · 26.1 KB
/
ForceAtlas2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
/*
Copyright 2008-2011 Gephi
Authors : Mathieu Jacomy <mathieu.jacomy@gmail.com>
Website : http://www.gephi.org
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.Interval;
import org.gephi.graph.api.Node;
import org.gephi.layout.plugin.AbstractLayout;
import org.gephi.layout.plugin.forceAtlas2.ForceFactory.AttractionForce;
import org.gephi.layout.plugin.forceAtlas2.ForceFactory.RepulsionForce;
import org.gephi.layout.spi.Layout;
import org.gephi.layout.spi.LayoutBuilder;
import org.gephi.layout.spi.LayoutProperty;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
/**
* ForceAtlas 2 Layout, manages each step of the computations.
*
* @author Mathieu Jacomy
*/
public class ForceAtlas2 implements Layout {
private final ForceAtlas2Builder layoutBuilder;
double outboundAttCompensation = 1;
private GraphModel graphModel;
private Graph graph;
private double edgeWeightInfluence;
private double jitterTolerance;
private double scalingRatio;
private double gravity;
private double speed;
private double speedEfficiency;
private boolean outboundAttractionDistribution;
private boolean adjustSizes;
private boolean barnesHutOptimize;
private double barnesHutTheta;
private boolean linLogMode;
private boolean normalizeEdgeWeights;
private boolean strongGravityMode;
private boolean invertedEdgeWeightsMode;
private int threadCount;
private int currentThreadCount;
private Region rootRegion;
private ExecutorService pool;
public ForceAtlas2(ForceAtlas2Builder layoutBuilder) {
this.layoutBuilder = layoutBuilder;
this.threadCount = Math.min(4, Math.max(1, Runtime.getRuntime().availableProcessors() - 1));
}
@Override
public void initAlgo() {
AbstractLayout.ensureSafeLayoutNodePositions(graphModel);
speed = 1.;
speedEfficiency = 1.;
graph = graphModel.getGraphVisible();
graph.readLock();
try {
Node[] nodes = graph.getNodes().toArray();
// Initialise layout data
for (Node n : nodes) {
if (n.getLayoutData() == null || !(n.getLayoutData() instanceof ForceAtlas2LayoutData)) {
ForceAtlas2LayoutData nLayout = new ForceAtlas2LayoutData();
n.setLayoutData(nLayout);
}
ForceAtlas2LayoutData nLayout = n.getLayoutData();
nLayout.mass = 1 + graph.getDegree(n);
nLayout.old_dx = 0;
nLayout.old_dy = 0;
nLayout.dx = 0;
nLayout.dy = 0;
}
pool = Executors.newFixedThreadPool(threadCount);
currentThreadCount = threadCount;
} finally {
graph.readUnlockAll();
}
}
private double getEdgeWeight(Edge edge, boolean isDynamicWeight, Interval interval) {
double w = edge.getWeight();
if (isDynamicWeight)
w = edge.getWeight(interval);
if (isInvertedEdgeWeightsMode())
return w == 0 ? 0 : 1/w;
return w;
}
@Override
public void goAlgo() {
// Initialize graph data
if (graphModel == null) {
return;
}
graph = graphModel.getGraphVisible();
graph.readLock();
boolean isDynamicWeight = graphModel.getEdgeTable().getColumn("weight").isDynamic();
Interval interval = graph.getView().getTimeInterval();
try {
Node[] nodes = graph.getNodes().toArray();
Edge[] edges = graph.getEdges().toArray();
// Initialise layout data
for (Node n : nodes) {
if (n.getLayoutData() == null || !(n.getLayoutData() instanceof ForceAtlas2LayoutData)) {
ForceAtlas2LayoutData nLayout = new ForceAtlas2LayoutData();
n.setLayoutData(nLayout);
}
ForceAtlas2LayoutData nLayout = n.getLayoutData();
nLayout.mass = 1 + graph.getDegree(n);
nLayout.old_dx = nLayout.dx;
nLayout.old_dy = nLayout.dy;
nLayout.dx = 0;
nLayout.dy = 0;
}
// If Barnes Hut active, initialize root region
if (isBarnesHutOptimize()) {
rootRegion = new Region(nodes);
rootRegion.buildSubRegions();
}
// If outboundAttractionDistribution active, compensate.
if (isOutboundAttractionDistribution()) {
outboundAttCompensation = 0;
for (Node n : nodes) {
ForceAtlas2LayoutData nLayout = n.getLayoutData();
outboundAttCompensation += nLayout.mass;
}
outboundAttCompensation /= nodes.length;
}
// Repulsion (and gravity)
// NB: Muti-threaded
RepulsionForce Repulsion = ForceFactory.builder.buildRepulsion(isAdjustSizes(), getScalingRatio());
int taskCount = 8 *
currentThreadCount; // The threadPool Executor Service will manage the fetching of tasks and threads.
// We make more tasks than threads because some tasks may need more time to compute.
ArrayList<Future> threads = new ArrayList();
for (int t = taskCount; t > 0; t--) {
int from = (int) Math.floor(nodes.length * (t - 1) / taskCount);
int to = (int) Math.floor(nodes.length * t / taskCount);
Future future = pool.submit(
new NodesThread(nodes, from, to, isBarnesHutOptimize(), getBarnesHutTheta(), getGravity(),
(isStrongGravityMode()) ? (ForceFactory.builder.getStrongGravity(getScalingRatio())) :
(Repulsion), getScalingRatio(), rootRegion, Repulsion));
threads.add(future);
}
for (Future future : threads) {
try {
future.get();
} catch (Exception e) {
throw new RuntimeException("Unable to layout " + this.getClass().getSimpleName() + ".", e);
}
}
// Attraction
AttractionForce Attraction = ForceFactory.builder
.buildAttraction(isLinLogMode(), isOutboundAttractionDistribution(), isAdjustSizes(),
1 * ((isOutboundAttractionDistribution()) ? (outboundAttCompensation) : (1)));
if (getEdgeWeightInfluence() == 0) {
for (Edge e : edges) {
Attraction.apply(e.getSource(), e.getTarget(), 1);
}
} else if (getEdgeWeightInfluence() == 1) {
if (isNormalizeEdgeWeights()) {
Double w;
Double edgeWeightMin = Double.MAX_VALUE;
Double edgeWeightMax = Double.MIN_VALUE;
for (Edge e : edges) {
w = getEdgeWeight(e, isDynamicWeight, interval);
edgeWeightMin = Math.min(w, edgeWeightMin);
edgeWeightMax = Math.max(w, edgeWeightMax);
}
if (edgeWeightMin < edgeWeightMax) {
for (Edge e : edges) {
w = (getEdgeWeight(e, isDynamicWeight, interval) - edgeWeightMin) / (edgeWeightMax - edgeWeightMin);
Attraction.apply(e.getSource(), e.getTarget(), w);
}
} else {
for (Edge e : edges) {
Attraction.apply(e.getSource(), e.getTarget(), 1.);
}
}
} else {
for (Edge e : edges) {
Attraction.apply(e.getSource(), e.getTarget(), getEdgeWeight(e, isDynamicWeight, interval));
}
}
} else {
if (isNormalizeEdgeWeights()) {
Double w;
Double edgeWeightMin = Double.MAX_VALUE;
Double edgeWeightMax = Double.MIN_VALUE;
for (Edge e : edges) {
w = getEdgeWeight(e, isDynamicWeight, interval);
edgeWeightMin = Math.min(w, edgeWeightMin);
edgeWeightMax = Math.max(w, edgeWeightMax);
}
if (edgeWeightMin < edgeWeightMax) {
for (Edge e : edges) {
w = (getEdgeWeight(e, isDynamicWeight, interval) - edgeWeightMin) / (edgeWeightMax - edgeWeightMin);
Attraction.apply(e.getSource(), e.getTarget(),
Math.pow(w, getEdgeWeightInfluence()));
}
} else {
for (Edge e : edges) {
Attraction.apply(e.getSource(), e.getTarget(), 1.);
}
}
} else {
for (Edge e : edges) {
Attraction.apply(e.getSource(), e.getTarget(),
Math.pow(getEdgeWeight(e, isDynamicWeight, interval), getEdgeWeightInfluence()));
}
}
}
// Auto adjust speed
double totalSwinging = 0d; // How much irregular movement
double totalEffectiveTraction = 0d; // Hom much useful movement
for (Node n : nodes) {
ForceAtlas2LayoutData nLayout = n.getLayoutData();
if (!n.isFixed()) {
double swinging =
Math.sqrt(Math.pow(nLayout.old_dx - nLayout.dx, 2) + Math.pow(nLayout.old_dy - nLayout.dy, 2));
totalSwinging += nLayout.mass *
swinging; // If the node has a burst change of direction, then it's not converging.
totalEffectiveTraction += nLayout.mass * 0.5 *
Math.sqrt(Math.pow(nLayout.old_dx + nLayout.dx, 2) + Math.pow(nLayout.old_dy + nLayout.dy, 2));
}
}
// We want that swingingMovement < tolerance * convergenceMovement
// Optimize jitter tolerance
// The 'right' jitter tolerance for this network. Bigger networks need more tolerance. Denser networks need less tolerance. Totally empiric.
double estimatedOptimalJitterTolerance = 0.05 * Math.sqrt(nodes.length);
double minJT = Math.sqrt(estimatedOptimalJitterTolerance);
double maxJT = 10;
double jt = jitterTolerance * Math.max(minJT,
Math.min(maxJT, estimatedOptimalJitterTolerance * totalEffectiveTraction / Math.pow(nodes.length, 2)));
double minSpeedEfficiency = 0.05;
// Protection against erratic behavior
if (totalSwinging / totalEffectiveTraction > 2.0) {
if (speedEfficiency > minSpeedEfficiency) {
speedEfficiency *= 0.5;
}
jt = Math.max(jt, jitterTolerance);
}
double targetSpeed = jt * speedEfficiency * totalEffectiveTraction / totalSwinging;
// Speed efficiency is how the speed really corresponds to the swinging vs. convergence tradeoff
// We adjust it slowly and carefully
if (totalSwinging > jt * totalEffectiveTraction) {
if (speedEfficiency > minSpeedEfficiency) {
speedEfficiency *= 0.7;
}
} else if (speed < 1000) {
speedEfficiency *= 1.3;
}
// But the speed shoudn't rise too much too quickly, since it would make the convergence drop dramatically.
double maxRise = 0.5; // Max rise: 50%
speed = speed + Math.min(targetSpeed - speed, maxRise * speed);
// Apply forces
if (isAdjustSizes()) {
// If nodes overlap prevention is active, it's not possible to trust the swinging mesure.
for (Node n : nodes) {
ForceAtlas2LayoutData nLayout = n.getLayoutData();
if (!n.isFixed()) {
// Adaptive auto-speed: the speed of each node is lowered
// when the node swings.
double swinging = nLayout.mass * Math.sqrt(
(nLayout.old_dx - nLayout.dx) * (nLayout.old_dx - nLayout.dx) +
(nLayout.old_dy - nLayout.dy) * (nLayout.old_dy - nLayout.dy));
double factor = 0.1 * speed / (1f + Math.sqrt(speed * swinging));
double df = Math.sqrt(Math.pow(nLayout.dx, 2) + Math.pow(nLayout.dy, 2));
factor = Math.min(factor * df, 10.) / df;
double x = n.x() + nLayout.dx * factor;
double y = n.y() + nLayout.dy * factor;
n.setX((float) x);
n.setY((float) y);
}
}
} else {
for (Node n : nodes) {
ForceAtlas2LayoutData nLayout = n.getLayoutData();
if (!n.isFixed()) {
// Adaptive auto-speed: the speed of each node is lowered
// when the node swings.
double swinging = nLayout.mass * Math.sqrt(
(nLayout.old_dx - nLayout.dx) * (nLayout.old_dx - nLayout.dx) +
(nLayout.old_dy - nLayout.dy) * (nLayout.old_dy - nLayout.dy));
//double factor = speed / (1f + Math.sqrt(speed * swinging));
double factor = speed / (1f + Math.sqrt(speed * swinging));
double x = n.x() + nLayout.dx * factor;
double y = n.y() + nLayout.dy * factor;
n.setX((float) x);
n.setY((float) y);
}
}
}
} finally {
graph.readUnlockAll();
}
}
@Override
public boolean canAlgo() {
return graphModel != null;
}
@Override
public void endAlgo() {
graph.readLock();
try {
for (Node n : graph.getNodes()) {
n.setLayoutData(null);
}
pool.shutdown();
} finally {
graph.readUnlockAll();
}
}
@Override
public LayoutProperty[] getProperties() {
List<LayoutProperty> properties = new ArrayList<>();
final String FORCEATLAS2_TUNING = NbBundle.getMessage(getClass(), "ForceAtlas2.tuning");
final String FORCEATLAS2_BEHAVIOR = NbBundle.getMessage(getClass(), "ForceAtlas2.behavior");
final String FORCEATLAS2_PERFORMANCE = NbBundle.getMessage(getClass(), "ForceAtlas2.performance");
final String FORCEATLAS2_THREADS = NbBundle.getMessage(getClass(), "ForceAtlas2.threads");
try {
properties.add(LayoutProperty.createProperty(
this, Double.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.scalingRatio.name"),
FORCEATLAS2_TUNING,
"ForceAtlas2.scalingRatio.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.scalingRatio.desc"),
"getScalingRatio", "setScalingRatio"));
properties.add(LayoutProperty.createProperty(
this, Boolean.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.strongGravityMode.name"),
FORCEATLAS2_TUNING,
"ForceAtlas2.strongGravityMode.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.strongGravityMode.desc"),
"isStrongGravityMode", "setStrongGravityMode"));
properties.add(LayoutProperty.createProperty(
this, Double.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.gravity.name"),
FORCEATLAS2_TUNING,
"ForceAtlas2.gravity.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.gravity.desc"),
"getGravity", "setGravity"));
properties.add(LayoutProperty.createProperty(
this, Boolean.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.distributedAttraction.name"),
FORCEATLAS2_BEHAVIOR,
"ForceAtlas2.distributedAttraction.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.distributedAttraction.desc"),
"isOutboundAttractionDistribution", "setOutboundAttractionDistribution"));
properties.add(LayoutProperty.createProperty(
this, Boolean.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.linLogMode.name"),
FORCEATLAS2_BEHAVIOR,
"ForceAtlas2.linLogMode.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.linLogMode.desc"),
"isLinLogMode", "setLinLogMode"));
properties.add(LayoutProperty.createProperty(
this, Boolean.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.adjustSizes.name"),
FORCEATLAS2_BEHAVIOR,
"ForceAtlas2.adjustSizes.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.adjustSizes.desc"),
"isAdjustSizes", "setAdjustSizes"));
properties.add(LayoutProperty.createProperty(
this, Double.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.edgeWeightInfluence.name"),
FORCEATLAS2_BEHAVIOR,
"ForceAtlas2.edgeWeightInfluence.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.edgeWeightInfluence.desc"),
"getEdgeWeightInfluence", "setEdgeWeightInfluence"));
properties.add(LayoutProperty.createProperty(
this, Boolean.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.normalizeEdgeWeights.name"),
FORCEATLAS2_BEHAVIOR,
"ForceAtlas2.normalizeEdgeWeights.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.normalizeEdgeWeights.desc"),
"isNormalizeEdgeWeights", "setNormalizeEdgeWeights"));
properties.add(LayoutProperty.createProperty(
this, Boolean.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.invertedEdgeWeightsMode.name"),
FORCEATLAS2_BEHAVIOR,
"ForceAtlas2.invertedEdgeWeightsMode.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.invertedEdgeWeightsMode.desc"),
"isInvertedEdgeWeightsMode", "setInvertedEdgeWeightsMode"));
properties.add(LayoutProperty.createProperty(
this, Double.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.jitterTolerance.name"),
FORCEATLAS2_PERFORMANCE,
"ForceAtlas2.jitterTolerance.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.jitterTolerance.desc"),
"getJitterTolerance", "setJitterTolerance"));
properties.add(LayoutProperty.createProperty(
this, Boolean.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.barnesHutOptimization.name"),
FORCEATLAS2_PERFORMANCE,
"ForceAtlas2.barnesHutOptimization.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.barnesHutOptimization.desc"),
"isBarnesHutOptimize", "setBarnesHutOptimize"));
properties.add(LayoutProperty.createProperty(
this, Double.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.barnesHutTheta.name"),
FORCEATLAS2_PERFORMANCE,
"ForceAtlas2.barnesHutTheta.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.barnesHutTheta.desc"),
"getBarnesHutTheta", "setBarnesHutTheta"));
properties.add(LayoutProperty.createProperty(
this, Integer.class,
NbBundle.getMessage(getClass(), "ForceAtlas2.threads.name"),
FORCEATLAS2_THREADS,
"ForceAtlas2.threads.name",
NbBundle.getMessage(getClass(), "ForceAtlas2.threads.desc"),
"getThreadsCount", "setThreadsCount"));
} catch (Exception e) {
Exceptions.printStackTrace(e);
}
return properties.toArray(new LayoutProperty[0]);
}
@Override
public void resetPropertiesValues() {
int nodesCount = 0;
if (graphModel != null) {
nodesCount = graphModel.getGraphVisible().getNodeCount();
}
// Tuning
if (nodesCount >= 100) {
setScalingRatio(2.0);
} else {
setScalingRatio(10.0);
}
setStrongGravityMode(false);
setInvertedEdgeWeightsMode(false);
setGravity(1.);
// Behavior
setOutboundAttractionDistribution(false);
setLinLogMode(false);
setAdjustSizes(false);
setEdgeWeightInfluence(1.);
setNormalizeEdgeWeights(false);
// Performance
setJitterTolerance(1d);
setBarnesHutOptimize(nodesCount >= 1000);
setBarnesHutTheta(1.2);
setThreadsCount(Math.max(1, Runtime.getRuntime().availableProcessors() - 1));
}
@Override
public LayoutBuilder getBuilder() {
return layoutBuilder;
}
@Override
public void setGraphModel(GraphModel graphModel) {
this.graphModel = graphModel;
// Trick: reset here to take the profile of the graph in account for default values
resetPropertiesValues();
}
public Double getBarnesHutTheta() {
return barnesHutTheta;
}
public void setBarnesHutTheta(Double barnesHutTheta) {
this.barnesHutTheta = barnesHutTheta;
}
public Double getEdgeWeightInfluence() {
return edgeWeightInfluence;
}
public void setEdgeWeightInfluence(Double edgeWeightInfluence) {
this.edgeWeightInfluence = edgeWeightInfluence;
}
public Double getJitterTolerance() {
return jitterTolerance;
}
public void setJitterTolerance(Double jitterTolerance) {
this.jitterTolerance = jitterTolerance;
}
public Boolean isLinLogMode() {
return linLogMode;
}
public void setLinLogMode(Boolean linLogMode) {
this.linLogMode = linLogMode;
}
public Boolean isNormalizeEdgeWeights() {
return normalizeEdgeWeights;
}
public void setNormalizeEdgeWeights(Boolean normalizeEdgeWeights) {
this.normalizeEdgeWeights = normalizeEdgeWeights;
}
public Double getScalingRatio() {
return scalingRatio;
}
public void setScalingRatio(Double scalingRatio) {
this.scalingRatio = scalingRatio;
}
public Boolean isStrongGravityMode() {
return strongGravityMode;
}
public void setStrongGravityMode(Boolean strongGravityMode) {
this.strongGravityMode = strongGravityMode;
}
public Boolean isInvertedEdgeWeightsMode() {
return invertedEdgeWeightsMode;
}
public void setInvertedEdgeWeightsMode(Boolean invertedEdgeWeightsMode) {
this.invertedEdgeWeightsMode = invertedEdgeWeightsMode;
}
public Double getGravity() {
return gravity;
}
public void setGravity(Double gravity) {
this.gravity = gravity;
}
public Integer getThreadsCount() {
return threadCount;
}
public void setThreadsCount(Integer threadCount) {
this.threadCount = Math.max(1, threadCount);
}
public Boolean isOutboundAttractionDistribution() {
return outboundAttractionDistribution;
}
public void setOutboundAttractionDistribution(Boolean outboundAttractionDistribution) {
this.outboundAttractionDistribution = outboundAttractionDistribution;
}
public Boolean isAdjustSizes() {
return adjustSizes;
}
public void setAdjustSizes(Boolean adjustSizes) {
this.adjustSizes = adjustSizes;
}
public Boolean isBarnesHutOptimize() {
return barnesHutOptimize;
}
public void setBarnesHutOptimize(Boolean barnesHutOptimize) {
this.barnesHutOptimize = barnesHutOptimize;
}
}