torch_geometric.transforms.AddRandomWalkPE

class AddRandomWalkPE(walk_length: int, attr_name: Optional[str] = 'random_walk_pe')[source]

Bases: BaseTransform

Adds the random walk positional encoding from the “Graph Neural Networks with Learnable Structural and Positional Representations” paper to the given graph (functional name: add_random_walk_pe).

Parameters:
  • walk_length (int) – The number of random walk steps.

  • attr_name (str, optional) – The attribute name of the data object to add positional encodings to. If set to None, will be concatenated to data.x. (default: "random_walk_pe")