def count(): cnt, n = 0, 0 for s in sys.stdin: s = s.split()[0] tree = MolTree(s) tree.recover() tree.assemble() for node in tree.nodes: cnt += len(node.cands) n += len(tree.nodes)
def enum_test(): for s in sys.stdin: s = s.split()[0] tree = MolTree(s) tree.recover() tree.assemble() for node in tree.nodes: if node.label not in node.cands: print(tree.smiles) print(node.smiles, [x.smiles for x in node.neighbors]) print(node.label, len(node.cands))
def test_enum(self): """test_enum.""" for smiles in self.__smiles: tree = MolTree(smiles) tree.recover() tree.assemble() for node in tree.get_nodes(): if node.get_label() not in node.get_candidates(): print(tree.get_smiles()) print(node.get_smiles(), [x.get_smiles() for x in node.get_neighbors()]) print(node.get_label(), len(node.get_candidates()))
def __getitem__(self, idx): smiles = self.data[idx] mol_tree = MolTree(smiles) mol_tree.recover() mol_tree.assemble() return mol_tree, self.prop_data[idx]