pyg-team/pytorch_geometric

List node features can not be sliced with subgraph

Open

#6,162 opened on Dec 7, 2022

View on GitHub
 (13 comments) (0 reactions) (0 assignees)Python (3,514 forks)batch import
0 - Priority P0featurehelp wanted

Repository metrics

Stars
 (19,985 stars)
PR merge metrics
 (Avg merge 35d 1h) (14 merged PRs in 30d)

Description

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)

Contributor guide