// Evaluates n^2 inter node forces using BarnesHut.
QuadTree tree = QuadTree.buildTree(graph, getQuadTreeMaxLevel());
// double electricEnergy = 0; ///////////////////////
// double springEnergy = 0; ///////////////////////
BarnesHut barnes = new BarnesHut(getNodeForce());
barnes.setTheta(getBarnesHutTheta());
for (Node node : nodes) {
NodeData data = node.getNodeData();
ForceVector layoutData = data.getLayoutData();
ForceVector f = barnes.calculateForce(data, tree);
layoutData.add(f);
// electricEnergy += f.getEnergy();
}
// Apply edge forces.