DistGraph: Get local and remote/halo nodes in each partition

I can get the total number of nodes in a partition from the json file created by the partition_grapy.py in the dist graphsage example.

How can I get the following information for each partition from DistGraph object?

  • Number of Local Nodes
  • Number of Remote Nodes
  • Which Remote Nodes belong to which partition?

Consider the following very simple example:

Number of Partitions: 3
Total nodes in partition 1: 0,1,2,3,4,5,6,7,8,9
Local nodes in partition 1: 0,1,2,3,4
Remote nodes in partition 1: 5,6,7,8,9

For partition 1:
Number of Local nodes: 5
Number of Remote nodes: 5
Nodes 5,6,7 belongs to partition 2
Nodes 8,9 belongs to partition 3

How to get this information from DistGraph?
How to get the feature vector or a node or multiple nodes from DistGraph?

@Rhett-Ying @zhengda1936 Can you assist please?

g.ndata['inner_node'] == True indicates local nodes. False Indicates remote nodes.

As for remote id to partition id, please refer to dgl.distributed — DGL 1.1.1 documentation. Here’s an example in test: https://github.com/dmlc/dgl/blob/a52be5c683cd491ee5f81d38670472017eecc481/tests/distributed/test_partition.py#L165-L169

@Rhett-Ying Thank you for your assistance.

Does g.ndata['inner_node'] == True gives a list/tensor of the local node id’s?

yes, the true masks indicates local node IDs

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.