public void bufferSave(GraphNode child){

    int i=0;
    while(!buffer.get(i).equals(child)){
      i++;
    }
    
    int k=0;
    int[] temp = new int[buffer.size() - i];
    while(i<buffer.size()){
    
      temp[k] = buffer.get(i).getNodeIndex();
      k++;
      i++;
    }
    cycles.add(temp);
    
  }