dmlc / dmlc/dgl

[Feat request] G.all_edges support order='dst'

Open
#3,337 6 comments 0 reactions 1 assignee Claimed by @Rhett-Ying View on GitHub
feature request
Dominant language
Python
Stars
14.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

## 🚀 Feature

When using G.all_edges, only 3 types of ordering are supported: None, 'eid', 'srcdst'.
Request: Add the option order='dst', if it is easy to do so.

## Motivation

I need to calculate:
```
uid, vid = G.all_edges(form='uv', order=None, etype=etype)
unique_vid = torch.unique(vid)
```
But torch.unique is 20% of the computation of my whole function, and torch.unique_consecutive is 10x faster.
torch.unique_consecutive assumes that the vector is already sorted, so if G.all_edges could already provide sorted vid at minimal cost, the function would be 18% faster.

## Additional context

I couldn't find the documentation of G.all_edges in the website for versions after 0.6.x.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.