heat-diffusion-methods: Graph diffusion using a heat diffusion process on a Laplacian...

Description Usage Arguments Value References Examples

Description

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

1
2
3
4
5
6
7
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, ...)

Arguments

h0

an n x p-dimensional numeric non-negative vector/matrix of starting temperatures

graph

an (n x 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

References

https://en.wikipedia.org/wiki/Laplacian_matrix
https://en.wikipedia.org/wiki/Heat_equation

Examples

1
2
3
4
5
6
7
8
# 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)

Example output

setting diag of graph to zero

diffusr documentation built on May 2, 2019, 3:42 a.m.