Program: 51060
Project: 51060
Buggy source:
private void createRandomSubSet(int trainSetSize,int testSetSize,long seed){
  List<Pair<DirectedGraph<Vertex<String>,Edge<String>>>> allPairs=new ArrayList<Pair<DirectedGraph<Vertex<String>,Edge<String>>>>(dataSet.getLabels().keySet());
  trainGraphsA=new ArrayList<DirectedGraph<Vertex<String>,Edge<String>>>();
  trainGraphsB=new ArrayList<DirectedGraph<Vertex<String>,Edge<String>>>();
  testGraphsA=new ArrayList<DirectedGraph<Vertex<String>,Edge<String>>>();
  testGraphsB=new ArrayList<DirectedGraph<Vertex<String>,Edge<String>>>();
  trainSet=new ArrayList<Pair<DirectedGraph<Vertex<String>,Edge<String>>>>();
  testSet=new ArrayList<Pair<DirectedGraph<Vertex<String>,Edge<String>>>>();
  Collections.shuffle(allPairs,new Random(seed));
  boolean classLabel=false;
  int posClass=0, testPosClass=0;
  int negClass=0, testNegClass=0;
  int totalPos=0;
  for (  Pair<DirectedGraph<Vertex<String>,Edge<String>>> pair : allPairs) {
    if (dataSet.getLabels().get(pair)) {
      totalPos++;
    }
  }
  long testPosSize=Math.round(((double)totalPos / (double)allPairs.size()) * ((double)testSetSize));
  long testNegSize=Math.round(((double)(allPairs.size() - totalPos) / (double)allPairs.size()) * ((double)testSetSize));
  for (  Pair<DirectedGraph<Vertex<String>,Edge<String>>> pair : allPairs) {
    classLabel=dataSet.getLabels().get(pair);
    if (classLabel) {
      if (posClass < trainSetSize / 2) {
        trainSet.add(pair);
        posClass++;
        if (!trainGraphsA.contains(pair.getFirst())) {
          trainGraphsA.add(pair.getFirst());
        }
        if (!trainGraphsB.contains(pair.getSecond())) {
          trainGraphsB.add(pair.getSecond());
        }
      }
 else       if (testPosClass < testPosSize) {
        testSet.add(pair);
        testPosClass++;
        if (!testGraphsA.contains(pair.getFirst())) {
          testGraphsA.add(pair.getFirst());
        }
        if (!testGraphsB.contains(pair.getSecond())) {
          testGraphsB.add(pair.getSecond());
        }
      }
    }
 else {
      if (negClass < trainSetSize / 2) {
        trainSet.add(pair);
        negClass++;
        if (!trainGraphsA.contains(pair.getFirst())) {
          trainGraphsA.add(pair.getFirst());
        }
        if (!trainGraphsB.contains(pair.getSecond())) {
          trainGraphsB.add(pair.getSecond());
        }
      }
 else       if (testNegClass < testNegSize) {
        testSet.add(pair);
        testNegClass++;
        if (!testGraphsA.contains(pair.getFirst())) {
          testGraphsA.add(pair.getFirst());
        }
        if (!testGraphsB.contains(pair.getSecond())) {
          testGraphsB.add(pair.getSecond());
        }
      }
      if (posClass == trainSetSize / 2 && negClass == trainSetSize / 2 && testPosClass == testPosSize && testNegClass == testNegSize) {
        break;
      }
    }
  }
}

Fixed version (ground truth):
private void createRandomSubSet(int trainSetSize,int testSetSize,long seed){
  List<Pair<DirectedMultigraphWithRoot<Vertex<String>,Edge<String>>>> allPairs=new ArrayList<Pair<DirectedMultigraphWithRoot<Vertex<String>,Edge<String>>>>(dataSet.getLabels().keySet());
  trainGraphsA=new ArrayList<DirectedMultigraphWithRoot<Vertex<String>,Edge<String>>>();
  trainGraphsB=new ArrayList<DirectedMultigraphWithRoot<Vertex<String>,Edge<String>>>();
  testGraphsA=new ArrayList<DirectedMultigraphWithRoot<Vertex<String>,Edge<String>>>();
  testGraphsB=new ArrayList<DirectedMultigraphWithRoot<Vertex<String>,Edge<String>>>();
  trainSet=new ArrayList<Pair<DirectedMultigraphWithRoot<Vertex<String>,Edge<String>>>>();
  testSet=new ArrayList<Pair<DirectedMultigraphWithRoot<Vertex<String>,Edge<String>>>>();
  Collections.shuffle(allPairs,new Random(seed));
  boolean classLabel=false;
  int posClass=0, testPosClass=0;
  int negClass=0, testNegClass=0;
  int totalPos=0;
  for (  Pair<DirectedMultigraphWithRoot<Vertex<String>,Edge<String>>> pair : allPairs) {
    if (dataSet.getLabels().get(pair)) {
      totalPos++;
    }
  }
  long testPosSize=Math.round(((double)totalPos / (double)allPairs.size()) * ((double)testSetSize));
  long testNegSize=Math.round(((double)(allPairs.size() - totalPos) / (double)allPairs.size()) * ((double)testSetSize));
  for (  Pair<DirectedMultigraphWithRoot<Vertex<String>,Edge<String>>> pair : allPairs) {
    classLabel=dataSet.getLabels().get(pair);
    if (classLabel) {
      if (posClass < trainSetSize / 2) {
        trainSet.add(pair);
        posClass++;
        if (!trainGraphsA.contains(pair.getFirst())) {
          trainGraphsA.add(pair.getFirst());
        }
        if (!trainGraphsB.contains(pair.getSecond())) {
          trainGraphsB.add(pair.getSecond());
        }
      }
 else       if (testPosClass < testPosSize) {
        testSet.add(pair);
        testPosClass++;
        if (!testGraphsA.contains(pair.getFirst())) {
          testGraphsA.add(pair.getFirst());
        }
        if (!testGraphsB.contains(pair.getSecond())) {
          testGraphsB.add(pair.getSecond());
        }
      }
    }
 else {
      if (negClass < trainSetSize / 2) {
        trainSet.add(pair);
        negClass++;
        if (!trainGraphsA.contains(pair.getFirst())) {
          trainGraphsA.add(pair.getFirst());
        }
        if (!trainGraphsB.contains(pair.getSecond())) {
          trainGraphsB.add(pair.getSecond());
        }
      }
 else       if (testNegClass < testNegSize) {
        testSet.add(pair);
        testNegClass++;
        if (!testGraphsA.contains(pair.getFirst())) {
          testGraphsA.add(pair.getFirst());
        }
        if (!testGraphsB.contains(pair.getSecond())) {
          testGraphsB.add(pair.getSecond());
        }
      }
      if (posClass == trainSetSize / 2 && negClass == trainSetSize / 2 && testPosClass == testPosSize && testNegClass == testNegSize) {
        break;
      }
    }
  }
}