PlanetAlign.algorithms.REGAL

class REGAL(k: int = 10, num_layers: int = 2, alpha: float = 0.01, gammastruc: float = 1, gammaattr: float = 1, buckets: int = 2, dtype: dtype = torch.float32)[source]

Bases: BaseModel

Embedding-based method REGAL for unsupervised pairwise attributed network alignment. REGAL is proposed by the paper: “REGAL: Representation Learning-based Graph Alignment.” in CIKM 2018.

Parameters:
  • k (int, optional) – Hyperparameter for tuning the number of landmarks. Default is 10.

  • num_layers (int, optional) – Number of layers for the neighborhood when generating structural embeddings. Default is 2.

  • alpha (float, optional) – Hyperparameter for the decay factor of the structural embedding. Default is 0.01.

  • gammastruc (float, optional) – Weight for the structural similarity. Default is 1.

  • gammaattr (float, optional) – Weight for the attribute similarity. Default is 1.

  • buckets (int, optional) – Number of buckets for the structural embedding learning. Default is 2.

  • dtype (torch.dtype, optional) – Data type of the tensors, choose from torch.float32 or torch.float64. Default is torch.float32.

test(dataset: Dataset, gids: List[int] | Tuple[int, ...], metrics: tuple[str] | list[str] = None)
Parameters:
  • dataset (Dataset) – The dataset containing the graphs to be aligned and the training/test data.

  • gids (list[int] or tuple[int, ...]) – The indices of the graphs in the dataset to be aligned.

  • metrics (tuple[str] or list[str], optional) – The metrics to be computed after alignment. Default is None, which computes Hits@K (K=1, 10, 30, 50) and MRR metrics.

train(dataset: Dataset, gid1: int, gid2: int, use_attr: bool = True, save_log: bool = True, verbose: bool = True)[source]
Parameters:
  • dataset (Dataset) – The dataset containing the graphs to be aligned and the training/test data.

  • gid1 (int) – The index of the first graph in the dataset to be aligned.

  • gid2 (int) – The index of the second graph in the dataset to be aligned.

  • use_attr (bool, optional) – Whether to use node and edge attributes for alignment. Default is True.

  • save_log (bool, optional) – Whether to save the log of the training process. Default is True.

  • verbose (bool, optional) – Whether to print the progress during training. Default is True.