Skip to contents

This function calculates the next-time received activation value from node y to node x in the specific graph, based on the activation values of its neighbors (including y) and a weighting factor loose.

The formula is \(f^{t+1}(x,j) = l \cdot s_k / \sum_{j} {s_j}\).

Usage

transfer_activation(graph, y, x, activation, loose = 1)

Arguments

graph

A square matrix (or dgCMatrix representing the background graph. Inside this adjacency matrix, each row and column of the matrix represents a node in the graph. The values of the matrix should be either 0 or 1 (or either 0 or larger than 0), where a value of 0 indicates no relations between two nodes. The diagonal of the matrix should be 0, as there are no self-edges in the graph.

y

The index or ID of the node for which to specify the attention place

x

The index or ID of the neighbor of node y

activation

A vector containing the last-time activation values of all nodes. the sequence is the same as the matrix.

loose

A scalar numeric between 0 and 1 that determines the loose (or weight) in the calculation process.

Value

A scalar value representing the activation value for node x

Examples

# make an adjacency matrix and randomly fill some cells with 1s
mat <- matrix(sample(c(0,1), 100, replace = TRUE), 10, 10)
diag(mat) <- 0 # remove self-loops

transfer_activation(mat, 3, 2, 1:10)
#> [1] 0.1034483