dmlc / dmlc/dgl

Adding top p sampling function in dgl.sampling

Open
#3,100 1 comment 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

Adding a sampling function which is able to select the neighboring edges with largest (or smallest) weights of a proportion (p) for the given nodes and return the induced subgraph. Similar to `dgl.sampling.select_topk`, but instead of fix number of neighboring edges (k), a proportion (p) is used in the sampling of the neighboring edges.

## Motivation
A developing model example [CARE-GNN](https://arxiv.org/pdf/2008.08692.pdf) includes the top p sampling (3.3.1 in the paper) described above. Under current setting, the top p sampling in the paper can only be implemented with for loop by nodes, which is low efficient.

## Alternatives
If DGLGraph.in_edges can return the neighboring edges for each given node separately (e.g., a list of neighboring edges ID Tensors), instead of a merged Tensor, this function can also be implemented relatively efficiently by user.

## Pitch
Adding a sampling function `dgl.sampling.select_top_p`.

## Additional context
N/A

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.