dmlc / dmlc/dgl

Bug: relabel_nodes=False in .subgraph() does not work correctly

Open
#6,817 2 comments 0 reactions 0 assignees View on GitHub
stale-issue
Dominant language
Python
Stars
14.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug
I am using SAINTSampler to get the subgraph,But I don't want to relabel the node id.I set \
`sg = g.subgraph(
node_ids, relabel_nodes=False, output_device=self.output_device
)`
And the sampler failed to sample correct nodes.
![屏幕截图 2023-12-25 121006](https://github.com/dmlc/dgl/assets/48644550/d37437df-ee4f-44d3-baf0-c9e6ce9b48a9)

## To Reproduce

Steps to reproduce the behavior:

1.Chang the sample function in `graphsaint.py` to
![屏幕截图 2023-12-25 121227](https://github.com/dmlc/dgl/assets/48644550/d748faed-3d00-4771-80d4-b9f7735c5ad1)

2.Use SAINTSampler to sampler the
```python
g = dgl.data.CoraGraphDataset()[0]
sampler = SAINTSampler(mode="walk",budget=(10,10))
data_loader = dgl.dataloading.DataLoader(g,torch.arange(g.number_of_nodes()),sampler,
batch_size=batch_size,shuffle=True,drop_last=False,num_workers=4)
for epoch in range(num_epoches):
for subg in data_loader:
print(subg.nodes())
```

3.And result of the sampler is
![屏幕截图 2023-12-25 121006](https://github.com/dmlc/dgl/assets/48644550/dbcc2450-f82c-4e39-a3a8-74b0cf751547)

## Expected behavior

The sampler result should be the original node id.But the sampler samples the whole node of the graph.
The correct result should be:
![屏幕截图 2023-12-25 122530](https://github.com/dmlc/dgl/assets/48644550/c2791a7a-1d63-4070-a2c8-3708ebbd2ff3)

## Environment

- DGL Version (1.1.2+cu117):
- Backend Library & Version (PyTorch 1.13.0+cu117):
- OS ( Linux):
- How you installed DGL (pip):
- Python version:(3.8.17)
- CUDA/cuDNN version (cuda 11.7):
- GPU models and configuration (V100):

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.