%% Singularity
load 'wb-cs.stanford.mat'

%% P has imaginary eigenvalues
[V,D] = eigs(Pcc',15,'LI');
diag(D)
%% 
[V,D] = eigs(Pcc',5,'LR');
diag(D)

%% Rank deficient if alpha=1/D(2,2)

rank(full(speye(size(Pcc,1)) - 1/D(2,2)*Pcc'))

%% Smooth functions
fplot(@(x) sin(x+x.^3 + x.^5 + x.^6),[-1,1])
%%
fplot(@(x) sin(1/(x-1.1)),[-1,1])

%% PageRank functions
load 'wb-cs.stanford.mat'

ind = @(x,i) x(i);
f1 = @(a) ind(prdirect(a,Pcc,1),1);
fplot(f1,[0,1]);

%% singular

%% dangling nodes
