CarloLucibello / GraphNeuralNetworks.jl

Graph Neural Networks in Julia
https://carlolucibello.github.io/GraphNeuralNetworks.jl/dev/
MIT License
210 stars 47 forks source link

Added Personalized PageRank Diffusion [`ppr_diffusion` function] #427

Closed rbSparky closed 5 days ago

rbSparky commented 3 months ago

Continues Issue #412, takes inspiration from DGL implementation

This PR introduces a new function, ppr_diffusion. It calculates Personalized PageRank (PPR) diffusion based on the edge weight matrix and updates the graph with new edge weights derived from the PPR matrix.

Implementation:

The function operates in several key steps:


A[dst, src] += w[idx]
A .*= (alpha_f32 - 1)

A[i, i] += 1

PPR = alpha_f32 * inv(A)

new_w = [PPR[dst, src] for (src, dst) in zip(s, t)]
rbSparky commented 3 months ago

Tests fail for

GATv2Conv: Test Failed at /home/runner/work/GraphNeuralNetworks.jl/GraphNeuralNetworks.jl/test/test_utils.jl:203

This should be checked, since this did not fail in the last commit and the only change in this commit was adding the reference paper.

rbSparky commented 3 months ago

Tests pass now, so the previous test fail was unrelated to this PR.

That should also be checked later.

rbSparky commented 1 month ago

Would this be GPU compatible now that non mutable operations are removed? Tested training and Zygote no longer gives single element operation error!

CarloLucibello commented 1 month ago

Let's have an implementation which works correctly with dense matrices on cpu and in later PRs we can add gpu support and add the sparse matrices performance optimization. So we are mostly fine with the current PR.

rbSparky commented 3 weeks ago

Let's have an implementation which works correctly with dense matrices on cpu and in later PRs we can add gpu support and add the sparse matrices performance optimization. So we are mostly fine with the current PR.

Should I change the code back to older commits where only dense matrices were used? Or would this be ok as it is?

CarloLucibello commented 1 week ago

bump. Also needs a rebase.

rbSparky commented 1 week ago

bump. Also needs a rebase.

done