函数功能:以三元组的形式返回图中定义的边。
下面是官方给出的解释
Return all the canonical edge types in the graph.
A canonical edge type is a string triplet (str, str, str) for source node type, edge type and destination node type.
Returns
All the canonical edge type triplets in a list.
Return type
list[(str, str, str)]
举个例子
import dgl
import torch
g = dgl.heterograph({
('user', 'follows', 'user'): (torch.tensor([0, 1]), torch.tensor([1, 2])),
('user', 'follows', 'game'): (torch.tensor([0, 1, 2]), torch.tensor([1, 2, 3])),
('user', 'plays', 'game'): (torch.tensor([1, 3]), torch.tensor([2, 3]))
})
g.canonical_etypes
[('user', 'follows', 'user'),
('user', 'follows', 'game'),
('user', 'plays', 'game')]