Standard scaled dot-product softmax attention, but only over the neighbours: dense attention would throw the graph away.
Examples
set.seed(9)
H <- matrix(rnorm(8), 4, 2)
adj <- list(`0` = 1L, `1` = c(0L, 2L), `2` = c(1L, 3L), `3` = 2L) # 0-based node ids
I2 <- diag(2)
morie_gtrf_attention(H, adj, I2, I2, I2)$output
#> [,1] [,2]
#> [1,] -0.8164583 -1.1868725
#> [2,] -0.5980441 0.6402577
#> [3,] -0.4299387 -0.3485765
#> [4,] -0.1415352 1.1919869
