In [44]:
using PyPlot
include("utils.jl")
using DiffusionTutorialUtilities
utils = DiffusionTutorialUtilities
A,xy = utils.load_graph_and_coords("newman-netsci")
utils.cgraphplot(A,xy,filled=false)
Out[44]:
In [34]:
include("diffusions.jl")
using DiffusionAlgorithms
P = utils.normout!(A)
Out[34]:
In [35]:
function single_seed_pagerank(P,alpha,seed)
n = size(P,1)
@assert 1 <= seed <= n
v = zeros(size(P,1))
v[seed] = (1.-alpha)
x = (eye(n) - alpha*P') \ v
end
x = single_seed_pagerank(P,0.85,1)
utils.graphplot(A,xy)
scatter(xy[:,1],xy[:,2],400*x+5,400*x,edgecolor="None",cmap="inferno")
#axis("off")
#colorbar()
Out[35]:
In [36]:
using Interact
In [37]:
n = size(P,1)
f = figure()
@manipulate for alpha=0:0.01:0.99, seed=1:n; withfig(f) do
x = single_seed_pagerank(P,alpha,seed)
utils.graphplot(A,xy)
scatter(xy[:,1],xy[:,2],25*max(log(n*x),0.25),max(log(n*x),0),edgecolor="None",cmap="inferno")
axis("off")
colorbar()
#clim([0,sqrt(n)])
end
end
Out[37]:
In [38]:
close("all")
In [45]:
include("diffusions.jl")
include("utils.jl")
using DiffusionAlgorithms
using DiffusionTutorialUtilities
A,xy = utils.load_graph_and_coords("newman-netsci");
P = utils.normout!(A)
n = size(P,1)
# chebyshev point set of alphas
N=15; alphas = [0.999,0.995,0.99,0.95,0.9,0.85,0.8,0.75,0.66,0.5,0.25,0.1]
@manipulate for alpha=alphas, seed=1:n
@time x = DiffusionAlgorithms.single_seed_pagerank_power(P',alpha,seed)
#utils.cgraphplot(A,xy,0.33*max(log(n*x),0.75),max(log(n*x),0),utils._inferno_data)
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[45]:
In [46]:
include("diffusions.jl")
include("utils.jl")
using DiffusionAlgorithms
using DiffusionTutorialUtilities
A,xy = utils.load_graph_and_coords("U3A");
P = utils.normout!(A)
n = size(P,1)
# chebyshev point set of alphas
N=15; alphas = [0.999,0.995,0.99,0.95,0.9,0.85,0.8,0.75,0.66,0.5,0.25,0.1]
@manipulate for alpha=alphas, seed=1:n
@time x = DiffusionAlgorithms.single_seed_pagerank_power(P',alpha,seed)
#utils.cgraphplot(A,xy,0.33*max(log(n*x),0.75),max(log(n*x),0),utils._inferno_data)
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[46]: