Program: 142683
Project: 142683
Buggy source:
public void weaklyConnected(HierarchicalUndirectedGraph graph,AttributeModel attributeModel){
  isCanceled=false;
  componentCount=0;
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn componentCol=nodeTable.getColumn(WEAKLY);
  if (componentCol == null) {
    componentCol=nodeTable.addColumn(WEAKLY,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,new Integer(0));
  }
  List<Integer> sizeList=new ArrayList<Integer>();
  graph.readLock();
  HashMap<Node,Integer> indicies=new HashMap<Node,Integer>();
  int index=0;
  for (  Node s : graph.getNodes()) {
    indicies.put(s,index);
    index++;
  }
  int N=graph.getNodeCount();
  int[] color=new int[N];
  Progress.start(progress,graph.getNodeCount());
  int seenCount=0;
  while (seenCount < N) {
    LinkedList<Node> Q=new LinkedList<Node>();
    LinkedList<Node> component=new LinkedList<Node>();
    NodeIterable iter=graph.getNodes();
    for (    Node first : iter) {
      if (color[indicies.get(first)] == 0) {
        Q.add(first);
        iter.doBreak();
        break;
      }
    }
    while (!Q.isEmpty()) {
      if (isCanceled) {
        graph.readUnlock();
        return;
      }
      Node u=Q.removeFirst();
      component.add(u);
      EdgeIterable edgeIter=graph.getEdges(u);
      for (      Edge edge : edgeIter) {
        Node reachable=graph.getOpposite(u,edge);
        int id=indicies.get(reachable);
        if (color[id] == 0) {
          color[id]=1;
          Q.addLast(reachable);
          Progress.progress(progress,seenCount);
        }
      }
      color[indicies.get(u)]=2;
      seenCount++;
    }
    for (    Node s : component) {
      AttributeRow row=(AttributeRow)s.getNodeData().getAttributes();
      row.setValue(componentCol,componentCount);
    }
    sizeList.add(component.size());
    componentCount++;
  }
  graph.readUnlock();
  componentsSize=new int[sizeList.size()];
  for (int i=0; i < sizeList.size(); i++) {
    componentsSize[i]=sizeList.get(i);
  }
}

Fixed version (ground truth):
public void weaklyConnected(HierarchicalUndirectedGraph hgraph,AttributeModel attributeModel){
  isCanceled=false;
  componentCount=0;
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn componentCol=nodeTable.getColumn(WEAKLY);
  if (componentCol == null) {
    componentCol=nodeTable.addColumn(WEAKLY,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,new Integer(0));
  }
  List<Integer> sizeList=new ArrayList<Integer>();
  hgraph.readLock();
  HashMap<Node,Integer> indicies=new HashMap<Node,Integer>();
  int index=0;
  for (  Node s : hgraph.getNodes()) {
    indicies.put(s,index);
    index++;
  }
  int N=hgraph.getNodeCount();
  int[] color=new int[N];
  Progress.start(progress,hgraph.getNodeCount());
  int seenCount=0;
  while (seenCount < N) {
    LinkedList<Node> Q=new LinkedList<Node>();
    LinkedList<Node> component=new LinkedList<Node>();
    NodeIterable iter=hgraph.getNodes();
    for (    Node first : iter) {
      if (color[indicies.get(first)] == 0) {
        Q.add(first);
        iter.doBreak();
        break;
      }
    }
    while (!Q.isEmpty()) {
      if (isCanceled) {
        hgraph.readUnlock();
        return;
      }
      Node u=Q.removeFirst();
      component.add(u);
      EdgeIterable edgeIter=hgraph.getEdgesAndMetaEdges(u);
      for (      Edge edge : edgeIter) {
        Node reachable=hgraph.getOpposite(u,edge);
        int id=indicies.get(reachable);
        if (color[id] == 0) {
          color[id]=1;
          Q.addLast(reachable);
          Progress.progress(progress,seenCount);
        }
      }
      color[indicies.get(u)]=2;
      seenCount++;
    }
    for (    Node s : component) {
      AttributeRow row=(AttributeRow)s.getNodeData().getAttributes();
      row.setValue(componentCol,componentCount);
    }
    sizeList.add(component.size());
    componentCount++;
  }
  hgraph.readUnlock();
  componentsSize=new int[sizeList.size()];
  for (int i=0; i < sizeList.size(); i++) {
    componentsSize[i]=sizeList.get(i);
  }
}