Query rewriting through link analysis of the click graph.pdf matlab code (demo)

S= [0 0 0 0 0 1 0 0 0 ;
    0 0 0 0 0 1 1 0 0;
    0 0 0 0 0 1 1 0 0;
    0 0 0 0 0 0 1 0 0 ;
    0 0 0 0 0 0 0 1 1;
    1 1 1 0 0 0 0 0 0 ;
    0 1 1 1 0 0 0 0 0 ;
    0 0 0 0 1 0 0 0 0;
    0 0 0 0 1 0 0 0 0];
count=9;
I=eye(count);
x=[1 1 1 1 1 1 1 1 1];

b=eye(count);
P=ones(count);

for i=1:count
    for j=1:count
        k=b(i,:)*S*x';
        if k==0
            P(i,j)=0;
        else
            P(j,i)=S(i,j)/k;
        end
    end
end

C=0.8;
S=I;
P
for i=1:100
    S=C*P'*S*P+I-diag(diag(C*P'*S*P));
end
S

你可能感兴趣的:(C++,c,C#,matlab,J#)