dgl.dataloading

The dgl.dataloading package provides two privimitives to compose a data pipeline for loading from graph data. Sampler represents algorithms to generate subgraph samples from the original graph, and DataLoader represents the iterable over these samples.

DGL provides a number of built-in samplers that subclass Sampler. Creating new samplers follow the same paradigm. Read our user guide chapter Chapter 6: Stochastic Training on Large Graphs for more examples and explanations.

The entire package only works for PyTorch backend.

DataLoaders

DataLoader

Sampled graph data loader.

GraphDataLoader

Batched graph data loader.

NodeDataLoader

(DEPRECATED) Sampled graph data loader over a set of nodes.

EdgeDataLoader

(DEPRECATED) Sampled graph data loader over a set of edges.

DistNodeDataLoader

Sampled graph data loader over nodes for distributed graph storage.

DistEdgeDataLoader

Sampled graph data loader over edges for distributed graph storage.

Samplers

Sampler

Base class for graph samplers.

NeighborSampler

Sampler that builds computational dependency of node representations via neighbor sampling for multilayer GNN.

MultiLayerFullNeighborSampler

Sampler that builds computational dependency of node representations by taking messages from all neighbors for multilayer GNN.

ClusterGCNSampler

Cluster sampler from Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks

ShaDowKHopSampler

K-hop subgraph sampler from Deep Graph Neural Networks with Shallow Subgraph Samplers.

SAINTSampler

Random node/edge/walk sampler from GraphSAINT: Graph Sampling Based Inductive Learning Method

Sampler Transformations

as_edge_prediction_sampler(sampler[, …])

Create an edge-wise sampler from a node-wise sampler.

BlockSampler([prefetch_node_feats, …])

Base class for sampling mini-batches in the form of Message-passing Flow Graphs (MFGs).

Utility Class and Functions for Feature Prefetching

set_node_lazy_features

Assign lazy features to the ndata of the input graph for prefetching optimization.

set_edge_lazy_features

Assign lazy features to the edata of the input graph for prefetching optimization.

set_src_lazy_features

Assign lazy features to the srcdata of the input graph for prefetching optimization.

set_dst_lazy_features

Assign lazy features to the dstdata of the input graph for prefetching optimization.

LazyFeature

Placeholder for feature prefetching.