Skip to content

Instantly share code, notes, and snippets.

@wulingyun
Created June 19, 2016 10:32
Embed
What would you like to do?
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