dgl.DGLHeteroGraph.canonical_etypes

DGLHeteroGraph.canonical_etypes

Return the list of canonical edge types of this graph.

A canonical edge type is a tuple of string (src_type, edge_type, dst_type).

Returns:
Return type:list of 3-tuples

Examples

>>> follows_g = dgl.graph([(0, 1), (1, 2)], 'user', 'follows')
>>> plays_g = dgl.bipartite([(0, 0), (1, 0), (1, 1), (2, 1)], 'user', 'plays', 'game')
>>> g = dgl.hetero_from_relations([follows_g, plays_g])
>>> g.canonical_etypes
[('user', 'follows', 'user'), ('user', 'plays', 'game')]