MCPcopy
hub / github.com/dmlc/dgl / create_test_heterograph

Function create_test_heterograph

tests/python/common/test_heterograph.py:24–45  ·  view source on GitHub ↗
(idtype)

Source from the content-addressed store, hash-verified

22
23
24def create_test_heterograph(idtype):
25 # test heterograph from the docstring, plus a user -- wishes -- game relation
26 # 3 users, 2 games, 2 developers
27 # metagraph:
28 # ('user', 'follows', 'user'),
29 # ('user', 'plays', 'game'),
30 # ('user', 'wishes', 'game'),
31 # ('developer', 'develops', 'game')])
32
33 g = dgl.heterograph(
34 {
35 ("user", "follows", "user"): ([0, 1], [1, 2]),
36 ("user", "plays", "game"): ([0, 1, 2, 1], [0, 0, 1, 1]),
37 ("user", "wishes", "game"): ([0, 2], [1, 0]),
38 ("developer", "develops", "game"): ([0, 1], [0, 1]),
39 },
40 idtype=idtype,
41 device=F.ctx(),
42 )
43 assert g.idtype == idtype
44 assert g.device == F.ctx()
45 return g
46
47
48def create_test_heterograph1(idtype):

Callers 15

test_createFunction · 0.70
test_queryFunction · 0.70
test_adjFunction · 0.70
test_adj_externalFunction · 0.70
test_incFunction · 0.70
test_viewFunction · 0.70
test_view1Function · 0.70
test_flattenFunction · 0.70
test_to_deviceFunction · 0.70
test_pin_memory_Function · 0.70
test_convertFunction · 0.70
test_to_homo2Function · 0.70

Calls 1

ctxMethod · 0.45

Tested by

no test coverage detected