Skip to content

Instantly share code, notes, and snippets.

@wulingyun
Created June 19, 2016 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wulingyun/853c29c5098b9ef781df0cb7c20e3f1e to your computer and use it in GitHub Desktop.
Save wulingyun/853c29c5098b9ef781df0cb7c20e3f1e to your computer and use it in GitHub Desktop.
Network diffusion kernel
diffusion_kernel <- function(adj, beta = 1)
{
lap <- adj - diag(rowSums(adj))
eig <- eigen(lap)
dif <- eig$vectors %*% diag(exp(beta * eig$values)) %*% t(eig$vectors)
dif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment