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 + 1ofedge_index. (default:None)sort_by_row (bool, optional) – If set to
False, will sortedge_indexcolumn-wise.
- Return type:
LongTensorifedge_attrisNone, else (LongTensor,TensororList[Tensor]])