Skip to contents

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.

Usage

heat.diffusion(h0, graph, t = 0.5, ...)

Arguments

h0

an \(n \times p\)-dimensional numeric non-negative matrix (or dgCMatrix, vector) of starting temperatures

graph

an (\(n \times n\))-dimensional numeric non-negative adjacence matrix representing the graph

t

time point when heat is measured

...

additional parameters

Value

returns the heat on every node as numeric vector

Examples

# 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
heat <- heat.diffusion(h0, graph)