Program: 50125
Project: 50125
Buggy source:
private void mapNonRootNodes(List<Tree> trees){
  for (int k=0; k < trees.size(); k++) {
    Tree tree=trees.get(k);
    System.out.print("String_Node_Str" + k + "String_Node_Str");
    long z=new Date().getTime();
    Transaction tx=gdb.beginTx();
    Map<TreeNode,Integer> edgeIdForTreeNode=new HashMap<TreeNode,Integer>();
    int i=0;
    for (    TreeNode treeNode : tree.internalNodes(NodeOrder.PREORDER)) {
      if (!treeNode.isTheRoot()) {
        int edgeId=++i;
        edgeIdForTreeNode.put(treeNode,edgeId);
        Set<Node> graphNodes=mapGraphNodes(treeNode,tree,edgeId,false);
        if (graphNodes.size() == 0) {
          System.out.println("String_Node_Str" + treeNode.getNewick(false) + "String_Node_Str"+ graphNodes);
          throw new AssertionError();
        }
        graphNodesForTreeNode.put(treeNode,(HashSet<Node>)graphNodes);
      }
    }
    for (    TreeNode treeTip : tree.externalNodes()) {
      int edgeId=++i;
      edgeIdForTreeNode.put(treeTip,edgeId);
      mapGraphNodes(treeTip,tree,edgeIdForTreeNode.get(treeTip),true);
      Node tip=gdb.getNodeById(nodeIdForLabel.get(treeTip.getLabel()));
      LongBipartition lb=getExpandedTaxonomyBipart(getGraphBipartForTreeNode(treeTip,tree));
      for (      Node parent : graphNodesForTreeNode.get(treeTip.getParent())) {
        if (tip.equals(parent))         continue;
        updateMRCAChildOf(tip,parent);
        updateSTREEChildOf(tip,parent,sourceForTreeNode.get(treeTip),rankForTreeNode.get(treeTip),edgeId,lb,true);
        if (mapdeepest == true) {
          Node startTip=tip;
          boolean going=true;
          while (going == true) {
            startTip=startTip.getSingleRelationship(RelType.TAXCHILDOF,Direction.OUTGOING).getEndNode();
            if (taxonomyGraphNodesMap.containsKey(startTip)) {
              LongBipartition pbip=null;
              LongBipartition cbip=taxonomyGraphNodesMap.get(startTip);
              if (bipartForGraphNodeExploded.containsKey(parent)) {
                pbip=bipartForGraphNodeExploded.get(parent);
              }
 else {
                pbip=taxonomyGraphNodesMap.get(parent);
              }
              if (pbip.ingroup().containsAny(cbip.ingroup()) && cbip.ingroup().containsAny(pbip.outgroup()) == false && cbip.ingroup().containsAll(pbip.ingroup()) == false) {
                updateMRCAChildOf(tip,startTip);
                updateSTREEChildOf(tip,startTip,sourceForTreeNode.get(treeTip),rankForTreeNode.get(treeTip),edgeId,lb,true);
                if (startTip.equals(parent))                 continue;
                updateMRCAChildOf(startTip,parent);
                updateSTREEChildOf(startTip,parent,sourceForTreeNode.get(treeTip),rankForTreeNode.get(treeTip),edgeId,lb,true);
              }
 else {
                going=false;
                break;
              }
            }
 else {
              break;
            }
          }
        }
      }
    }
    if (subsetTipInfo != null) {
      for (      TreeNode treeTip : tree.externalNodes()) {
        int edgeId=edgeIdForTreeNode.get(treeTip);
        if (subsetTipInfo.containsKey(treeTip)) {
          Index<Node> ottIdIndexss=gdb.getNodeIndex("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
          IndexHits<Node> hitroots=ottIdIndexss.get("String_Node_Str",sourceForTreeNode.get(treeTip) + subsetTipInfo.get(treeTip));
          for (          Node tip : hitroots) {
            for (            Node parent : graphNodesForTreeNode.get(treeTip.getParent())) {
              if (tip.equals(parent))               continue;
              updateMRCAChildOf(tip,parent);
              updateSTREEChildOf(tip,parent,sourceForTreeNode.get(treeTip),rankForTreeNode.get(treeTip),edgeId,null,false);
            }
          }
        }
      }
    }
    tx.success();
    tx.finish();
    System.out.println("String_Node_Str" + (new Date().getTime() - z) / (float)1000 + "String_Node_Str");
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
private void mapNonRootNodes(List<Tree> trees){
  for (int k=0; k < trees.size(); k++) {
    Tree tree=trees.get(k);
    System.out.print("String_Node_Str" + k + "String_Node_Str");
    long z=new Date().getTime();
    Transaction tx=gdb.beginTx();
    Map<TreeNode,Integer> edgeIdForTreeNode=new HashMap<TreeNode,Integer>();
    int i=0;
    for (    TreeNode treeNode : tree.internalNodes(NodeOrder.PREORDER)) {
      if (!treeNode.isTheRoot()) {
        int edgeId=++i;
        edgeIdForTreeNode.put(treeNode,edgeId);
        Set<Node> graphNodes=mapGraphNodes(treeNode,tree,edgeId,false);
        if (graphNodes.size() == 0) {
          System.out.println("String_Node_Str" + treeNode.getNewick(false) + "String_Node_Str"+ graphNodes);
          throw new AssertionError();
        }
        graphNodesForTreeNode.put(treeNode,(HashSet<Node>)graphNodes);
      }
    }
    for (    TreeNode treeTip : tree.externalNodes()) {
      int edgeId=++i;
      edgeIdForTreeNode.put(treeTip,edgeId);
      mapGraphNodes(treeTip,tree,edgeIdForTreeNode.get(treeTip),true);
      Node tip=gdb.getNodeById(nodeIdForLabel.get(treeTip.getLabel()));
      LongBipartition lb=getExpandedTaxonomyBipart(getGraphBipartForTreeNode(treeTip,tree));
      for (      Node parent : graphNodesForTreeNode.get(treeTip.getParent())) {
        if (tip.equals(parent))         continue;
        updateMRCAChildOf(tip,parent);
        updateSTREEChildOf(tip,parent,sourceForTreeNode.get(treeTip),rankForTreeNode.get(treeTip),edgeId,lb,true);
        if (mapdeepest == true) {
          LongBipartition nodeBipartExp=bipartForTreeNodeExploded.get(treeTip.getParent());
          MutableCompactLongSet alsoExclude=new MutableCompactLongSet();
          for (          TreeNode othertips : treeTip.getParent().getChildren()) {
            if (othertips.equals(treeTip))             continue;
            if (othertips.isExternal()) {
              alsoExclude.add(nodeIdForLabel.get(treeTip.getLabel()));
            }
 else {
              alsoExclude.addAll(bipartForTreeNodeExploded.get(othertips).ingroup());
            }
          }
          Node startTip=tip;
          boolean going=true;
          while (going == true) {
            startTip=startTip.getSingleRelationship(RelType.TAXCHILDOF,Direction.OUTGOING).getEndNode();
            if (taxonomyGraphNodesMap.containsKey(startTip)) {
              LongBipartition pbip=null;
              LongBipartition cbip=taxonomyGraphNodesMap.get(startTip);
              if (bipartForGraphNodeExploded.containsKey(parent)) {
                pbip=bipartForGraphNodeExploded.get(parent);
              }
 else {
                pbip=taxonomyGraphNodesMap.get(parent);
              }
              if (cbip.ingroup().containsAny(nodeBipartExp.outgroup())) {
                break;
              }
              if (cbip.ingroup().containsAny(alsoExclude)) {
                break;
              }
              if (pbip.ingroup().containsAny(cbip.ingroup()) && cbip.ingroup().containsAny(pbip.outgroup()) == false && cbip.ingroup().containsAll(pbip.ingroup()) == false) {
                updateMRCAChildOf(tip,startTip);
                updateSTREEChildOf(tip,startTip,sourceForTreeNode.get(treeTip),rankForTreeNode.get(treeTip),edgeId,lb,true);
                if (startTip.equals(parent))                 continue;
                updateMRCAChildOf(startTip,parent);
                updateSTREEChildOf(startTip,parent,sourceForTreeNode.get(treeTip),rankForTreeNode.get(treeTip),edgeId,lb,true);
              }
 else {
                going=false;
                break;
              }
            }
 else {
              break;
            }
          }
        }
      }
    }
    if (subsetTipInfo != null) {
      for (      TreeNode treeTip : tree.externalNodes()) {
        int edgeId=edgeIdForTreeNode.get(treeTip);
        if (subsetTipInfo.containsKey(treeTip)) {
          Index<Node> ottIdIndexss=gdb.getNodeIndex("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
          IndexHits<Node> hitroots=ottIdIndexss.get("String_Node_Str",sourceForTreeNode.get(treeTip) + subsetTipInfo.get(treeTip));
          for (          Node tip : hitroots) {
            for (            Node parent : graphNodesForTreeNode.get(treeTip.getParent())) {
              if (tip.equals(parent))               continue;
              updateMRCAChildOf(tip,parent);
              updateSTREEChildOf(tip,parent,sourceForTreeNode.get(treeTip),rankForTreeNode.get(treeTip),edgeId,null,false);
            }
          }
        }
      }
    }
    tx.success();
    tx.finish();
    System.out.println("String_Node_Str" + (new Date().getTime() - z) / (float)1000 + "String_Node_Str");
  }
  System.out.println("String_Node_Str");
}