torch_geometric_signed_directed.utils.general.in_out_degree

Functions

in_out_degree(→ torch.Tensor)

Get the in degrees and out degrees of nodes

Module Contents

in_out_degree(edge_index: torch.LongTensor, size: int | None = None, signed: bool = False, edge_weight: torch.FloatTensor | None = None) torch.Tensor

Get the in degrees and out degrees of nodes

Arg types:
  • edge_index (torch.LongTensor) The edge index from a torch geometric data / DirectedData object .

  • size (int) - The node number.

  • signed (bool, optional) - Whether to take into account signed edge weights and to return signed 4D features. Defualt is False and to only account for absolute degrees.

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

Return types:
  • degree (Torch.Tensor) - The degree matrix (|V|*2) when signed=False, otherwise the degree matrix (|V|*4) with in-pos, in-neg, out-pos, out-neg degrees.