Skip to main content
. 2026 Feb 23;16(2):333. doi: 10.3390/biom16020333
Algorithm 1: GraphSAGE embedding generation (i.e., forward propagation) algorithm
Input Graph G(V,ε); input features xv,∀v∈V; depth K; weight matrices Wk, ∀k∈1,...K ; non-linearity σ; differentiable aggregator functions AGGREGATEk, ∀ k ∈1,...K ; neighbourhood function N:v→2V
Output Vector representation zv for all v∈ V
1 hv0←xv,∀v∈V;
2 For k=1...K do
3 For v∈ V do
4 hN(v)k←AGGREGATEkhuk−1,∀u∈N(v),
5 hvk←σWk·CONCAThuk−1,hN(v)k,
6 end
7 hvk←hvk/hvk2,∀v∈V,
8 end
9 zv←hvk,,∀v∈V,