gammagl.utils.remove_self_loops

class remove_self_loops(edge_index, edge_attr=None)[source]

Removes every self-loop in the graph given by edge_index, so that \((i,i) \not\in \mathcal{E}\) for every \(i \in \mathcal{V}\).

Parameters:
  • edge_index (tensor) – The edge indices.

  • edge_attr (tensor, optional) – Edge weights or multi-dimensional edge features. (default: None)

Returns:

|| np.ndarray if edge_index inputted is np.ndarray

Return type:

Tensor if edge_index inputted is Tensor