melifluos / subgraph-sketching

code for Graph Neural Networks for Link Prediction with Subgraph Sketching https://arxiv.org/abs/2209.15486
Apache License 2.0
88 stars 14 forks source link

Possible mistake in ElphHashes #8

Open liulizhi1996 opened 1 year ago

liulizhi1996 commented 1 year ago

I think the following code is incorrect:

https://github.com/melifluos/subgraph-sketching/blob/3732cc75d8da216b41b972620dc545ff5aa1f6e1/src/hashing.py#L281-L282

It should be: features[:, 7] = cards1[:, 1] - torch.sum(features[:, 0:4], dim=1) - features[:, 5] # (2, 0)

liulizhi1996 commented 1 year ago

By the way, I think the Eq. (3) in the original paper is also wrong. The right equation should be: B_uv[d] = |Nd(u)| - \sum{i=1}^{d-1} Buv[i] - \sum{i=1}^{d} \sum_{j=1}^{d} A_uv[i, j] The difference between above and that in your paper is the summation of B_uv[i] where i from 1 to d-1.

shir994 commented 1 year ago

Hi @liulizhi1996. Thanks, indeed it seems that features[:, 0] should not be in this version of the code. I think you are also right about the missing summation in the equation. We will fix this along with a few other bugs in a coming PR.

lei-liu1 commented 1 year ago

Hello, I think there is also something wrong with Equation (2). Should it be this?

mathpix 2023-07-25 12-35-50

If I have a misunderstanding, please let me know. Best regards, Lei

liulizhi1996 commented 1 year ago

@lei-liu1 Perhaps you are right. Eqn.(2) is not correct in the original paper.