public void flagAncestors(int[] MoleculeID, int size, int val){
    
    
    if ((size!=0)){
      val = MoleculeID[MoleculeID.length-size];
      this.flag();
      //System.out.printf(""+toStringf()+" flagged\n");
      if(children!=null){
        children.get(val).flagAncestors(MoleculeID, size-1, val);
      }
      
    }
  }