Program: 142677
Project: 142677
Buggy source:
public void goAlgo(){
  graph=graphModel.getHierarchicalGraphVisible();
  graph.readLock();
  Node[] nodes=graph.getNodes().toArray();
  for (  Node n : nodes) {
    if (n.getNodeData().getLayoutData() == null || !(n.getNodeData().getLayoutData() instanceof ForceVector)) {
      n.getNodeData().setLayoutData(new ForceVector());
    }
  }
  QuadTree tree=QuadTree.buildTree(graph,getQuadTreeMaxLevel());
  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);
  }
  for (  Edge e : graph.getEdgesAndMetaEdges()) {
    NodeData n1=e.getSource().getNodeData();
    NodeData n2=e.getTarget().getNodeData();
    ForceVector f1=n1.getLayoutData();
    ForceVector f2=n2.getLayoutData();
    ForceVector f=getEdgeForce().calculateForce(n1,n2);
    f1.add(f);
    f2.subtract(f);
  }
  energy0=energy;
  energy=0;
  double maxForce=1;
  for (  Node n : nodes) {
    NodeData data=n.getNodeData();
    ForceVector force=data.getLayoutData();
    energy+=force.getNorm();
    maxForce=Math.max(maxForce,force.getNorm());
  }
  for (  Node n : nodes) {
    NodeData data=n.getNodeData();
    if (!data.isFixed()) {
      ForceVector force=data.getLayoutData();
      force.multiply((float)(1.0 / maxForce));
      getDisplacement().moveNode(data,force);
    }
  }
  postAlgo();
  graph.readUnlock();
}

Fixed version (ground truth):
public void goAlgo(){
  graph=graphModel.getHierarchicalGraphVisible();
  graph.readLock();
  Node[] nodes=graph.getNodes().toArray();
  for (  Node n : nodes) {
    if (n.getNodeData().getLayoutData() == null || !(n.getNodeData().getLayoutData() instanceof ForceVector)) {
      n.getNodeData().setLayoutData(new ForceVector());
    }
  }
  QuadTree tree=QuadTree.buildTree(graph,getQuadTreeMaxLevel());
  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);
  }
  for (  Edge e : graph.getEdgesAndMetaEdges()) {
    if (!e.getSource().equals(e.getTarget())) {
      NodeData n1=e.getSource().getNodeData();
      NodeData n2=e.getTarget().getNodeData();
      ForceVector f1=n1.getLayoutData();
      ForceVector f2=n2.getLayoutData();
      ForceVector f=getEdgeForce().calculateForce(n1,n2);
      f1.add(f);
      f2.subtract(f);
    }
  }
  energy0=energy;
  energy=0;
  double maxForce=1;
  for (  Node n : nodes) {
    NodeData data=n.getNodeData();
    ForceVector force=data.getLayoutData();
    energy+=force.getNorm();
    maxForce=Math.max(maxForce,force.getNorm());
  }
  for (  Node n : nodes) {
    NodeData data=n.getNodeData();
    if (!data.isFixed()) {
      ForceVector force=data.getLayoutData();
      force.multiply((float)(1.0 / maxForce));
      getDisplacement().moveNode(data,force);
    }
  }
  postAlgo();
  System.out.println("String_Node_Str" + energy0 + "String_Node_Str"+ energy);
  graph.readUnlock();
}