问题
I want to ask some question about eigenvector centrality. I have to compute a eigenvalue using power iteration. This is my code to compute eigenvalue :
v=rand(165,1);
for k=1:5
w = data_table*v;
lamda = norm(w);
v = w/lamda;
end
When I have get a single eigenvalue, I confused to compute eigenvector score using a single eigenvalue that I had get it. for example in my code to compute eigenvalue I get dominant eigenvalue = 78.50. With this eigenvalue score, I want compute eigenvector score. usually, we always compute eigenvalue and eigenvector using code for example : [U,V] = eig(data_matrix); but, the result from that code :
v =
-167.59 0 0
0 -117.51 0
0 0 -112.0
V =
0.0404505 0.04835455 -0.01170
0.0099050 -0.0035217 -0.05561
0.0319591 -0.0272589 0.018426
From the result we compute the Eigenvector using three eigenvalue score. My question is how to compute the eigenvector score but just using only one eigenvalue score that we get in power iteration code ?
回答1:
power iteration finds the dominant eigenvector, that is the eigenvector with the largest eigenvalue.
if you start with
v=ones(165,1)/165; % initialisation
for i=1:5 % 5 iterations
w=data_table*v; % assuming size(data_table) = [165 165]
v=w/norm(w);
end
and your algorithm converges in 5 iterations, then v is your dominant eigenvector;
Also, I would start with a smaller example to test your code. Your matlab call [U,V] = eig(data_matrix);
is confusing because V should be a diagonal matrix of size [165 165], not a full matrix of size [3 3];
Try this:
X=[1 1 1;1 1 2;1 2 2]
[U,V]=eig(X)
X*U(:,3)
U(:,3)*V(3,3)
to see what the largest eigenvalue is in the matlab output, i.e. (V3,3), and the corresponding vector U(:,3).
You cat use power iteration to find this eigenvector:
v=ones(1,3)
w=v*X;v=w/norm(w)
w=v*X;v=w/norm(w)
w=v*X;v=w/norm(w)
w=v*X;v=w/norm(w)
来源:https://stackoverflow.com/questions/13739186/compute-eigenvector-using-a-dominant-eigenvalue