Skip to content

Commit 433b6d1

Browse files
committed
updates for networkx 3.5 and rdkit 2025
1 parent 0c7b192 commit 433b6d1

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

moleculekit/smallmol/smallmol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ def generateConformers(
729729
ps.numThreads = numThreads
730730
ps.useRandomCoords = useRandomCoords
731731
ps.pruneRmsThresh = pruneRmsThresh
732-
ps.maxAttempts = maxAttempts
732+
ps.maxIterations = maxAttempts
733733
ps.clearConfs = False
734734

735735
if not append:

moleculekit/tools/detect.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,25 @@ def rooted_tree_isomorphism(t1, root1, t2, root2, keyfunc):
100100
It should take as input the node and return a string
101101
"""
102102
import numpy as np
103-
from networkx.algorithms.isomorphism.tree_isomorphism import (
104-
assign_levels,
105-
group_by_levels,
106-
)
103+
104+
# figure out the level of each node, with 0 at root
105+
def assign_levels(G, root):
106+
level = {}
107+
level[root] = 0
108+
for v1, v2 in nx.bfs_edges(G, root):
109+
level[v2] = level[v1] + 1
110+
111+
return level
112+
113+
# now group the nodes at each level
114+
def group_by_levels(levels):
115+
L = {}
116+
for n, lev in levels.items():
117+
if lev not in L:
118+
L[lev] = []
119+
L[lev].append(n)
120+
121+
return L
107122

108123
assert nx.is_tree(t1)
109124
assert nx.is_tree(t2)

0 commit comments

Comments
 (0)