In [36]:
include("utils.jl")
using DiffusionTutorialUtilities
utils = DiffusionTutorialUtilities
A,xy = utils.load_graph_and_coords("newman-netsci")
include("diffusions.jl")
using DiffusionAlgorithms
P = utils.normout!(A)
function single_seed_stochastic_heat_kernel(P,t,seed)
n = size(P,1)
@assert 1 <= seed <= n
M = -t*(eye(n)-P')
v = zeros(size(P,1))
v[seed] = 1.
x = expm(M) * v
end
#x = single_seed_stochastic_heat_kernel([0. 1.; 1. 0], 5., 1)
#y = DiffusionAlgorithms.single_seed_stochastic_heat_kernel_series([0. 1.; 1. 0],5.,1)
x = single_seed_stochastic_heat_kernel(P,5.,1)
y = DiffusionAlgorithms.single_seed_stochastic_heat_kernel_series(P',5.,1)
#@show sum(x), sum(y)
#@show [x[1:5] y[1:5] x[1:5]./y[1:5]]
utils.cgraphplot(A,xy,0.1*log(1/(max(minimum(x),1.e-12))*x),log(x+1.e-12),
utils._inferno_data)
Out[36]:
In [ ]:
In [40]:
include("diffusions.jl")
using DiffusionAlgorithms
using Interact
A,xy = utils.load_graph_and_coords("newman-netsci");
P = utils.normout!(A)
n = size(A,1)
@manipulate for t=0.5:0.5:25, seed=1:n
@time x = DiffusionAlgorithms.single_seed_stochastic_heat_kernel_series(P',t,seed)
@show extrema(x), 1/n
@show "here"
utils.cgraphplot(A,xy,0.1*log(1/(max(minimum(x),1.e-12))*x),log(x+1.e-12),
utils._inferno_data)
end
Out[40]:
In [41]:
include("diffusions.jl")
include("utils.jl")
using DiffusionAlgorithms
using DiffusionTutorialUtilities
utils = DiffusionTutorialUtilities
A,xy = utils.load_graph_and_coords("U3A")
P = utils.normout!(A)
n = size(A,1)
@manipulate for t=0.5:0.5:50, seed=1:n
@time x = DiffusionAlgorithms.single_seed_stochastic_heat_kernel_series(P',t,seed)
utils.cgraphplot(A,xy,0.1*log(1/(max(minimum(x),1.e-12))*x),log(x+1.e-12),
utils._inferno_data)
end
Out[41]: