Some questions w.r.t Pm_Pd in LGNN

Hi, I have two questions w.r.t Pm_Pd implemented in DGL-LGNN. I read the original paper, and think the matrices pm and pd should be the forms in this link, respectively. So what the form is Pm_Pd in DGL since it is loaded from a pickel file in the source code?
Another question is in LGNN:

def forward(self, g, lg, pm_pd):

pm_pd is shown directly to forward method rather than computed in the feed forward process, then pm_pd should be batched before training. We can view a batched graph as several unlinked graphs, however as an example, when batch process pm, it seems each pm of the unlinked graphs should be a block in the huge matrix, which could be implemented with torch.block_diag. Finally the batched Pm matrix is a block matrix. Is that right?

pm_pd is shown directly to forward method rather than computed in the feed forward process, then pm_pd should be batched before training.

I think you are right and this happens here.

We can view a batched graph as several unlinked graphs, however as an example, when batch process pm , it seems each pm of the unlinked graphs should be a block in the huge matrix, which could be implemented with torch.block_diag . Finally the batched Pm matrix is a block matrix. Is that right?

I think the code used scipy.sparse.block_diag, which should be similar to torch.block_diag. Why is it a block matrix? I think pm_pd is a block diagonal matrix?

I believe Pm_Pd in the tutorial example is constructed as you described in the other post. Please take SBM dataset as a reference for how to compute Pm_Pd.

Yes, what I mean is a block diagonal matrix. Thank you very much.

Thank you very much, but pm_pd is a single matrix, I don’t know which operation should be applied on the pm and pd matrix.

We first concatenate Pm and Pd along the row dimension to get the pm_pd matrix.

Thank you for your response. I think pm_pd matrix is not generated by concatenating Pm and Pd along their row dimensions. As the docs shows,

import dgl

train_set = dgl.data.CoraBinary()
G1, pmpd1, label1 = train_set[1]

we could obtain the pm_pdmatrix.

print(pmpd1.toarray().shape)  # (689, 2684)
print(G1.num_nodes())  # 689
print(G1.num_edges())  # 2684

According to the original paper, pm and pd should be matrices whose shapes are both (num_nodes, num_edges).