opengsl.data.preprocess

opengsl.data.preprocess.control_homophily(adj, labels, homophily)[source]

Control the homophily of original structure by adding edges. More ways to add perturbations will be implemented soon.

Parameters
  • adj (torch.tensor) – The original structure in sparse form.

  • labels (torch.tensor) – Ground truth labels.

  • homophily (float) – Homophily ratio.

Returns

new_adj – The perturbed structure in sparse form.

Return type

torch.tensor