torch_geometric_signed_directed.utils.directed.get_magnetic_Laplacian

Functions

get_magnetic_Laplacian(edge_index[, edge_weight, ...])

Computes the magnetic Laplacian of the graph given by edge_index

Module Contents

get_magnetic_Laplacian(edge_index: torch.LongTensor, edge_weight: torch.Tensor | None = None, normalization: str | None = 'sym', dtype: int | None = None, num_nodes: int | None = None, q: float | None = 0.25, return_lambda_max: bool = False)

Computes the magnetic Laplacian of the graph given by edge_index and optional edge_weight from the MagNet: A Neural Network for Directed Graphs. paper.

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

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

  • normalization (str, optional) - The normalization scheme for the magnetic Laplacian (default: sym) -

    1. None: No normalization \(\mathbf{L} = \mathbf{D} - \mathbf{A} Hadamard \exp(i \Theta^{(q)})\)

    2. "sym": Symmetric normalization \(\mathbf{L} = \mathbf{I} - \mathbf{D}^{-1/2} \mathbf{A} \mathbf{D}^{-1/2} Hadamard \exp(i \Theta^{(q)})\)

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

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

  • q (float, optional) - The value q in the paper for phase.

  • return_lambda_max (bool, optional) - Whether to return the maximum eigenvalue. (default: False)

Return types:
  • edge_index (PyTorch LongTensor) - The edge indices of the magnetic Laplacian.

  • edge_weight.real, edge_weight.imag (PyTorch Tensor) - Real and imaginary parts of the one-dimensional edge weights for the magnetic Laplacian.

  • lambda_max (float, optional) - The maximum eigenvalue of the magnetic Laplacian, only returns this when required by setting return_lambda_max as True.