Program: 125202
Project: 125202
Buggy source:
int computeTreeSTBipartitions(List<Tree> trees,Map<String,String> taxonMap,Map<Integer,Set<Vertex>> clusters){
  int sigmaN=0;
  int k=trees.size();
  String[] leaves=stTaxa;
  int n=leaves.length;
  geneTreeSTBBySize=new ArrayList<Set<STBipartition>>(leaves.length);
  for (int i=0; i <= leaves.length; i++) {
    geneTreeSTBBySize.add(new HashSet<STBipartition>());
    clusters.put(i,new HashSet<Vertex>());
  }
  STBCountInGeneTrees=new HashMap<STBipartition,Integer>(k * n);
  X=new HashMap<STITreeCluster,Set<STBipartition>>(k * n);
  STITreeCluster all=new STITreeCluster(stTaxa);
  String as[];
  int j=(as=stTaxa).length;
  for (int i=0; i < j; i++) {
    String t=as[i];
    all.addLeaf(t);
  }
  addToClusters(clusters,all,leaves.length);
  for (  Tree tr : trees) {
    sigmaN+=tr.getLeafCount() - 1;
    Map<TNode,STITreeCluster> map=new HashMap<TNode,STITreeCluster>(n);
    for (Iterator<TNode> nodeIt=tr.postTraverse().iterator(); nodeIt.hasNext(); ) {
      TNode node=nodeIt.next();
      if (node.isLeaf()) {
        String nodeName=node.getName();
        if (taxonMap != null) {
          nodeName=taxonMap.get(nodeName);
        }
        STITreeCluster tb=new STITreeCluster(leaves);
        tb.addLeaf(nodeName);
        addToClusters(clusters,tb,1);
        map.put(node,tb);
        if (!rooted) {
          addSTB(clusters,tb,tb.complementaryCluster(),all,node);
        }
      }
 else {
        int childCount=node.getChildCount();
        STITreeCluster childbslist[]=new STITreeCluster[childCount];
        BitSet bs=new BitSet(leaves.length);
        int index=0;
        for (Iterator iterator3=node.getChildren().iterator(); iterator3.hasNext(); ) {
          TNode child=(TNode)iterator3.next();
          childbslist[index++]=map.get(child);
          bs.or(map.get(child).getCluster());
        }
        STITreeCluster cluster=new STITreeCluster(leaves);
        cluster.setCluster((BitSet)bs.clone());
        int size=cluster.getClusterSize();
        addToClusters(clusters,cluster,size);
        map.put(node,cluster);
        if (rooted) {
          if (index > 2) {
            throw new RuntimeException("String_Node_Str" + tr + "String_Node_Str"+ node);
          }
          STITreeCluster l_cluster=childbslist[0];
          STITreeCluster r_cluster=childbslist[1];
          addSTB(clusters,l_cluster,r_cluster,cluster,node);
        }
 else {
          if (childCount == 2) {
            STITreeCluster l_cluster=childbslist[0];
            STITreeCluster r_cluster=childbslist[1];
            STITreeCluster allMinuslAndr_cluster=cluster.complementaryCluster();
            STITreeCluster lAndr_cluster=cluster;
            addSTB(clusters,l_cluster,r_cluster,cluster,node);
            addSTB(clusters,r_cluster,allMinuslAndr_cluster,l_cluster.complementaryCluster(),node);
            addSTB(clusters,l_cluster,allMinuslAndr_cluster,r_cluster.complementaryCluster(),node);
            addSTB(clusters,lAndr_cluster,allMinuslAndr_cluster,all,node);
          }
 else           if (childCount == 3 && node.isRoot()) {
            STITreeCluster l_cluster=childbslist[0];
            STITreeCluster m_cluster=childbslist[1];
            STITreeCluster r_cluster=childbslist[2];
            addSTB(clusters,l_cluster,r_cluster,m_cluster.complementaryCluster(),node);
            addSTB(clusters,r_cluster,m_cluster,l_cluster.complementaryCluster(),node);
            addSTB(clusters,l_cluster,m_cluster,r_cluster.complementaryCluster(),node);
          }
 else {
            throw new RuntimeException("String_Node_Str" + tr + "String_Node_Str"+ node);
          }
        }
      }
    }
  }
  System.out.println("String_Node_Str" + STBCountInGeneTrees.keySet().size());
  int s=0;
  for (  Integer c : clusters.keySet()) {
    s+=clusters.get(c).size();
  }
  System.out.println("String_Node_Str" + s);
  weights=new HashMap<STBipartition,Integer>(STBCountInGeneTrees.size());
  return sigmaN;
}

