Closed rg314 closed 1 year ago
Good catch! i think all edges added through Graphein's methods will specify a kind. This would not necessarily be true for user-defined edge functions though so this should be fixed.
I suggest:
# Split edge index by edge kind
kind_strs = np.array(list(map(lambda x: "_".join(x), data.get("kind",[]))))
for kind in set(kind_strs):
key = f"edge_index_{kind}"
if key in self.columns:
mask = kind_strs == kind
data[key] = edge_index[:, mask]
if "kind" not in self.columns and data.get('kind'):
del data["kind"]
I'll PR
Hi, @rg314! Yes, it's my mistake. I was considering kind
mandatory. Great that you pointed it out.
Good catch! i think all edges added through Graphein's methods will specify a kind. This would not necessarily be true for user-defined edge functions though so this should be fixed.
I'm not sure if the func graphein.rna.graphs.construct_graph
has kind
Hi @anton-bushuiev,
Your commit for "Improve
convert_nx_to_pyg
" added some breaking changes. Edges do not necessarily have a kind unless I'm not understanding something?https://github.com/a-r-j/graphein/blob/b308a58934c29e145666bf35a073b226c9b2b6d4/graphein/ml/conversion.py#L307
Originally posted by @rg314 in https://github.com/a-r-j/graphein/issues/234#issuecomment-1467928043