dgl.sampling
The dgl.sampling
package contains operators and utilities for
sampling from a graph via random walks, neighbor sampling, etc. They
are typically used together with the DataLoader
s in the
dgl.dataloading
package. The user guide Chapter 6: Stochastic Training on Large Graphs
gives a holistic explanation on how different components work together.
Random walk
|
Generate random walk traces from an array of starting nodes based on the given metapath. |
|
Generate random walk traces from an array of starting nodes based on the node2vec model. |
|
Pack the padded traces returned by |
Neighbor sampling
|
Sample neighboring edges of the given nodes and return the induced subgraph. |
|
Sampler that builds computational dependency of node representations via labor sampling for multilayer GNN from the NeurIPS 2023 paper Layer-Neighbor Sampling -- Defusing Neighborhood Explosion in GNNs |
|
Sample neighboring edges of the given nodes and return the induced subgraph, where each neighbor's probability to be picked is determined by its tag. |
|
Select the neighboring edges with k-largest (or k-smallest) weights of the given nodes and return the induced subgraph. |
|
PinSAGE-like neighbor sampler. |
Negative sampling
|
Performs negative sampling, which generate source-destination pairs such that edges with the given type do not exist. |