gammagl.utils.sort_edge_index

class sort_edge_index(edge_index, edge_attr=None, num_nodes=None, sort_by_row: bool = True)[source]

Row-wise sorts edge_index.

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

  • edge_attr (tensor, list[tensor], optional) – Edge weights or multi- dimensional edge features. If given as a list, will re-shuffle and remove duplicates for all its entries. (default: None)

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

  • sort_by_row (bool, optional) – If set to False, will sort edge_index column-wise.

Return type:

LongTensor if edge_attr is None, else (LongTensor, Tensor or List[Tensor]])