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

Function test_adj

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

Source from the content-addressed store, hash-verified

713)
714@parametrize_idtype
715def test_adj(idtype):
716 g = create_test_heterograph(idtype)
717 adj = g.adj("follows")
718 assert F.asnumpy(adj.indices()).tolist() == [[0, 1], [1, 2]]
719 assert np.allclose(F.asnumpy(adj.val), np.array([1, 1]))
720 g.edata["h"] = {("user", "plays", "game"): F.tensor([1, 2, 3, 4])}
721 print(g.edata["h"])
722 adj = g.adj("plays", "h")
723 assert F.asnumpy(adj.indices()).tolist() == [[0, 1, 2, 1], [0, 0, 1, 1]]
724 assert np.allclose(F.asnumpy(adj.val), np.array([1, 2, 3, 4]))
725
726
727@parametrize_idtype

Callers

nothing calls this directly

Calls 4

adjMethod · 0.80
asnumpyMethod · 0.80
create_test_heterographFunction · 0.70
indicesMethod · 0.45

Tested by

no test coverage detected