Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageRank centrality computed by this codes maybe meaningless #4

Open
c747903646 opened this issue Apr 1, 2022 · 1 comment
Open
Assignees

Comments

@c747903646
Copy link

c747903646 commented Apr 1, 2022

drop weightis is computed according to the folllowing codes in pGRACE/functional.py :

`def pr_drop_weights(edge_index, aggr: str = 'sink', k: int = 10):
pv = compute_pr(edge_index, k=k)
pv_row = pv[edge_index[0]].to(torch.float32)
pv_col = pv[edge_index[1]].to(torch.float32)
s_row = torch.log(pv_row)
s_col = torch.log(pv_col)
if aggr == 'sink':
s = s_col
elif aggr == 'source':
s = s_row
elif aggr == 'mean':
s = (s_col + s_row) * 0.5
else:
s = s_col
weights = (s.max() - s) / (s.max() - s.mean())

return `

However, in debugging codes, I found that some elements in array pv could be 0 (while using WikiCS for training). After executed torch.log(), min value of s_row and s_col will be -inf, resulted in all of weights became 0. At that time, the weights was meaningless.

@Linyxus Linyxus self-assigned this Apr 3, 2022
@SXKDZ
Copy link
Member

SXKDZ commented Apr 25, 2022

Hi thanks for your question! We find that some nodes in the WikiCS do not have incoming edges. Therefore we slightly change the computation from edge centrality to removal weights as follows 𝑠_𝑒 = log(𝑤_𝑒 + 1) to avoid zero values when there are no incoming edges in directed graphs. Empicially we find that such a modification has no obvious impact to the performance. We will upload a new version to arXiv very soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants