Program: 142649
Project: 142649
Buggy source:
public void execute(HierarchicalGraph hgraph,AttributeModel attributeModel){
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn eigenCol=nodeTable.getColumn(EIGENVECTOR);
  if (eigenCol == null) {
    eigenCol=nodeTable.addColumn(EIGENVECTOR,"String_Node_Str",AttributeType.DOUBLE,AttributeOrigin.COMPUTED,new Double(0));
  }
  int N=hgraph.getNodeCount();
  hgraph.readLock();
  double[] tmp=new double[N];
  centralities=new double[N];
  Progress.start(progress,numRuns);
  HashMap<Integer,Node> indicies=new HashMap<Integer,Node>();
  HashMap<Node,Integer> invIndicies=new HashMap<Node,Integer>();
  int count=0;
  for (  Node u : hgraph.getNodes()) {
    indicies.put(count,u);
    invIndicies.put(u,count);
    centralities[count]=1;
    count++;
  }
  for (int s=0; s < numRuns; s++) {
    double max=0;
    for (int i=0; i < N; i++) {
      Node u=indicies.get(i);
      EdgeIterable iter=null;
      if (isDirected) {
        iter=((HierarchicalDirectedGraph)hgraph).getInEdgesAndMetaInEdges(u);
      }
 else {
        iter=hgraph.getEdges(u);
      }
      for (      Edge e : iter) {
        Node v=hgraph.getOpposite(u,e);
        Integer id=invIndicies.get(v);
        tmp[i]+=centralities[id];
      }
      max=Math.max(max,tmp[i]);
      if (isCanceled) {
        return;
      }
    }
    sumChange=0;
    for (int k=0; k < N; k++) {
      if (max != 0) {
        sumChange+=Math.abs(centralities[k] - (tmp[k] / max));
        centralities[k]=tmp[k] / max;
      }
      if (isCanceled) {
        return;
      }
    }
    if (isCanceled) {
      return;
    }
    Progress.progress(progress);
  }
  for (int i=0; i < N; i++) {
    Node s=indicies.get(i);
    AttributeRow row=(AttributeRow)s.getNodeData().getAttributes();
    row.setValue(eigenCol,centralities[i]);
    if (isCanceled) {
      return;
    }
  }
  hgraph.readUnlock();
  Progress.finish(progress);
}

Fixed version (ground truth):
public void execute(HierarchicalGraph hgraph,AttributeModel attributeModel){
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn eigenCol=nodeTable.getColumn(EIGENVECTOR);
  if (eigenCol == null) {
    eigenCol=nodeTable.addColumn(EIGENVECTOR,"String_Node_Str",AttributeType.DOUBLE,AttributeOrigin.COMPUTED,new Double(0));
  }
  int N=hgraph.getNodeCount();
  hgraph.readLock();
  double[] tmp=new double[N];
  centralities=new double[N];
  Progress.start(progress,numRuns);
  HashMap<Integer,Node> indicies=new HashMap<Integer,Node>();
  HashMap<Node,Integer> invIndicies=new HashMap<Node,Integer>();
  int count=0;
  for (  Node u : hgraph.getNodes()) {
    indicies.put(count,u);
    invIndicies.put(u,count);
    centralities[count]=1;
    count++;
  }
  for (int s=0; s < numRuns; s++) {
    double max=0;
    for (int i=0; i < N; i++) {
      Node u=indicies.get(i);
      EdgeIterable iter=null;
      if (isDirected) {
        iter=((HierarchicalDirectedGraph)hgraph).getInEdgesAndMetaInEdges(u);
      }
 else {
        iter=((HierarchicalUndirectedGraph)hgraph).getEdgesAndMetaEdges(u);
      }
      for (      Edge e : iter) {
        Node v=hgraph.getOpposite(u,e);
        Integer id=invIndicies.get(v);
        tmp[i]+=centralities[id];
      }
      max=Math.max(max,tmp[i]);
      if (isCanceled) {
        return;
      }
    }
    sumChange=0;
    for (int k=0; k < N; k++) {
      if (max != 0) {
        sumChange+=Math.abs(centralities[k] - (tmp[k] / max));
        centralities[k]=tmp[k] / max;
      }
      if (isCanceled) {
        return;
      }
    }
    if (isCanceled) {
      return;
    }
    Progress.progress(progress);
  }
  for (int i=0; i < N; i++) {
    Node s=indicies.get(i);
    AttributeRow row=(AttributeRow)s.getNodeData().getAttributes();
    row.setValue(eigenCol,centralities[i]);
    if (isCanceled) {
      return;
    }
  }
  hgraph.readUnlock();
  Progress.finish(progress);
}