dmlc / dmlc/dgl

Error occurs when sampling with edge_dir='out'. (Argument `rhs_nodes` must contain all the edge destination nodes.)

Open
#4,519 4 comments 0 reactions 1 assignee Claimed by @rudongyu View on GitHub
bug:confirmed
Dominant language
Python
Stars
14.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug

Get "Argument `rhs_nodes` must contain all the edge destination nodes." when get batch of nodes using sampler+dataloader.
When setting edge_dir='in', it is fine.

## To Reproduce

```python
import dgl
import numpy as np
import scipy as sp
import pdb

src = [0, 1, 2, 3, 4, 5]
dst = [4, 2, 1, 1, 5, 3]
etype_id = [2, 3, 1, 0, 1, 1]

n_nodes = 6
train_nid = [1, 2, 3]
coo = sp.sparse.coo_matrix((np.ones(len(src)), (src, dst)), shape=[
n_nodes, n_nodes])
g = dgl.from_scipy(coo)
nei_sample = dgl.dataloading.MultiLayerNeighborSampler(
[5, 5, 5], edge_dir='out')

dataloader = dgl.dataloading.DataLoader(
g, train_nid, nei_sample,
batch_size=2, shuffle=True, drop_last=False, num_workers=4)

loader_iter = iter(dataloader)
current = next(loader_iter)
```

## Expected behavior

How to fix the issue when the edge_dir='out' is needed.

## Environment

- DGL Version (0.9.0):
- Backend Library & Version (PyTorch 1.12.1):
- OS (, Linux):
- How you installed DGL (pip):
- Python version:3.9
- CUDA/cuDNN version (10.2):
- GPU models and configuration (Tesla V100-PCIE-16GB):

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.