How to convert graphs into blocks maintaining the same mapping

Hello, I currently have a question. I have some graphs sampled from my own project. Now, I want to convert the graphs into multiple blocks and then utilize other DGL algorithms. However, I’ve noticed that there seem to be some issues when transitioning the graph to blocks, even though my IDs start from 0 as continuous values. This results in discrepancies in the node relationships between the blocks. I would like to understand how to address this issue.
For example, I now provide some sampled data.

my_graph0:src=[5,7,2,3],dst=[0,1,4,6]
my_graph1:src=[4,6],dst=[0,1]

However, if I first generate the dgl graphs and then convert it into blocks, it becomes:

dgl_block_Layer 0:src=[4,5,6,7],dst=[0,1,2,3]
dgl_block_Layer 1:src=[2,3],dst=[0,1]

This leads to issues in information propagation across the blocks. I would like to know how to resolve this.

When transitioning the graphs to blocks, the nodes will be relabeled. You can get the original node ID of the source and destination nodes of the block with

block.srcdata[dgl.NID]
block.dstdata[dgl.NID]

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