Skip to content

Commit

Permalink
extending capability to multidentates
Browse files Browse the repository at this point in the history
  • Loading branch information
jwtoney committed Jan 14, 2025
1 parent a44f4ce commit 31feef9
Show file tree
Hide file tree
Showing 2 changed files with 395 additions and 247 deletions.
26 changes: 26 additions & 0 deletions molSimplify/Classes/mol2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,29 @@ def find_metal(self, transition_metals_only: bool = True) -> List[int]:
if sym in globs.metalslist(transition_metals_only=transition_metals_only):
metal_list.append(i)
return metal_list

def find_simple_paths(self, source, sink, cutoff=None, constraints=None):
"""
Find simple (i.e., no repeated nodes) path(s) between source and sink nodes in Mol2D class.
Parameters
----------
source: int
Index of source node
sink: int
Index of sink node
cutoff: int
Depth at which to stop path search
Default=None
constraints: list
Nodes which may not be crossed during path
Default=None
Returns
-------
simple_paths : list
List of lists of simple paths
"""
simple_paths = [path for path in nx.all_simple_paths(self, source=source, target=sink, cutoff=cutoff)]
simple_paths = [path for path in simple_paths if not np.isin(path, constraints).any()] if constraints else simple_paths
return simple_paths

Check warning on line 301 in molSimplify/Classes/mol2D.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Classes/mol2D.py#L299-L301

Added lines #L299 - L301 were not covered by tests
Loading

0 comments on commit 31feef9

Please sign in to comment.