AddEdge

class dgl.transforms.AddEdge(ratio=0.2)[source]

Bases: dgl.transforms.module.BaseTransform

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

Parameters

ratio (float, optional) – Number of edges to add divided by the number of existing edges.

Example

>>> import dgl
>>> from dgl import AddEdge
>>> transform = AddEdge()
>>> g = dgl.rand_graph(5, 20)
>>> new_g = transform(g)
>>> print(new_g.num_edges())
24