I need to create partitioned DGL graphs for a personal project. However, I do not need the HALO vertices included in the partitions. I am trying to partition the Products graph with num_hops=0. The script I am using for this is given here -
import dgl
import torch as th
from ogb.nodeproppred import DglNodePropPredDataset
data = DglNodePropPredDataset(name='ogbn-products')
graph, labels = data[0]
labels = labels[:, 0]
graph.ndata['labels'] = labels
splitted_idx = data.get_idx_split()
train_nid, val_nid, test_nid = splitted_idx['train'], splitted_idx['valid'], splitted_idx['test']
train_mask = th.zeros((graph.number_of_nodes(),), dtype=th.bool)
train_mask[train_nid] = True
val_mask = th.zeros((graph.number_of_nodes(),), dtype=th.bool)
val_mask[val_nid] = True
test_mask = th.zeros((graph.number_of_nodes(),), dtype=th.bool)
test_mask[test_nid] = True
graph.ndata['train_mask'] = train_mask
graph.ndata['val_mask'] = val_mask
graph.ndata['test_mask'] = test_mask
dgl.distributed.partition_graph(graph, graph_name='ogbn-products', num_parts=32, num_hops=0,
out_path='32part_data_products',
balance_ntypes=graph.ndata['train_mask'],
balance_edges=True)
However, I encounter the following error -
Traceback (most recent call last):
File "partition-graph.py", line 22, in <module>
dgl.distributed.partition_graph(graph, graph_name='ogbn-products', num_parts=32, num_hops=0,
File "/data/pranjaln/anaconda3/envs/venv/lib/python3.8/site-packages/dgl/distributed/partition.py", line 997, in partition_graph
assert val[-1] == g.num_edges(etype)
AssertionError
Is there a way to go about this error with num_hops=0? Or with num_hops=1, can we load back only the independent partition without the HALO nodes? Any help would be highly appreciated.