cynricfu / MECCH

MECCH: Metapath Context Convolution-based Heterogeneous Graph Neural Networks
21 stars 1 forks source link

metapath context construction #1

Closed Brown-yang closed 1 day ago

Brown-yang commented 5 months ago

In your code, i want to ask u where are your metapath context construction part?

def get_metapath_g(g, args):

Generate the metapath neighbor graphs of all possible metapaths

# and integrate them into one dgl.DGLGraph -- metapath_g
all_metapaths_dict = get_all_metapaths(g, max_length=args.max_mp_length)
all_metapaths_list = metapath_dict2list(all_metapaths_dict)
metapath_g = None
for mp in all_metapaths_list:
    metapath_g = add_metapath_connection(g, mp, metapath_g)
# copy features and labels
metapath_g.ndata["x"] = g.ndata["x"]
metapath_g.ndata["y"] = g.ndata["y"]
# select only max-length metapath
selected_metapaths = select_metapaths(all_metapaths_list, length=args.max_mp_length)

return metapath_g, selected_metapaths

get_metapath_g is the metapath context construction?

cynricfu commented 5 months ago

Yes, get_metapath_g is the function used to construct metapath contexts.

The constructed structures are a bit different from the paper. Since MECCH adopts mean graph pooling to encode metapath contexts, get_metapath_g only needs to extract metapath neighbor graphs for all (sub-)metapaths.