DropEdgeΒΆ
-
class
dgl.transforms.
DropEdge
(p=0.5)[source]ΒΆ Bases:
dgl.transforms.module.BaseTransform
Randomly drop edges, as described in DropEdge: Towards Deep Graph Convolutional Networks on Node Classification and Graph Contrastive Learning with Augmentations.
- Parameters
p (float, optional) β Probability of an edge to be dropped.
Example
>>> import dgl >>> import torch >>> from dgl import DropEdge
>>> transform = DropEdge() >>> g = dgl.rand_graph(5, 20) >>> g.edata['h'] = torch.arange(g.num_edges()) >>> new_g = transform(g) >>> print(new_g) Graph(num_nodes=5, num_edges=12, ndata_schemes={} edata_schemes={'h': Scheme(shape=(), dtype=torch.int64)}) >>> print(new_g.edata['h']) tensor([0, 1, 3, 7, 8, 10, 11, 12, 13, 15, 18, 19])