Unverified Commit 8d14a739 authored by Da Zheng's avatar Da Zheng Committed by GitHub
Browse files
parent 2dd114ed
...@@ -93,7 +93,8 @@ assert th.all(local_eid == eid) ...@@ -93,7 +93,8 @@ assert th.all(local_eid == eid)
assert th.all(subg0.edata[dgl.EID][local_eid] == eid) assert th.all(subg0.edata[dgl.EID][local_eid] == eid)
lsrc, ldst = subg0.find_edges(local_eid) lsrc, ldst = subg0.find_edges(local_eid)
gsrc, gdst = subg0.ndata[dgl.NID][lsrc], subg0.ndata[dgl.NID][ldst] gsrc, gdst = subg0.ndata[dgl.NID][lsrc], subg0.ndata[dgl.NID][ldst]
assert th.all(gsrc == lsrc) # The destination nodes are owned by the partition.
assert th.all(gdst == ldst)
# gdst which is not assigned into current partition is not required to equal ldst # gdst which is not assigned into current partition is not required to equal ldst
assert th.all(th.logical_or( assert th.all(th.logical_or(
gdst == ldst, subg0.ndata['inner_node'][ldst] == 0)) gdst == ldst, subg0.ndata['inner_node'][ldst] == 0))
...@@ -136,6 +137,19 @@ for partid in range(num_parts): ...@@ -136,6 +137,19 @@ for partid in range(num_parts):
node_map[ntype][partid, 0], node_map[ntype][partid, 1])) node_map[ntype][partid, 0], node_map[ntype][partid, 1]))
orig_node_ids[ntype].append(orig_type_nid[inner_node == 1]) orig_node_ids[ntype].append(orig_type_nid[inner_node == 1])
# Check the degree of the inner nodes.
inner_nids = th.nonzero(th.logical_and(subg_ntype == ntype_id, subg.ndata['inner_node']),
as_tuple=True)[0]
subg_deg = subg.in_degrees(inner_nids)
orig_nids = subg.ndata['orig_id'][inner_nids]
# Calculate the in-degrees of nodes of a particular node type.
glob_deg = th.zeros(len(subg_deg), dtype=th.int64)
for etype in hg.canonical_etypes:
dst_ntype = etype[2]
if dst_ntype == ntype:
glob_deg += hg.in_degrees(orig_nids, etype=etype)
assert np.all(glob_deg.numpy() == subg_deg.numpy())
# Check node data. # Check node data.
for name in hg.nodes[ntype].data: for name in hg.nodes[ntype].data:
local_data = node_feats[ntype + '/' + name][type_nid] local_data = node_feats[ntype + '/' + name][type_nid]
......
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