spamosaic.architectures.wlgcn.sym_norm

spamosaic.architectures.wlgcn.sym_norm(edge_index: torch.Tensor, num_nodes: int, edge_weight: Optional[Union[Any, torch.Tensor]] = None, improved: Optional[bool] = False, dtype: Optional[Any] = None) List[source]

Compute the symmetric normalized adjacency matrix with optional edge weights.

Parameters:
  • edge_index (torch.Tensor) – The edge indices of the graph (2, num_edges).

  • num_nodes (int) – Number of nodes in the graph.

  • edge_weight (torch.Tensor, optional) – Edge weights corresponding to edge_index. If None, assumes unweighted graph.

  • improved (bool, optional) – Whether to use improved self-loops (value=2 instead of 1). Default is False.

  • dtype (torch.dtype, optional) – Data type for the output tensor.

Returns:

  • edge_index (torch.Tensor) – Edge indices with added self-loops.

  • norm (torch.Tensor) – Normalized edge weights.