Program: 189847
Project: 189847
Buggy source:
public void execute(HierarchicalGraph graph,AttributeModel attributeModel){
  isDirected=graph instanceof DirectedGraph;
  isCanceled=false;
  inDegreeDist=new HashMap<Integer,Integer>();
  outDegreeDist=new HashMap<Integer,Integer>();
  degreeDist=new HashMap<Integer,Integer>();
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn inCol=nodeTable.getColumn(INDEGREE);
  AttributeColumn outCol=nodeTable.getColumn(OUTDEGREE);
  AttributeColumn degCol=nodeTable.getColumn(DEGREE);
  if (isDirected) {
    if (inCol == null) {
      inCol=nodeTable.addColumn(INDEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
    }
    if (outCol == null) {
      outCol=nodeTable.addColumn(OUTDEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
    }
  }
  if (degCol == null) {
    degCol=nodeTable.addColumn(DEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
  }
  int i=0;
  graph.readLock();
  Progress.start(progress,graph.getNodeCount());
  for (  Node n : graph.getNodes()) {
    AttributeRow row=(AttributeRow)n.getNodeData().getAttributes();
    if (isDirected) {
      HierarchicalDirectedGraph hdg=graph.getGraphModel().getHierarchicalDirectedGraph();
      int inDegree=hdg.getTotalInDegree(n);
      int outDegree=hdg.getTotalOutDegree(n);
      row.setValue(inCol,inDegree);
      row.setValue(outCol,outDegree);
      if (!inDegreeDist.containsKey(inDegree)) {
        inDegreeDist.put(inDegree,0);
      }
      inDegreeDist.put(inDegree,inDegreeDist.get(inDegree) + 1);
      if (!outDegreeDist.containsKey(outDegree)) {
        outDegreeDist.put(outDegree,0);
      }
      outDegreeDist.put(outDegree,outDegreeDist.get(outDegree) + 1);
    }
    int degree=graph.getTotalDegree(n);
    row.setValue(degCol,degree);
    avgDegree+=degree;
    if (!degreeDist.containsKey(degree)) {
      degreeDist.put(degree,0);
    }
    degreeDist.put(degree,degreeDist.get(degree) + 1);
    if (isCanceled) {
      break;
    }
    i++;
    Progress.progress(progress,i);
  }
  avgDegree/=graph.getNodeCount();
  graph.readUnlockAll();
}

Fixed version (ground truth):
public void execute(HierarchicalGraph graph,AttributeModel attributeModel){
  isDirected=graph instanceof DirectedGraph;
  isCanceled=false;
  inDegreeDist=new HashMap<Integer,Integer>();
  outDegreeDist=new HashMap<Integer,Integer>();
  degreeDist=new HashMap<Integer,Integer>();
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn inCol=nodeTable.getColumn(INDEGREE);
  AttributeColumn outCol=nodeTable.getColumn(OUTDEGREE);
  AttributeColumn degCol=nodeTable.getColumn(DEGREE);
  if (isDirected) {
    if (inCol == null) {
      inCol=nodeTable.addColumn(INDEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
    }
    if (outCol == null) {
      outCol=nodeTable.addColumn(OUTDEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
    }
  }
  if (degCol == null) {
    degCol=nodeTable.addColumn(DEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
  }
  int i=0;
  graph.readLock();
  Progress.start(progress,graph.getNodeCount());
  HierarchicalDirectedGraph directedGraph=null;
  if (isDirected) {
    directedGraph=graph.getGraphModel().getHierarchicalDirectedGraphVisible();
  }
  for (  Node n : graph.getNodes()) {
    AttributeRow row=(AttributeRow)n.getNodeData().getAttributes();
    if (isDirected) {
      int inDegree=directedGraph.getTotalInDegree(n);
      int outDegree=directedGraph.getTotalOutDegree(n);
      row.setValue(inCol,inDegree);
      row.setValue(outCol,outDegree);
      if (!inDegreeDist.containsKey(inDegree)) {
        inDegreeDist.put(inDegree,0);
      }
      inDegreeDist.put(inDegree,inDegreeDist.get(inDegree) + 1);
      if (!outDegreeDist.containsKey(outDegree)) {
        outDegreeDist.put(outDegree,0);
      }
      outDegreeDist.put(outDegree,outDegreeDist.get(outDegree) + 1);
    }
    int degree=graph.getTotalDegree(n);
    row.setValue(degCol,degree);
    avgDegree+=degree;
    if (!degreeDist.containsKey(degree)) {
      degreeDist.put(degree,0);
    }
    degreeDist.put(degree,degreeDist.get(degree) + 1);
    if (isCanceled) {
      break;
    }
    i++;
    Progress.progress(progress,i);
  }
  avgDegree/=graph.getNodeCount();
  graph.readUnlockAll();
}