Lab: Page Ranking
Goals
 Page Ranking algorithm
 Defining and invoking functions
Set up
From the cs115
Downloads
folder, download the lab10
folder.
Task 1  Page Ranking for three pages
We will write a program to compute the page ranking for this particular graph:

Open the file
pageRank3.html
in your editor. Examine the code. 
Define a function
computePageRank3()
in a file namedpageRank.js
. This function reads the values for each of the three pages from the web page, and calculates the new values, after one iteration only, based on theBrin and Page Algorithm
. At the end, it presents the results on the web page. 
Add a button on the web page and arrange so that when the button is clicked the
computePageRank3()
function is called.  What happens if you click on the button again and again, for a number of times?
Task 2  Page Ranking for four pages
Task 2A
 Create a file,
pageRank4.html
, that will be used to compute the page ranking on this particular graph which contains 4 pages:

In your file
pageRank.js
define a function namedcomputePageRankOneRound()
. It will just do what its name says: compute the ranking of each of the four pages in this graph, after only one iteration of the Brin and Page algorithm. Use your work on the previous task to get guided.  Test your work by calling the function multiple times, as you click on the
Compute button
, until the values converge (do not change any more).
Task 2B

Define one more function, named
computePageRankManyRounds()
which takes an integer number,n
, as input. This function will call thecomputePageRankOneRound()
n times. 
Attach this function to the
Compute button
. Experiment to see what number you should pass it as input, so that the final values are computed.  If time permits, add one more input field to the page, for the user to enter the number of rounds they would like to perform.