Skip to contents

The ACT spreading activation formula is represented in Equation 1: $$a(y) = \sum_x {f(x,y) \cdot a(x)} + c(y)$$, where \(c(y)\) represents the baseline activation of y. \(\alpha\) represents the proximity of a node in this network. \(t\) represents the iteration number

Usage

spread_gram(
  graph,
  last_activation,
  loose = 1,
  max_iter = 1e+05,
  threshold = 1,
  threads = 0,
  verbose = TRUE
)

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.

last_activation

A vector that containing the last time activation rates 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.

max_iter

Max iteration times.

threshold

End threshold

threads

A scalar numeric indicating the parallel threads. Default is 0 (auto-detected).

verbose

Show verbose message

Value

A numeric vector that contains new activation

Examples

# The graph G
data("graph", package = "labyrinth")

# The initial info
last_activation = c(2, 4, 3, 2, 2, 1, 5)

results <- spread_gram(graph, last_activation)
#> Iterated #0 times. Current loss: 0.0373226717617934
#> Convergent at #0 times. Current loss: 0.0373226717617934