torch_geometric_signed_directed.utils.directed.get_adjs_DiGCN

Functions

fast_appr_power(A[, alpha, max_iter, tol, personalize])

Computes the fast pagerank adjacency matrix of the graph from the

cal_fast_appr(→ Tuple[torch.LongTensor, torch.FloatTensor])

Computes the fast approximate pagerank adjacency matrix of the graph given by edge_index

get_appr_directed_adj(→ Tuple[torch.LongTensor, ...)

Computes the approximate pagerank adjacency matrix of the graph given by edge_index

get_second_directed_adj(→ Tuple[torch.LongTensor, ...)

Computes the second-order proximity matrix of the graph given by edge_index

Module Contents

fast_appr_power(A, alpha=0.1, max_iter=100, tol=1e-06, personalize=None)

Computes the fast pagerank adjacency matrix of the graph from the Directed Graph Contrastive Learning paper.

Arg types:
  • A (sp.csr_matrix) - Sparse adjacency matrix.

  • alpha (float, optional) -alpha used in page rank. Default 0.1.

  • max_iter (int -Maximum number of iterations. Default 100.

  • tol (flot, optional) -Tolerance. Default 1e-6.

  • personalize (array, optional) -if not None, should be an array with the size of the nodes containing probability distributions. It will be normalized automatically. Default None.

Return types:

PageRank Scores for the nodes.

cal_fast_appr(alpha: float, edge_index: torch.LongTensor, num_nodes: int | None, dtype: torch.dtype, edge_weight: torch.FloatTensor | None = None) Tuple[torch.LongTensor, torch.FloatTensor]

Computes the fast approximate pagerank adjacency matrix of the graph given by edge_index and optional edge_weight from the Directed Graph Contrastive Learning paper.

Arg types:
  • alpha (float) -alpha used in approximate personalized page rank.

  • edge_index (PyTorch LongTensor) -The edge indices.

  • num_nodes (int or None) -The number of nodes, i.e. max_val + 1 of edge_index.

  • dtype (torch.dtype) -The desired data type of returned tensor in case edge_weight=None.

  • edge_weight (PyTorch Tensor, optional) -One-dimensional edge weights. (default: None)

Return types:
  • edge_index (PyTorch LongTensor) -The edge indices of the approximate page-rank matrix.

  • edge_weight (PyTorch Tensor) -One-dimensional edge weights of the approximate page-rank matrix.

get_appr_directed_adj(alpha: float, edge_index: torch.LongTensor, num_nodes: int | None, dtype: torch.dtype, edge_weight: torch.FloatTensor | None = None) Tuple[torch.LongTensor, torch.FloatTensor]

Computes the approximate pagerank adjacency matrix of the graph given by edge_index and optional edge_weight from the Digraph Inception Convolutional Networks paper.

Arg types:
  • alpha (float) -alpha used in approximate personalized page rank.

  • edge_index (PyTorch LongTensor) -The edge indices.

  • num_nodes (int or None) -The number of nodes, i.e. max_val + 1 of edge_index.

  • dtype (torch.dtype) -The desired data type of returned tensor in case edge_weight=None.

  • edge_weight (PyTorch Tensor, optional) -One-dimensional edge weights. (default: None)

Return types:
  • edge_index (PyTorch LongTensor) -The edge indices of the approximate page-rank matrix.

  • edge_weight (PyTorch Tensor) -One-dimensional edge weights of the approximate page-rank matrix.

get_second_directed_adj(edge_index: torch.LongTensor, num_nodes: int | None, dtype: torch.dtype, edge_weight: torch.FloatTensor | None = None) Tuple[torch.LongTensor, torch.FloatTensor]

Computes the second-order proximity matrix of the graph given by edge_index and optional edge_weight from the Digraph Inception Convolutional Networks paper.

Arg types:
  • edge_index (PyTorch LongTensor) -The edge indices.

  • num_nodes (int or None) -The number of nodes, i.e. max_val + 1 of edge_index.

  • dtype (torch.dtype) -The desired data type of returned tensor in case edge_weight=None.

  • edge_weight (PyTorch Tensor, optional) -One-dimensional edge weights. (default: None)

Return types:
  • edge_index (PyTorch LongTensor) -The edge indices of the approximate page-rank matrix.

  • dge_weight (PyTorch Tensor) -One-dimensional edge weights of the approximate page-rank matrix.