Program: 39818
Project: 39818
Buggy source:
@Override public Graph transform(Graph g){
  Node[] nodesOld=g.getNodes();
  boolean[] added=new boolean[nodesOld.length];
  int[] degree=new int[nodesOld.length];
  Random rand=new Random();
  int[] out;
  int maxdeg=nodesOld[this.getMaxDegree(nodesOld,rand)].getOutDegree();
  if (this.maxDegree < maxdeg) {
    maxdeg=this.maxDegree;
  }
  int[] start=this.getStartIndex(nodesOld,rand);
  HashMap<Integer,Integer> newIndex=new HashMap<Integer,Integer>(Math.min(nodesOld.length,this.include));
  HashMap<Integer,Vector<Integer>> neighs=new HashMap<Integer,Vector<Integer>>(nodesOld.length);
  Vector<Vector<Integer>> inDegree=new Vector<Vector<Integer>>(maxdeg + 1);
  for (int i=0; i < maxdeg + 1; i++) {
    inDegree.add(new Vector<Integer>());
  }
  int count=start.length;
  Vector<Integer> list;
  for (int i=0; i < start.length; i++) {
    added[start[i]]=true;
    degree[start[i]]=start.length - 1;
    Vector<Integer> neighbors=new Vector<Integer>();
    for (int k=0; k < i; k++) {
      neighbors.add(start[k]);
    }
    neighs.put(start[i],neighbors);
  }
  for (int i=0; i < start.length; i++) {
    if (degree[start[i]] == this.maxDegree) {
    }
 else {
      out=nodesOld[start[i]].getOutgoingEdges();
      for (int j=0; j < out.length; j++) {
        if (!added[out[j]] && degree[out[j]] < this.maxDegree) {
          inDegree.get(degree[out[j]]).removeElement(out[j]);
          degree[out[j]]++;
          inDegree.get(degree[out[j]]).add(out[j]);
        }
      }
    }
  }
  while (count < this.include && count < nodesOld.length) {
    int chosen=this.getNext(inDegree,rand);
    if (chosen == -1) {
      break;
    }
    neighs.put(chosen,this.addNode(added,degree,nodesOld[chosen],inDegree,nodesOld));
    count++;
  }
  Node[] nodesNew=new Node[count];
  Edges edges=new Edges(nodesNew,g.computeNumberOfEdges());
  int c=0;
  for (int i=0; i < added.length; i++) {
    if (added[i]) {
      nodesNew[c]=nodesOld[i];
      newIndex.put(i,c);
      nodesNew[c].setIndex(c);
      c++;
    }
  }
  c=0;
  for (int i=0; i < added.length; i++) {
    if (added[i]) {
      list=neighs.get(i);
      for (int j=0; j < list.size(); j++) {
        edges.add(c,newIndex.get(list.get(j)));
        edges.add(newIndex.get(list.get(j)),c);
      }
      c++;
    }
  }
  edges.fill();
  g.setNodes(nodesNew);
  return g;
}

Fixed version (ground truth):
@Override public Graph transform(Graph g){
  Node[] nodesOld=g.getNodes();
  boolean[] added=new boolean[nodesOld.length];
  int[] degree=new int[nodesOld.length];
  Random rand=new Random();
  int[] out;
  int maxdeg=nodesOld[this.getMaxDegree(nodesOld,rand)].getDegree();
  if (this.maxDegree < maxdeg) {
    maxdeg=this.maxDegree;
  }
  int[] start=this.getStartIndex(nodesOld,rand);
  HashMap<Integer,Integer> newIndex=new HashMap<Integer,Integer>(Math.min(nodesOld.length,this.include));
  HashMap<Integer,Vector<Integer>> neighs=new HashMap<Integer,Vector<Integer>>(nodesOld.length);
  Vector<Vector<Integer>> inDegree=new Vector<Vector<Integer>>(maxdeg + 1);
  for (int i=0; i < maxdeg + 1; i++) {
    inDegree.add(new Vector<Integer>());
  }
  int count=start.length;
  Vector<Integer> list;
  for (int i=0; i < start.length; i++) {
    added[start[i]]=true;
    System.out.println("String_Node_Str" + start[i]);
    degree[start[i]]=start.length - 1;
    Vector<Integer> neighbors=new Vector<Integer>();
    for (int k=0; k < i; k++) {
      neighbors.add(start[k]);
    }
    neighs.put(start[i],neighbors);
  }
  for (int i=0; i < start.length; i++) {
    if (degree[start[i]] == this.maxDegree) {
    }
 else {
      out=nodesOld[start[i]].getOutgoingEdges();
      for (int j=0; j < out.length; j++) {
        if (!added[out[j]] && degree[out[j]] < this.maxDegree) {
          inDegree.get(degree[out[j]]).removeElement(out[j]);
          degree[out[j]]++;
          inDegree.get(degree[out[j]]).add(out[j]);
        }
      }
    }
  }
  while (count < this.include && count < nodesOld.length) {
    int chosen=this.getNext(inDegree,rand);
    if (chosen == -1) {
      break;
    }
    neighs.put(chosen,this.addNode(added,degree,nodesOld[chosen],inDegree,nodesOld));
    count++;
  }
  Node[] nodesNew=new Node[count];
  Edges edges=new Edges(nodesNew,g.computeNumberOfEdges());
  int c=0;
  for (int i=0; i < added.length; i++) {
    if (added[i]) {
      nodesNew[c]=nodesOld[i];
      newIndex.put(i,c);
      nodesNew[c].setIndex(c);
      c++;
    }
  }
  c=0;
  for (int i=0; i < added.length; i++) {
    if (added[i]) {
      list=neighs.get(i);
      for (int j=0; j < list.size(); j++) {
        edges.add(c,newIndex.get(list.get(j)));
        edges.add(newIndex.get(list.get(j)),c);
      }
      c++;
    }
  }
  edges.fill();
  g.setNodes(nodesNew);
  return g;
}