Kardi Teknomo
Kardi Teknomo Kardi Teknomo Kardi Teknomo
   
 
  Research
  Publications
  Tutorials
  Resume
  Personal
  Contact

 

Visit Tutorials below:
Adaptive Learning from Histogram
Adjacency matrix
Analytic Hierarchy Process (AHP)
ArcGIS tutorial
Arithmetic Mean
Bayes Theorem
Bootstrap Sampling
Bray Curtis Distance
Break Even Point
Chebyshev Distance
City Block Distance
Conditional Probability
Continued Fraction
Data Analysis from Questionnaire
Data Revival from Statistics
Decimal to Rational
Decision tree
Difference equations
Digital Root
Discriminant analysis
Divisibility
Eigen Value using Excel
Euclidean Distance
Euler Integration
Euler Number
Excel Iteration
Excel Macro
Excel Tutorial
Feasibility Study
Financial Analysis
Generalized Inverse
Generalized Mean
Geometric Mean
Ginger Bread Man and Chaos
Graph Theory
Growth Model
Hamming Distance
Harmonic Mean
Hierarchical Clustering
Independent Events
Incident matrix
Jaccard Coefficient
Kernel basis function
Kernel Regression
k-Means clustering
K Nearest Neighbor
LAN Connections Switch
Learning from data
Lehmer Mean
Linear Algebra
Logarithm Rules
Mahalanobis Distance
Market Basket Analysis
Mean Absolute Deviation
Mean and Average
Mean, median, mode
Minkowski Distance
Minkowski Mean
Monte Carlo Simulation
Multi Agent System
Multicriteria decision making
Mutivariate Distance
Newton Raphson
Non-Linear Transformation
Normalization Index
Normalized Rank
Ordinary Differential Equation
Page Rank
Palindrome
PI
Power rules
Prime Factor
Prime Number
Q Learning
Quadratic Function
Queueing Theory
Rank Reversal
Recursive Statistics
Regression Model
Reinforcement Learning
Root of Polynomial
Runge-Kutta
Scenario Analysis
Sierpinski gasket
Sieve of Erastosthenes
Similarity and Distance
Solving System Equation
Standard deviation
Summation Tricks
Support Vector Machines
System dynamic
Time Average
Tower of Hanoi
Variance
Vedic Square
Visual Basic (VB) tutorial
What If Analysis

Page Rank in Matlab

By Kardi Teknomo, PhD.

PageRank

Matlab code of the original Google Page rank algorithm is given below.  Using this Matlab code, you can simply put rotated adjacency matrix of any directed network graph as input. That is

L=rot90(rot90(A))

Similarly, we can say

A=rot90(rot90(L))

The code can run without any input because the input example and parameter are given exactly as explained in the example of this tutorial. The basic computation in this code is based on recursive Page Rank formula.

function p=PageRank(L,d)
% return PageRank vector
%
% input:
% L = Link Matrix (=rotated adjacency matrix)
% d = constant parameter
%
% Example from Kardi Teknomo's Page Rank tutorial
% is given as input and output of this function.
% Read the full tutorial for more explanation.
%
% (c) 2012 Kardi Teknomo
% http://people.revoledu.com/kardi/tutorial/
%%%%%%%%%%%%%%%%%%%%%%%
if nargin<1
    L=[1 1 1 1 1 1;
       0 1 1 1 1 1;
       0 0 1 1 1 1;
       0 0 0 1 1 1;
       0 0 0 0 1 1;
       0 0 0 0 0 1;];
end
if nargin<2,
    d=0.85;
end
 
[m,n]=size(L);
c=sum(L);
L_c=L./repmat(c,m,1);
k=0;
 
while 1
    k=k+1;
    for i=1:m
        p(i)=(1-d)+d*(L_c(i,:)*c');
    end
    c=p;
    if sum(sum(p))==m || k>256,
        break;
    end
end

Variable k represent the number of iteration and we set limit the loop up to 256 iterations. If you run the code above, it will produce row vector p = [4.3254    0.6488    0.3731    0.2674    0.2106    0.1748].

In the next section, we will encourage you to use the Page Rank tool to compare the Page Rank

< Previous | Next | Content >

Rate this tutorial or give your comments about this tutorial

 

This tutorial is copyrighted.

Preferable reference for this tutorial is

Teknomo, Kardi(2012) Page Rank Tutorial. http://people.revoledu.com/kardi/tutorial/PageRank/

 

 

 
© 2007 Kardi Teknomo. All Rights Reserved.
Designed by CNV Media