1. Engineering
  2. Computer Science
  3. 1 in one single matlab script file pagerank408m implement 2...

Question: 1 in one single matlab script file pagerank408m implement 2...

Question details

1. In one single MATLAB script file (PageRank408.m), implement:

2. page ranking with damping algorithm;

3. The input three arguments are

1) a link matrix (not normalized) of the pages

2) a damping factor, and

3) number of iterations ;

4. The output is the importance weight vector of the pages.

5. Use pagerank_test.m for testing your implementation.

pagerank_test.m

===========================

names = {'Jimi_1', 'Phillip_2', 'Zhenchao_3', 'Tyler_4', 'Mike_5', 'Stewart_6' ...
'Kurosh_7', 'Jing_8', 'Jeremiah_9', 'Ryan_10', 'Christopher_11', ...
'Yansong_12', 'Neha_13', 'Alexander_14', 'Aidan_15', 'Wesley_16', 'Tristan_17', 'Jacob_18', ...
'Patrick_19', 'Anthony_20', 'Josiah_21', 'Cody_22', 'April_23'};

%
% % 1,2,3,4,5,6,7,8,9,1011121314151617181920212223
A = [0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0; %1
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0; %2
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %3
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %4
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0; %5
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %6
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1; %7
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %8
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %9
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0; %10
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1; %11
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %12
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %13
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %14
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %15
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %16
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %17
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %18
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %19
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %20
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %21
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; %22
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; %23


%Uncomment the following lines to create a random graph   
%A = randi([0 1], 23,23);
%A(logical(eye(size(A)))) = 0;


%run pagerank algorithm with damping factor = 0.85, number of iterations = 1000, pr is the output weight vector of the pages.
pr = pagerank(A, 0.85, 1000);

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution