pyg-team/pytorch_geometric

Convert heterogeneous NetworkX graph to HeteroData without normalizing features across node types

Open

#7.340 geöffnet am 10. Mai 2023

Auf GitHub ansehen
 (7 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (3.514 Forks)batch import
0 - Priority P0featurehelp wanted

Repository-Metriken

Stars
 (19.985 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 35T 1h) (14 gemergte PRs in 30 T)

Beschreibung

🚀 The feature, motivation and pitch

I am working on converting a heterogeneous NetworkX graph to HeteroData. Here is an example that I would like to see working:

nodes_types = torch.tensor([1, 2, 3])
nx_graph = nx.MultiGraph()
nx_graph.add_node(0, type=1, foo=4.97, bar=torch.tensor([9, 8]))
nx_graph.add_node(1, type=2, foo=4.97)
nx_graph.add_node(2, type=3)
pyg.utils.from_networkx(nx_graph, group_node_attrs=['type', 'foo', 'bar'])

which currently throws raise ValueError('Not all nodes contain the same attributes').

I know that my graph is heterogeneous, but to convert from NetworkX to HeteroData, I need to manually normalize all of the node attributes. I would like to not have to write my own conversion layer.

Alternatives

N/A

Additional context

N/A

Contributor Guide