dmlc / dmlc/dgl

[FEA] Support a list of integers for fanout in graph.sample_neighbors

Open
#4,326 5 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
Python
Stars
14.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

## 🚀 Feature

Currently, in `sample_neigbours` we only support a single fanout value (see [link](https://github.com/dmlc/dgl/blob/86c81b4e927d94ed2dba76fc04e2088c6931e6b5/python/dgl/sampling/neighbor.py#L176-L181)), i think it will be useful to look into a way of supporting a list of values with the same call .

## Motivation

Currently, in sample blocks (see below), we iterate for each value of `fanout.` Though this approach works when the data is present locally when we want to do this through an external service (say something like `GAAS`) this can become a bottleneck as we will need to transfer graphs back and forth from the service for each value of fanout.

This will mean we do a bunch of calls like below which can become really slow.
```
External Sampling Process -> Training Process -> External Sampling Process -> .....
```


https://github.com/dmlc/dgl/blob/d41d07d0f6cbed17993644b58057e280a9e8f011/python/dgl/dataloading/neighbor_sampler.py#L106-L120

## Alternatives

The other alternative will be to write a `NeighborSampler` specific to graph-store objects like `GAASStore` where we don't want to do this back and forth .

## Additional context

TODO: Add benchmark

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.