torch_geometric.transforms.OneHotDegree

class OneHotDegree(max_degree: int, in_degree: bool = False, cat: bool = True)[source]

Bases: BaseTransform

Adds the node degree as one hot encodings to the node features (functional name: one_hot_degree).

Parameters:
  • max_degree (int) – Maximum degree.

  • in_degree (bool, optional) – If set to True, will compute the in-degree of nodes instead of the out-degree. (default: False)

  • cat (bool, optional) – Concat node degrees to node features instead of replacing them. (default: True)