A point in the code that confuses me a bit
Hi! I'm using this code as a study material, but in reading through the code I have a few questions that have always puzzled me a bit.
In the file: mol_vae/mol_decoder
/attribute_tree_decoder.py. There is a code about finding the num of maximum matching rings, and the code is implemented as follows:
def maximum_match(self, pre_pos, remain): if remain == 0: return 0 cur_pos = self.atom_num - 1 s = set() ans = 0 rest = remain for cost in range(1, 4): for r in self.open_rings: if bond_valence[self.open_rings[r].b_type] != cost: continue if self.ring_valid(r, pre_pos, rest) and not self.open_rings[r].pos in s: s.add(self.open_rings[r].pos) rest -= 1 ans += 1 assert rest >= 0 if rest == 0: return ans return ans
I guess the rest -= 1 might not properly account for the bond cost since the cost might be 2 or 3. Unless rest is indicating the number of connections, but again, that seems a bit unreasonable. Feel free to correct me if there are any problems with my understanding, but this one is bugging me right now! QwQ