Program: 125152
Project: 125152
Buggy source:
public Long WQWeightByTraversal(Tripartition trip,CondensedTraversalWeightCalculator algorithm){
  int[][] overlap=new int[clusterID.size()][3];
  long weight=0;
  for (int i=0; i < GlobalMaps.taxonIdentifier.taxonCount(); i++) {
    overlap[i][0]=trip.cluster1.getBitSet().get(i) ? 1 : 0;
    overlap[i][1]=trip.cluster2.getBitSet().get(i) ? 1 : 0;
    overlap[i][2]=trip.cluster3.getBitSet().get(i) ? 1 : 0;
  }
  for (int i=0; i < dependerID.length; i++) {
    overlap[dependerID[i]][0]+=overlap[dependeeID[i]][0] * dependingFactor[i];
    overlap[dependerID[i]][1]+=overlap[dependeeID[i]][1] * dependingFactor[i];
    overlap[dependerID[i]][2]+=overlap[dependeeID[i]][2] * dependingFactor[i];
  }
  for (int i=0, j=0; i < partitionMultiplicity.length; i++) {
    if (partitionNumClusters[i] == 3) {
      weight+=algorithm.F(overlap[partitionClusterID[j]],overlap[partitionClusterID[j + 1]],overlap[partitionClusterID[j + 2]]) * partitionMultiplicity[i];
    }
 else {
      for (int p=j; p < j + partitionNumClusters[i]; p++) {
        for (int q=p + 1; q < j + partitionNumClusters[i]; q++) {
          for (int r=p + 1; r < j + partitionNumClusters[i]; r++) {
            weight+=algorithm.F(overlap[partitionClusterID[p]],overlap[partitionClusterID[q]],overlap[partitionClusterID[r]]) * partitionMultiplicity[i];
          }
        }
      }
    }
    j+=partitionNumClusters[i];
  }
  return weight;
}

Fixed version (ground truth):
public Long WQWeightByTraversal(Tripartition trip,CondensedTraversalWeightCalculator algorithm){
  int[][] overlap=new int[clusterID.size()][3];
  long weight=0;
  long[] sx=new long[3], sxy=new long[3];
  int[] q;
  for (int i=0; i < GlobalMaps.taxonIdentifier.taxonCount(); i++) {
    overlap[i][0]=trip.cluster1.getBitSet().get(i) ? 1 : 0;
    overlap[i][1]=trip.cluster2.getBitSet().get(i) ? 1 : 0;
    overlap[i][2]=trip.cluster3.getBitSet().get(i) ? 1 : 0;
  }
  for (int i=0; i < dependerID.length; i++) {
    overlap[dependerID[i]][0]+=overlap[dependeeID[i]][0] * dependingFactor[i];
    overlap[dependerID[i]][1]+=overlap[dependeeID[i]][1] * dependingFactor[i];
    overlap[dependerID[i]][2]+=overlap[dependeeID[i]][2] * dependingFactor[i];
  }
  for (int i=0, j=0; i < partitionMultiplicity.length; i++) {
    if (partitionNumClusters[i] == 3) {
      weight+=algorithm.F(overlap[partitionClusterID[j]],overlap[partitionClusterID[j + 1]],overlap[partitionClusterID[j + 2]]) * partitionMultiplicity[i];
    }
 else {
      long tempWeight=0;
      sx[0]=0;
      sx[1]=0;
      sx[2]=0;
      sxy[0]=0;
      sxy[1]=0;
      sxy[2]=0;
      for (int p=j; p < j + partitionNumClusters[i]; p++) {
        q=overlap[partitionClusterID[p]];
        sx[0]+=q[0];
        sx[1]+=q[1];
        sx[2]+=q[2];
        sxy[0]+=q[1] * q[2];
        sxy[1]+=q[2] * q[0];
        sxy[2]+=q[0] * q[1];
      }
      for (int p=j; p < j + partitionNumClusters[i]; p++) {
        q=overlap[partitionClusterID[p]];
        tempWeight+=((sx[1] - q[1]) * (sx[2] - q[2]) - sxy[0] + q[1] * q[2]) * q[0] * (q[0] - 1L) + ((sx[2] - q[2]) * (sx[0] - q[0]) - sxy[1] + q[2] * q[0]) * q[1] * (q[1] - 1L) + ((sx[0] - q[0]) * (sx[1] - q[1]) - sxy[2] + q[0] * q[1]) * q[2] * (q[2] - 1L);
      }
      weight+=tempWeight * partitionMultiplicity[i];
    }
    j+=partitionNumClusters[i];
  }
  return weight;
}