MetaPath2Vec sample function create none exist path
- Dominant language
- Python
- Stars
- 14.3k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
## 🐛 Bug
## To Reproduce
Steps to reproduce the behavior:
1. create a hetero graph

2. set meta path ['user-company', 'company-product', 'product-company', 'company-user']
3. create the MetaPath2Vec model
## Expected behavior
The function "sample" in the [MetaPath2Vec](https://github.com/dmlc/dgl/blob/master/python/dgl/nn/pytorch/network_emb.py) model will generate the random walk meta path, ex. [user_2, company_2, product_1, company_2, user_2].
According to the graph above, when the random walk walk to the node company 1, there are no product node connect to the node company 1, thus, it will generate path like [user_0, company_1 product_-1, company_-1, user_-1].
When the function map the local node id to the global node id, the -1 index will be map to the last node of that type, generating non-exist meta path.
For example
Global node index: user: [6, 7, 8], company: [0, 1, 2], product: [3, 4, 5]
The above path [user_0, company_1 product_-1, company_-1, user_-1]
will became [6, 1, 5, 2, 8], while the path [1, 5] does not exist.
## Environment
- DGL Version (e.g., 1.0): 1.0.2
- Backend Library & Version (e.g., PyTorch 0.4.1, MXNet/Gluon 1.3): 1.13.1
- OS (e.g., Linux): Linux
- How you installed DGL (`conda`, `pip`, source): pip
- Build command you used (if compiling from source):
- Python version: 3.9.16
- CUDA/cuDNN version (if applicable): cu117
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.