Adds a learnable vector indexed by node degree to the input
features. Attention is computed from features, so without this a hub
and a leaf with identical features are indistinguishable.
Usage
morie_grphmr_centrality(adj, n, z_in, z_out = NULL, directed = FALSE)
Arguments
- adj
Adjacency list: list of numeric neighbour vectors.
- n
Number of nodes.
- z_in
Length-(maxdeg+1) list of length-d vectors.
- z_out
Optional separate table for out-degree (directed).
- directed
Logical; if TRUE uses in/out degree separately.
Value
A list with encoding, degrees,
note.
Examples
adj <- list(c(2, 3), c(1), c(1)) # a star: node 1 has degree 2
z_in <- list(c(0, 0), c(1, 0), c(0, 1)) # one vector per degree 0, 1, 2
morie_grphmr_centrality(adj, n = 3, z_in = z_in)$encoding
#> [[1]]
#> [1] 0 1
#>
#> [[2]]
#> [1] 0 0
#>
#> [[3]]
#> [1] 1 0
#>