I have run metapath2vec on a heterograph and am able to successfully generate embeddings for different node types. The problem is I don’t know how to map the rows of the embedding to specific nodes in my graph. The model has local_to_global_nid, but these IDs appear to be generated on the fly and I’m not sure how they map to my original node IDs. Can someone suggest how I can relate the rows of my embedding to individual nodes in my input graph? Thanks!
Hi @davidfstein . The metapath2dev model flattens all heterogeneous node embeddings of a graph to a single embedding table. The local_to_global_id map indicates how each original node map to the row ID of the big embedding table. By iterating the local_to_global_id map, you can construct the information of each row of the embedding table, e.g., node type and original node ID.
Hi @czkkkkkk , thanks for your reply. I figured something like that was happening, but I’m still not sure how to go from the global IDs to my original IDs. The original IDs do not appear to be in the local_to_global_id dict. Could you possibly give an example?
Sure. You can simply iterate over the local_to_global_id dict. For example, if local_to_global_id[ntype][nid] = gid
, it means the gid
row of the embedding table represents a local node with node type ntype
and id nid
.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.