Skip to content

Commit

Permalink
changed package to kco.forceatlas2
Browse files Browse the repository at this point in the history
  • Loading branch information
jgould committed Apr 2, 2019
1 parent 06cffb4 commit 3598633
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 44 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
- Parallel force, attraction, and speed computations
- Option to rebuild Barnes-Hut tree every n iterations
- Option to update Barnes-Hut tree centers every n iterations


- Command line interface


## Command Line Usage

```
java -Djava.awt.headless=true -Xmx8g -cp dist/forceatlas2-3d.jar:lib/gephi-toolkit-0.9.2-all.jar org.gephi.layout.plugin.forceAtlas2_3d.Main flags
java -Djava.awt.headless=true -Xmx8g -cp dist/forceatlas2.jar:lib/gephi-toolkit-0.9.2-all.jar kco.forceatlas2.Main flags
```

where flags are
Expand Down
4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<project name="forceatlas2-3d" default="jar" basedir=".">
<project name="forceatlas2" default="jar" basedir=".">
<target name="clean">
<delete dir="build"></delete>
</target>
Expand All @@ -8,7 +8,7 @@
</target>
<target name="jar" depends="clean, compile">
<mkdir dir="dist"/>
<jar destfile="dist/forceatlas2-3d.jar"
<jar destfile="dist/forceatlas2.jar"
basedir="build"/>
</target>
</project>
Expand Down
Binary file removed dist/forceatlas2-3d.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.graph.api.*;
import org.gephi.layout.plugin.forceAtlas2_3d.ForceFactory.AttractionForce;
import org.gephi.layout.plugin.forceAtlas2_3d.ForceFactory.RepulsionForce;
import org.gephi.layout.spi.Layout;
import org.gephi.layout.spi.LayoutBuilder;
import org.gephi.layout.spi.LayoutProperty;
Expand Down Expand Up @@ -214,7 +212,7 @@ private void repulsionAndGravity() {

// Repulsion (and gravity)
// NB: Muti-threaded
RepulsionForce Repulsion = ForceFactory.builder.buildRepulsion(isAdjustSizes(), getScalingRatio());
ForceFactory.RepulsionForce Repulsion = ForceFactory.builder.buildRepulsion(isAdjustSizes(), getScalingRatio());

List<Future> futures = new ArrayList<>();
for (int t = currentThreadCount; t > 0; t--) {
Expand Down Expand Up @@ -265,7 +263,7 @@ private double applyForces() {
private void attraction(final boolean isDynamicWeight, final Interval interval) {
List<Future> futures = new ArrayList<>();

final AttractionForce Attraction = ForceFactory.builder.buildAttraction(isLinLogMode(), isOutboundAttractionDistribution(), isAdjustSizes(), 1 * ((isOutboundAttractionDistribution()) ? (outboundAttCompensation) : (1)));
final ForceFactory.AttractionForce Attraction = ForceFactory.builder.buildAttraction(isLinLogMode(), isOutboundAttractionDistribution(), isAdjustSizes(), 1 * ((isOutboundAttractionDistribution()) ? (outboundAttCompensation) : (1)));
int taskCount = currentThreadCount;
List<Edge> edgeList = Arrays.asList(edges);
final Double edgeWeightInfluence = getEdgeWeightInfluence();
Expand Down Expand Up @@ -829,12 +827,12 @@ public void run() {

private static class AttractionTask implements Runnable {
private Collection<Edge> edges;
private AttractionForce Attraction;
private ForceFactory.AttractionForce Attraction;
private boolean isDynamicWeight;
private Interval interval;
private double edgeWeightInfluence;

private AttractionTask(Collection<Edge> edges, AttractionForce attraction, boolean isDynamicWeight, Interval interval, double edgeWeightInfluence) {
private AttractionTask(Collection<Edge> edges, ForceFactory.AttractionForce attraction, boolean isDynamicWeight, Interval interval, double edgeWeightInfluence) {
this.edges = edges;
Attraction = attraction;
this.isDynamicWeight = isDynamicWeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.layout.spi.Layout;
import org.gephi.layout.spi.LayoutBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.graph.spi.LayoutData;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

/**
* Data stored in Nodes and used by ForceAtlas2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

/**
* Data stored in Nodes and used by ForceAtlas2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.graph.api.Node;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
Expand Down Expand Up @@ -231,7 +231,7 @@ public static void main(String[] args) throws IOException {
g = graphModel.getDirectedGraph();
}
importController.process(container, new DefaultProcessor(), workspace);
org.gephi.layout.plugin.forceAtlas2_3d.ForceAtlas2 layout = new org.gephi.layout.plugin.forceAtlas2_3d.ForceAtlas2(null, is3d, useAltSpeed);
ForceAtlas2 layout = new ForceAtlas2(null, is3d, useAltSpeed);
layout.setGraphModel(graphModel);
Random random = seed != null ? new Random(seed) : new Random();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.graph.api.Node;
import org.gephi.layout.plugin.forceAtlas2_3d.ForceFactory.RepulsionForce;

/**
*
Expand All @@ -55,13 +54,13 @@ public class NodesThread implements Runnable {
private int to;
private Region rootRegion;
private boolean barnesHutOptimize;
private RepulsionForce Repulsion;
private ForceFactory.RepulsionForce Repulsion;
private double barnesHutTheta;
private double gravity;
private RepulsionForce GravityForce;
private ForceFactory.RepulsionForce GravityForce;
private double scaling;

public NodesThread(Node[] nodes, int from, int to, boolean barnesHutOptimize, double barnesHutTheta, double gravity, RepulsionForce GravityForce, double scaling, Region rootRegion, RepulsionForce Repulsion) {
public NodesThread(Node[] nodes, int from, int to, boolean barnesHutOptimize, double barnesHutTheta, double gravity, ForceFactory.RepulsionForce GravityForce, double scaling, Region rootRegion, ForceFactory.RepulsionForce Repulsion) {
this.nodes = nodes;
this.from = from;
this.to = to;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.graph.api.Node;
import org.gephi.layout.plugin.forceAtlas2_3d.ForceFactory.AttractionForce;
import org.gephi.layout.plugin.forceAtlas2.Operation;

/**
Expand All @@ -52,10 +51,10 @@ public class OperationNodeNodeAttract extends Operation {

private final Node n1;
private final Node n2;
private final AttractionForce f;
private final ForceFactory.AttractionForce f;
private final double coefficient;

public OperationNodeNodeAttract(Node n1, Node n2, AttractionForce f, double coefficient) {
public OperationNodeNodeAttract(Node n1, Node n2, ForceFactory.AttractionForce f, double coefficient) {
this.n1 = n1;
this.n2 = n2;
this.f = f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.graph.api.Node;
import org.gephi.layout.plugin.forceAtlas2_3d.ForceFactory.RepulsionForce;
import org.gephi.layout.plugin.forceAtlas2.Operation;

/**
Expand All @@ -52,9 +51,9 @@ public class OperationNodeNodeRepulse extends Operation {

private final Node n1;
private final Node n2;
private final RepulsionForce f;
private final ForceFactory.RepulsionForce f;

public OperationNodeNodeRepulse(Node n1, Node n2, RepulsionForce f) {
public OperationNodeNodeRepulse(Node n1, Node n2, ForceFactory.RepulsionForce f) {
this.n1 = n1;
this.n2 = n2;
this.f = f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.graph.api.Node;
import org.gephi.layout.plugin.forceAtlas2_3d.ForceFactory.RepulsionForce;
import org.gephi.layout.plugin.forceAtlas2.Operation;
/**
*
Expand All @@ -52,10 +51,10 @@ public class OperationNodeRegionRepulse extends Operation {

private final Node n;
private final Region r;
private final RepulsionForce f;
private final ForceFactory.RepulsionForce f;
private final double theta;

public OperationNodeRegionRepulse(Node n, Region r, RepulsionForce f, double theta) {
public OperationNodeRegionRepulse(Node n, Region r, ForceFactory.RepulsionForce f, double theta) {
this.n = n;
this.f = f;
this.r = r;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.graph.api.Node;
import org.gephi.layout.plugin.forceAtlas2_3d.ForceFactory.RepulsionForce;
import org.gephi.layout.plugin.forceAtlas2.Operation;

/**
Expand All @@ -51,10 +50,10 @@ Development and Distribution License("CDDL") (collectively, the
public class OperationNodeRepulse extends Operation {

private Node n;
private RepulsionForce f;
private ForceFactory.RepulsionForce f;
private double coefficient;

public OperationNodeRepulse(Node n, RepulsionForce f, double coefficient) {
public OperationNodeRepulse(Node n, ForceFactory.RepulsionForce f, double coefficient) {
this.n = n;
this.f = f;
this.coefficient = coefficient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ Development and Distribution License("CDDL") (collectively, the
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.layout.plugin.forceAtlas2_3d;
package kco.forceatlas2;

import org.gephi.graph.api.Node;
import org.gephi.layout.plugin.forceAtlas2_3d.ForceFactory.RepulsionForce;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -227,7 +226,7 @@ private void buildSubRegions3D(boolean recursive) {
}
}

public void applyForce(Node n, RepulsionForce Force, double theta) {
public void applyForce(Node n, ForceFactory.RepulsionForce Force, double theta) {
if (nodes.size() < 2) {
Node regionNode = nodes.get(0);
Force.apply_BH(n, regionNode);
Expand Down
1 change: 0 additions & 1 deletion src/org.gephi.layout.spi.ForceAtlas2_3dBuilder

This file was deleted.

0 comments on commit 3598633

Please sign in to comment.