(idtype)
| 2570 | |
| 2571 | @parametrize_idtype |
| 2572 | def 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 |