dgl.transforms

Transform for structures and features

BaseTransform

An abstract class for writing transforms.

Compose

Create a transform composed of multiple transforms in sequence.

AddSelfLoop

Add self-loops for each node in the graph and return a new graph.

RemoveSelfLoop

Remove self-loops for each node in the graph and return a new graph.

AddReverse

Add a reverse edge \((i,j)\) for each edge \((j,i)\) in the input graph and return a new graph.

ToSimple

Convert a graph to a simple graph without parallel edges and return a new graph.

LineGraph

Return the line graph of the input graph.

KHopGraph

Return the graph whose edges connect the \(k\)-hop neighbors of the original graph.

AddMetaPaths

Add new edges to an input graph based on given metapaths, as described in Heterogeneous Graph Attention Network.

GCNNorm

Apply symmetric adjacency normalization to an input graph and save the result edge weights, as described in Semi-Supervised Classification with Graph Convolutional Networks.

PPR

Apply personalized PageRank (PPR) to an input graph for diffusion, as introduced in The pagerank citation ranking: Bringing order to the web.

HeatKernel

Apply heat kernel to an input graph for diffusion, as introduced in Diffusion kernels on graphs and other discrete structures.

GDC

Apply graph diffusion convolution (GDC) to an input graph, as introduced in Diffusion Improves Graph Learning.

NodeShuffle

Randomly shuffle the nodes.

DropNode

Randomly drop nodes, as described in Graph Contrastive Learning with Augmentations.

DropEdge

Randomly drop edges, as described in DropEdge: Towards Deep Graph Convolutional Networks on Node Classification and Graph Contrastive Learning with Augmentations.

AddEdge

Randomly add edges, as described in Graph Contrastive Learning with Augmentations.

RandomWalkPE

Random Walk Positional Encoding, as introduced in Graph Neural Networks with Learnable Structural and Positional Representations

LaplacianPE

Laplacian Positional Encoding, as introduced in Benchmarking Graph Neural Networks

FeatMask

Randomly mask columns of the node and edge feature tensors, as described in Graph Contrastive Learning with Augmentations.

RowFeatNormalizer

Row-normalizes the features given in node_feat_names and edge_feat_names.

SIGNDiffusion

The diffusion operator from SIGN: Scalable Inception Graph Neural Networks