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

Function test_edges_order

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

Source from the content-addressed store, hash-verified

2570
2571@parametrize_idtype
2572def test_edges_order(idtype):
2573 # (0, 2), (1, 2), (0, 1), (0, 1), (2, 1)
2574 g = dgl.graph(
2575 (np.array([0, 1, 0, 0, 2]), np.array([2, 2, 1, 1, 1])),
2576 idtype=idtype,
2577 device=F.ctx(),
2578 )
2579
2580 print(g.formats())
2581 src, dst = g.all_edges(order="srcdst")
2582 assert F.array_equal(src, F.tensor([0, 0, 0, 1, 2], dtype=idtype))
2583 assert F.array_equal(dst, F.tensor([1, 1, 2, 2, 1], dtype=idtype))
2584
2585
2586@parametrize_idtype

Callers

nothing calls this directly

Calls 4

all_edgesMethod · 0.80
graphMethod · 0.45
ctxMethod · 0.45
formatsMethod · 0.45

Tested by

no test coverage detected