pyg-team/pytorch_geometric

List node features can not be sliced with subgraph

Open

#6162 aperta il 7 dic 2022

Vedi su GitHub
 (13 commenti) (0 reazioni) (0 assegnatari)Python (3514 fork)batch import
0 - Priority P0featurehelp wanted

Metriche repository

Star
 (19.985 star)
Metriche merge PR
 (Merge medio 35g 1h) (14 PR mergiate in 30 g)

Descrizione

How to pass subgraph Data as a node feature into main graph Data? test_data=Data(edge_index=edge_index,pos=torch.tensor(np.array(pos)), graph=subgraphList) subgraphList is as follows:

 Data(x=[1, 3], edge_index=[2, 0], pos=[1, 2]),
 ...
 Data(x=[10, 3], edge_index=[2, 18])]```
The issue is that when I tried to mask some nodes:
`mask_test_data=test_data.subgraph(mask)`
mask_test_data.graph is the same as test_data.graph, while the size of mask_test_data.pos is reduced from test_data.pos.

After testing, I found the issue is caused by the type of list. May I know whether there is another type of container in which I can store the subgraph Data, and it can auto-align with  `test_data.subgraph(mask)`?

[Slack Message](https://torchgeometricco.slack.com/archives/C01DN0B3B1N/p1670346485240969?thread_ts=1670346485.240969&cid=C01DN0B3B1N)

Guida contributor