Question about process of gathering node&edge features in partition_graph function

Hi, thank you very much for your time in reading my question. I have a question about how the partition_graph gathers the features of node/edge.
For the hetero-graph used to partition, I added the edata ‘src_idx’ represents the src_node_id of the corresponding edge. After partition, I found that some of the edata ‘src_idx’ were not in the right partition graph. For example, part1 graph has #src_node=400, then the number of unique value of ‘src_idx’ should be 400, but the true is the ‘src_idx’ has >400 unique value,which means edges in this partition have #src_node > 400, and this conflict with metadata. So I wonder if there is problem when gathering the features?

What’s more, when I read the code of the gathering part, I was a little bit confused about the meaning of ‘orig_id’ and EID/NID, as both of them are called global ID and continuous, what are the differences between them? Could anyone help me about this? I really appreciate it.


I think gathering should be correct and something may go wrong in your calculation. Besides that, pls note:

  1. HALO nodes are available in each partition, so you’ll see that partition.num_nodes() * num_parts > original_graph.num_nodes(). So you find more than 400 unique values. I assume you obtained such unique values from partition_graph.edata.
  2. orig_id is the ntype/etype-wise IDs in original graph(the one used for partition), while NID/EID are global ID in all partitioned graphs(just imagine we batch all these partitioned graph into one, but this is not the same as original graph as reshuffle is applied).

Please refer to 7.4 Advanced Graph Partitioning — DGL 0.9.1 documentation for more details.

If you still have concerns about the number, pls share the command for partition and the code you used to calculate unique values.

Thanks for you clarification. Yes, the HALO nodes in the partition makes the number of unique value not equal to the number of nodes from ndata. And I have a follow-up question. According to the reply in post When and how to fetch features on the remote machine, I tried to use the DistTensor to access the features of some HALO nodes, but I found that I could not use the global id to access the feature of HALO. I wonder there is any other way to get the feature of HALO by using the global id, or I need to do some transformations?

what’s the global ID you mean here? dgl.NID? And how do you instantiate DistTensor? The original graph is homogeneous or heterogenous?

You could refer to the testcases to see how to access via DistTensor: dgl/ at b2d38ca82c0f37848ca07902e19639a591a5014e · dmlc/dgl · GitHub

Please share more details if you still cannot figure it out.

Here the global ID means the original ID of the input whole heterogeneous graph. And I accessed DistTensor by initializing the DistGraph and using the DistGraph.nodes/DistGraph.edges. I thought I could use the these global IDs to gather the corresponding data, but it seemed that I need to use the local IDs of corresponding partition to gather the node/edge data I need. Anyway, the link helps me to figure it out :slight_smile: Thank you so much.

1 Like