About dgl.metapath_reachable_graph

According to the docs ,metapath is in the form of a list of edge types.
However,there will be a mistake in this case:
data_dict = { … (‘user’, ‘follows’, ‘user’): (torch.tensor([0, 1]), torch.tensor([1, 2])), … (‘user’, ‘follows’, ‘topic’): (torch.tensor([1, 1]), torch.tensor([1, 2])), … (‘user’, ‘plays’, ‘game’): (torch.tensor([0, 3]), torch.tensor([3, 4])) … }
g = dgl.heterograph(data_dict)
g1=dgl.metapath_reachable_graph(g, [‘follows’])

What should I do if I want to tackle this problem?

specify the canonical etypes(tuple).

import dgl g = dgl.heterograph({ ('A', 'F', 'B'): ([0, 1, 2], [1, 2, 3]), ('B', 'F', 'A'): ([1, 2, 3], [0, 1, 2])}) new_g = dgl.metapath_reachable_graph(g, [('A', 'F', 'B'), ('B', 'F', 'A')]) print(new_g.edges(order='eid'))

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.