Unverified Commit e156331b authored by chwan-rice's avatar chwan-rice Committed by GitHub
Browse files

return a list of ntypes/etypes (#2742)


Co-authored-by: default avatarDa Zheng <zhengda1936@gmail.com>
parent 85231dc9
...@@ -113,6 +113,7 @@ def load_partition(part_config, part_id): ...@@ -113,6 +113,7 @@ def load_partition(part_config, part_id):
assert EID in graph.edata, "the partition graph should contain edge mapping to global edge ID" assert EID in graph.edata, "the partition graph should contain edge mapping to global edge ID"
gpb, graph_name, ntypes, etypes = load_partition_book(part_config, part_id, graph) gpb, graph_name, ntypes, etypes = load_partition_book(part_config, part_id, graph)
ntypes_list, etypes_list = [], []
for ntype in ntypes: for ntype in ntypes:
ntype_id = ntypes[ntype] ntype_id = ntypes[ntype]
# graph.ndata[NID] are global homogeneous node IDs. # graph.ndata[NID] are global homogeneous node IDs.
...@@ -122,6 +123,7 @@ def load_partition(part_config, part_id): ...@@ -122,6 +123,7 @@ def load_partition(part_config, part_id):
partids2 = gpb.nid2partid(per_type_nids, ntype) partids2 = gpb.nid2partid(per_type_nids, ntype)
assert np.all(F.asnumpy(partids1 == part_id)), 'load a wrong partition' assert np.all(F.asnumpy(partids1 == part_id)), 'load a wrong partition'
assert np.all(F.asnumpy(partids2 == part_id)), 'load a wrong partition' assert np.all(F.asnumpy(partids2 == part_id)), 'load a wrong partition'
ntypes_list.append(ntype)
for etype in etypes: for etype in etypes:
etype_id = etypes[etype] etype_id = etypes[etype]
# graph.edata[EID] are global homogeneous edge IDs. # graph.edata[EID] are global homogeneous edge IDs.
...@@ -131,7 +133,8 @@ def load_partition(part_config, part_id): ...@@ -131,7 +133,8 @@ def load_partition(part_config, part_id):
partids2 = gpb.eid2partid(per_type_eids, etype) partids2 = gpb.eid2partid(per_type_eids, etype)
assert np.all(F.asnumpy(partids1 == part_id)), 'load a wrong partition' assert np.all(F.asnumpy(partids1 == part_id)), 'load a wrong partition'
assert np.all(F.asnumpy(partids2 == part_id)), 'load a wrong partition' assert np.all(F.asnumpy(partids2 == part_id)), 'load a wrong partition'
return graph, node_feats, edge_feats, gpb, graph_name, ntypes, etypes etypes_list.append(etype)
return graph, node_feats, edge_feats, gpb, graph_name, ntypes_list, etypes_list
def load_partition_book(part_config, part_id, graph=None): def load_partition_book(part_config, part_id, graph=None):
''' Load a graph partition book from the partition config file. ''' Load a graph partition book from the partition config file.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment