We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
g.has_node(q["id"])
1 parent e01f7b7 commit 582b528Copy full SHA for 582b528
chebai/preprocessing/datasets/chebi.py
@@ -260,13 +260,9 @@ def _extract_class_hierarchy(self, data_path: str) -> nx.DiGraph:
260
g.add_node(n["id"], **n)
261
262
# Only take the edges which connects the existing nodes, to avoid internal creation of obsolete nodes
263
+ # https://github.com/ChEB-AI/python-chebai/pull/55#issuecomment-2386654142
264
g.add_edges_from(
- [
265
- (p, q["id"])
266
- for q in elements
267
- for p in q["parents"]
268
- if g.has_node(p) and g.has_node(q["id"])
269
- ]
+ [(p, q["id"]) for q in elements for p in q["parents"] if g.has_node(p)]
270
)
271
272
print("Compute transitive closure")
0 commit comments