heat.diffusion {diffusr} | R Documentation |
An amount of starting heat gets distribution using the
Laplacian matrix of a graph. Every iteration (or time interval) t
heat streams from the starting nodes into surrounding nodes.
heat.diffusion(h0, graph, t = 0.5, ...) ## S4 method for signature 'numeric,matrix' heat.diffusion(h0, graph, t = 0.5, ...) ## S4 method for signature 'matrix,matrix' heat.diffusion(h0, graph, t = 0.5, ...)
h0 |
an |
graph |
an ( |
t |
time point when heat is measured |
... |
additional parameters |
returns the heat on every node as numeric vector
https://en.wikipedia.org/wiki/Laplacian_matrix
https://en.wikipedia.org/wiki/Heat_equation
# count of nodes n <- 5 # starting distribution (has to sum to one) h0 <- as.vector(rmultinom(1, 1, prob=rep(.2, n))) # adjacency matrix (either normalized or not) graph <- matrix(abs(rnorm(n*n)), n, n) # computation of stationary distribution ht <- heat.diffusion(h0, graph)