()
| 696 | # Disabled since everything will be on heterogeneous graphs |
| 697 | @unittest.skipIf(F._default_context_str == "gpu", reason="GPU not implemented") |
| 698 | def test_partition_with_halo(): |
| 699 | g = create_large_graph(1000) |
| 700 | node_part = np.random.choice(4, g.num_nodes()) |
| 701 | subgs, _, _ = dgl.transforms.partition_graph_with_halo( |
| 702 | g, node_part, 2, reshuffle=True |
| 703 | ) |
| 704 | for part_id, subg in subgs.items(): |
| 705 | node_ids = np.nonzero(node_part == part_id)[0] |
| 706 | lnode_ids = np.nonzero(F.asnumpy(subg.ndata["inner_node"]))[0] |
| 707 | orig_nids = F.asnumpy(subg.ndata["orig_id"])[lnode_ids] |
| 708 | assert np.all(np.sort(orig_nids) == node_ids) |
| 709 | assert np.all( |
| 710 | F.asnumpy(subg.in_degrees(lnode_ids)) |
| 711 | == F.asnumpy(g.in_degrees(orig_nids)) |
| 712 | ) |
| 713 | assert np.all( |
| 714 | F.asnumpy(subg.out_degrees(lnode_ids)) |
| 715 | == F.asnumpy(g.out_degrees(orig_nids)) |
| 716 | ) |
| 717 | |
| 718 | |
| 719 | @unittest.skipIf(os.name == "nt", reason="Do not support windows yet") |
no test coverage detected