Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MolAdvisor fix #183

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions examples/molecule_search/mol_advisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ def propose_atom_removal(mol_graph: MolGraph) -> Sequence[int]:
Proposes atoms that can be removed - any atom, which deletion will not increase the number of connected
components of the molecule.
"""
nx_graph = mol_graph.get_nx_graph()
art_points_ids = nx.articulation_points(nx_graph)
atom_ids = np.arange(mol_graph.heavy_atoms_number)
return list(set(atom_ids) - set(art_points_ids))
if mol_graph.heavy_atoms_number > 1:
nx_graph = mol_graph.get_nx_graph()
art_points_ids = nx.articulation_points(nx_graph)
atom_ids = np.arange(mol_graph.heavy_atoms_number)
return list(set(atom_ids) - set(art_points_ids))
else:
return []

@staticmethod
def propose_connection(mol_graph: MolGraph) -> Sequence[Tuple[int, int]]:
Expand Down
Loading