Algorithm 1 of Hamilton et al. 2017 for a single depth: aggregate
the neighbourhood, concatenate with the node's own previous
representation, linear transform with ReLU, optionally L2-normalise.
Usage
morie_gsageemd_layer(
H,
adj,
W,
how = "mean",
sizes = NULL,
rng = NULL,
normalize = TRUE
)
Arguments
- H
Node feature matrix (n x d).
- adj
Adjacency list keyed by node id.
- W
Linear transform (n_out x (d + d_neigh)).
- how
Aggregator.
- sizes
Optional fixed sample size per node.
- rng
Generator environment.
- normalize
L2-normalise the output.
Value
Matrix of new node representations.
References
Hamilton, W. L. et al. (2017).
Examples
H <- diag(3)
adj <- list(`0` = 1L, `1` = c(0L, 2L), `2` = 1L) # 0-based node ids
W <- matrix(0.5, 2, 6)
morie_gsageemd_layer(H, adj, W)
#> [,1] [,2]
#> [1,] 0.7071068 0.7071068
#> [2,] 0.7071068 0.7071068
#> [3,] 0.7071068 0.7071068