Fixed version (ground truth):
int computeTreeSTBipartitions(List<Tree> trees,Map<String,String> taxonMap,Map<Integer,Set<Vertex>> clusters){
  int sigmaN=0;
  int k=trees.size();
  String[] leaves=stTaxa;
  int n=leaves.length;
  geneTreeSTBBySize=new ArrayList<Set<STBipartition>>(leaves.length);
  for (int i=0; i <= leaves.length; i++) {
    geneTreeSTBBySize.add(new HashSet<STBipartition>());
    clusters.put(i,new HashSet<Vertex>());
  }
  STBCountInGeneTrees=new HashMap<STBipartition,Integer>(k * n);
  X=new HashMap<STITreeCluster,Set<STBipartition>>(k * n);
  STITreeCluster all=new STITreeCluster(stTaxa);
  String as[];
  int j=(as=stTaxa).length;
  for (int i=0; i < j; i++) {
    String t=as[i];
    all.addLeaf(t);
  }
  addToClusters(clusters,all,leaves.length);
  for (  Tree tr : trees) {
    sigmaN+=tr.getLeafCount() - 1;
    Map<TNode,STITreeCluster> map=new HashMap<TNode,STITreeCluster>(n);
    for (Iterator<TNode> nodeIt=tr.postTraverse().iterator(); nodeIt.hasNext(); ) {
      TNode node=nodeIt.next();
      if (node.isLeaf()) {
        String nodeName=node.getName();
        if (taxonMap != null) {
          nodeName=taxonMap.get(nodeName);
        }
        STITreeCluster tb=new STITreeCluster(leaves);
        tb.addLeaf(nodeName);
        addToClusters(clusters,tb,1);
        map.put(node,tb);
        if (!rooted) {
          addSTB(clusters,tb,tb.complementaryCluster(),all,node);
        }
      }
 else {
        int childCount=node.getChildCount();
        STITreeCluster childbslist[]=new STITreeCluster[childCount];
        BitSet bs=new BitSet(leaves.length);
        int index=0;
        for (Iterator iterator3=node.getChildren().iterator(); iterator3.hasNext(); ) {
          TNode child=(TNode)iterator3.next();
          childbslist[index++]=map.get(child);
          bs.or(map.get(child).getCluster());
        }
        STITreeCluster cluster=new STITreeCluster(leaves);
        cluster.setCluster((BitSet)bs.clone());
        int size=cluster.getClusterSize();
        addToClusters(clusters,cluster,size);
        map.put(node,cluster);
        if (rooted) {
          if (index > 2) {
            throw new RuntimeException("String_Node_Str" + tr + "String_Node_Str"+ node);
          }
          STITreeCluster l_cluster=childbslist[0];
          STITreeCluster r_cluster=childbslist[1];
          addSTB(clusters,l_cluster,r_cluster,cluster,node);
        }
 else {
          if (childCount == 2) {
            STITreeCluster l_cluster=childbslist[0];
            STITreeCluster r_cluster=childbslist[1];
            STITreeCluster allMinuslAndr_cluster=cluster.complementaryCluster();
            STITreeCluster lAndr_cluster=cluster;
            if (allMinuslAndr_cluster.getClusterSize() != 0) {
              addSTB(clusters,l_cluster,r_cluster,cluster,node);
              addSTB(clusters,r_cluster,allMinuslAndr_cluster,null,node);
              addSTB(clusters,l_cluster,allMinuslAndr_cluster,null,node);
              addSTB(clusters,lAndr_cluster,allMinuslAndr_cluster,all,node);
            }
          }
 else           if (childCount == 3 && node.isRoot()) {
            STITreeCluster l_cluster=childbslist[0];
            STITreeCluster m_cluster=childbslist[1];
            STITreeCluster r_cluster=childbslist[2];
            addSTB(clusters,l_cluster,r_cluster,null,node);
            addSTB(clusters,r_cluster,m_cluster,null,node);
            addSTB(clusters,l_cluster,m_cluster,null,node);
          }
 else {
            throw new RuntimeException("String_Node_Str" + tr + "String_Node_Str"+ node);
          }
        }
      }
    }
  }
  System.out.println("String_Node_Str" + STBCountInGeneTrees.keySet().size());
  int s=0;
  for (  Integer c : clusters.keySet()) {
    s+=clusters.get(c).size();
  }
  System.out.println("String_Node_Str" + s);
  weights=new HashMap<STBipartition,Integer>(STBCountInGeneTrees.size());
  return sigmaN;
}