{"version":1,"lectureId":"01M14TXJEYMJ7SQEJYRCTTSZRP","attempt":0,"publication":{"slug":"pagerank-the-random-surfer","title":"How Hyperlinks Become Votes: The PageRank Algorithm","subject":"computer-science","summary":"A hyperlink is a vote, but not every vote is worth the same. This lecture builds PageRank from the ground up on a web of six pages. A random surfer clicks links forever, and the fraction of time it spends on each page becomes that page's rank, settling from an even share into six stable numbers. The same computation is then rewritten as repeated multiplication of a probability vector by a sparse link matrix, which is how it is really done at scale, and named as the power method. Finally the model is broken on purpose: a page with no outgoing links drains the whole ranking to zero, and a pair of pages linking only to each other swallows all of it. One damping factor, read as a bored surfer teleporting to a random address, repairs both and gives the ranking the lecture finishes on.","metaDescription":"Build PageRank from a random surfer on six pages: link matrix, power iteration, damping factor, dangling pages and rank sinks.","transcript":"Nineteen ninety eight. The web has millions of pages on it, and somebody has to put them in order. Counting the words on a page is easy to fake. What is much harder to fake is what everybody else links to. So treat a hyperlink as a vote. Here is a web with six pages on it. Call them A through F, and every arrow is one hyperlink, pointing from the page that casts the vote to the page that receives it. A links to B and to C. B links to C and to D. C links back to A. D links to A and to E. E links to A and to F. And F links only to A. The crude way to use that is simply to count. Four arrows point at A. Two point at C. And B, D, E and F have one each. So A wins, and four pages are tied for last, which is not much of a ranking. And it is trivially cheatable. Every vote counted the same, so a link from a page nobody has ever read is worth exactly as much as a link from the front page of a newspaper. So here is the fix, and the lovely thing about it is that it stops talking about voting altogether. Imagine somebody sitting at page A who does nothing but click links at random. A has two links out, so flip a coin. It comes up C. C has only one link, so the surfer goes back to A. From A the coin says B this time. B has two links out and picks C again. C takes it back to A. Nobody is choosing anything clever there. It is all coin flips. And the surfer never arrives anywhere, because it never stops, so the question to ask is not where it ends up. It is what fraction of its time it spends on each page. Before the walk starts we know nothing at all, so give every page an equal share of the credit: one sixth each, about zero point one six seven. Now let the surfer run for a hundred steps and count where it landed. A took about forty one percent of the visits, C about twenty five, B about seventeen, and D, E and F share what little is left. Ten thousand steps, and the numbers steady. A million, and they stop moving altogether. This is what the walk settles on. A holds about thirty seven percent of the surfer's time, C twenty eight, B nineteen, and then it falls away sharply: nine, five and two percent for D, E and F. Those six numbers are the PageRank of this little web. And look at what those numbers are not. They are not the link count. B and D have exactly one arrow pointing at each of them, and yet B ends up worth twice as much as D. Look at where each of those single votes comes from. The one pointing at B comes from A, the most visited page on this web, and A splits its rank between two links. So B gets half of A. The one pointing at D comes from B, split two ways again, so D gets half of B. The same halving carries on down the chain. D hands half of what it has to E, and E hands half of that to F. That is why the last four numbers are each exactly half the one before them. So a vote from a heavily visited page is worth more than a vote from a quiet one, and a page that links to everything gives less to each. That is the whole idea, and it came out of a coin flip. What we do not have yet is a way to compute it without walking for a million steps. The surfer's rule is short. Take whatever rank you have, divide it equally among your outgoing links, and hand it on. Let's write that down one page at a time, calling the new numbers y and the old ones x. Start with B, because B is the easy one. Exactly one page points at it, and that is A. A has two links out, so A hands over half of what it has. The new value of B is half the old value of A. C is fed by two pages, A and B, and both of them have two links out, so both hand over half of theirs. The new C is half of A, plus half of B. A is fed by four pages. C and F have only one link each, so they hand over everything they have. D and E have two links each, so they hand over half. The new A is C, plus half of D, plus half of E, plus F. There are six of these, one per page, and every one of them has the same shape: a weighted sum of the old numbers, with the weights read straight off the links. Which is precisely what a matrix is for. Here is the whole web as one matrix. Six rows and six columns, one of each per page, in the order A, B, C, D, E, F. A column tells you what one page does with its rank. The column for A has two entries of one half, sitting in the B row and the C row, because A splits its vote between B and C. The column for C has a single one in it, up in the A row, because C has one link and gives everything to A. And every column adds up to exactly one, which is the bookkeeping that says rank is never created and never destroyed. Read across instead of down and you get what a page receives. The A row has four non zero entries, and they are exactly the four terms we wrote a minute ago: C, half of D, half of E, and F. So one step of the walk is one matrix times one vector. Call the numbers at step k, x sub k. Then the next lot is H times x sub k. And then you do it again. Start from the vector that knows nothing at all: one sixth on every page. Multiply once, and watch what A collects. All of C, which is zero point one six seven. Half of D, and then half of E, which is zero point zero eight three apiece. And all of F, another zero point one six seven. Rule a line under those four and add them up. A comes out at exactly one half. Which is a wildly lopsided first step: everything that pointed at A has dumped its whole share in at once. Multiply again and it swings back the other way. A gives half of that pile to B and half to C, so those two jump up, and A itself drops to a third. Do it a third time, and the numbers swing again. And a fourth, and again. They wobble, and every time round the wobble is a little smaller than it was. By about the twelfth multiplication they have stopped changing in the third decimal place, and they are the same six numbers the surfer found by walking. Three seven two on A, two seven nine on C, one eight six on B. This is the power method. Multiplying by H over and over drives any starting vector towards the one vector that H leaves alone. An eigenvector of the link matrix, with eigenvalue one. And that is genuinely how it is done. On a web of a billion pages the matrix is almost entirely zeros, so a single multiplication is cheap, and a few dozen of them is the whole computation. There is only one problem. All of that assumes the walk can always carry on. Real webs are not that tidy. Plenty of pages have no outgoing links at all: a PDF, an image, a page that simply never links anywhere. So take our web and delete the single link out of F. Now the surfer walks into F and stops dead, because there is nothing there to click on. In the matrix, that column is all zeros. F takes rank in, and hands none of it back out. Watch what that does to the numbers. At every step, whatever share is sitting on F simply vanishes. After one multiplication the total has already fallen to zero point eight three. Again, and it is down to three quarters. Again, and it keeps slipping away. Twenty steps in, there is essentially nothing left anywhere, and it is still falling. Which ranks nothing against anything. Every page has been driven towards zero, and the ordering has gone with it. Now the opposite failure. Give F a link out again, but point it at E rather than at A, and cut the link from E to A. Set the numbers back to an even sixth each. The surfer wanders in, and then it bounces between the two of them forever. There is no way out at all. That pattern has a name: a rank sink, or a spider trap. And the numbers go the other way. Instead of draining out of the web, everything piles into the pair. After enough steps E and F hold the whole thing between them, and A, B, C and D are all heading for zero. Two pages that nobody else even links to have taken the entire ranking. And both failures come from the same place: the walk cannot carry on properly. So set the numbers level again, and let's fix it. Both of them have the same one line cure, and it is the nicest idea in the whole algorithm. The surfer gets bored. Eighty five times out of a hundred, click a random link, exactly as before. The other fifteen times, stop clicking altogether: type an address straight into the bar, and jump to a page picked uniformly at random from the entire web. So the update gains a second term. Zero point eight five times H times x, which is the clicking, plus zero point one five over n on every page, which is the jumping. That first constant is the damping factor. Watch it undo both problems. From a dead end, jumping is the only move there is, so the walk carries on and nothing leaks away. From inside the trap, the surfer escapes fifteen times in a hundred, so it can never be held there forever. And every page in the web now receives at least zero point one five over n, no matter who links to it. So no rank is ever exactly zero, and the ordering always exists, whatever the link structure happens to look like. So put the original web back, with F pointing at A once more and E linking out again, and run the damped iteration on it. These are the numbers it settles on. A lands at about zero point three five, C at zero point two five, B at zero point one eight, and then D, E and F at a tenth, seven hundredths and five hundredths. Same order as the undamped walk gave us, but everything has been pulled a little way towards the flat one sixth. A has given some back, and F has more than doubled. That is the fifteen percent of ignorance mixing itself back in. So that is PageRank. A link is a vote. A vote is worth the rank of the page casting it, divided between all the links that page casts. And the ranking is the vector that stops changing when you multiply it by the damped link matrix.","watch":{"version":1,"scenes":[{"title":"A Surfer on a Small Web","start":0,"end":216.94554166666663,"objects":{"bar_a":"a Vector [green] labelled \"0.167\" drawn in chart (start=(0.7, 0.0), end=(0.7, <VariableNumber p_a = 0.372>))","bar_b":"a Vector [green] labelled \"0.167\" drawn in chart (start=(1.7, 0.0), end=(1.7, <VariableNumber p_b = 0.186>))","bar_c":"a Vector [green] labelled \"0.167\" drawn in chart (start=(2.7, 0.0), end=(2.7, <VariableNumber p_c = 0.279>))","bar_d":"a Vector [green] labelled \"0.167\" drawn in chart (start=(3.7, 0.0), end=(3.7, <VariableNumber p_d = 0.093>))","bar_e":"a Vector [green] labelled \"0.167\" drawn in chart (start=(4.7, 0.0), end=(4.7, <VariableNumber p_e = 0.047>))","bar_f":"a Vector [green] labelled \"0.167\" drawn in chart (start=(5.7, 0.0), end=(5.7, <VariableNumber p_f = 0.023>))","baseline":"a Line [gray] drawn in chart (start=(0.15, 0.0), end=(6.45, 0.0))","card":"a Title that says \"Algorithms — How Hyperlinks Become Votes: The PageRank Algorithm\"","chart":"a Figure (x_range=(0.0, 6.6), y_range=(-0.16, 0.56), aspect=(6.6, 3.6))","edge_ab":"a Vector [gray] drawn in web (start=(3.0, 3.5), end=(4.3, 5.75), trim_tip=True)","edge_ac":"a CurvedArrow [gray] drawn in web (start=(3.0, 3.5), end=(4.3, 1.25), bend=0.35)","edge_bc":"a Vector [gray] drawn in web (start=(4.3, 5.75), end=(4.3, 1.25), trim_tip=True)","edge_bd":"a Vector [gray] drawn in web (start=(4.3, 5.75), end=(6.9, 5.75), trim_tip=True)","edge_ca":"a CurvedArrow [gray] drawn in web (start=(4.3, 1.25), end=(3.0, 3.5), bend=0.35)","edge_da":"a Vector [gray] drawn in web (start=(6.9, 5.75), end=(3.0, 3.5), trim_tip=True)","edge_de":"a Vector [gray] drawn in web (start=(6.9, 5.75), end=(8.2, 3.5), trim_tip=True)","edge_ea":"a Vector [gray] drawn in web (start=(8.2, 3.5), end=(3.0, 3.5), trim_tip=True)","edge_ef":"a Vector [gray] drawn in web (start=(8.2, 3.5), end=(6.9, 1.25), trim_tip=True)","edge_fa":"a Vector [gray] drawn in web (start=(6.9, 1.25), end=(3.0, 3.5), trim_tip=True)","head_walk":"a Heading that says \"Where Does the Surfer Spend Its Time?\"","head_web":"a Heading that says \"Six Pages and the Links Between Them\"","idea":"a Panel that says \"A hyperlink from one page to another is a vote. The whole question is what a single vote is worth.\"","node_a":"a Point [blue] labelled \"A\" drawn in web (location=(3.0, 3.5), marker_radius=0.15)","node_b":"a Point [blue] labelled \"B\" drawn in web (location=(4.3, 5.75), marker_radius=0.15)","node_c":"a Point [blue] labelled \"C\" drawn in web (location=(4.3, 1.25), marker_radius=0.15)","node_d":"a Point [blue] labelled \"D\" drawn in web (location=(6.9, 5.75), marker_radius=0.15)","node_e":"a Point [blue] labelled \"E\" drawn in web (location=(8.2, 3.5), marker_radius=0.15)","node_f":"a Point [blue] labelled \"F\" drawn in web (location=(6.9, 1.25), marker_radius=0.15)","p_a":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_b":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_c":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_d":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_e":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_f":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","point":"a Point [yellow] drawn in web (location=(6.9, 1.25))","point_2":"a Point [yellow] drawn in web (location=(3.0, 3.5))","point_3":"a Point [yellow] drawn in web (location=(4.3, 5.75))","point_4":"a Point [yellow] drawn in web (location=(6.9, 5.75))","tag_a":"a Math [text] that says \"$A$\" drawn in chart","tag_b":"a Math [text] that says \"$B$\" drawn in chart","tag_c":"a Math [text] that says \"$C$\" drawn in chart","tag_d":"a Math [text] that says \"$D$\" drawn in chart","tag_e":"a Math [text] that says \"$E$\" drawn in chart","tag_f":"a Math [text] that says \"$F$\" drawn in chart","walker":"a Point [yellow] drawn in web (location=(<VariableNumber wx = 3.0>, <VariableNumber wy = 3.5>), marker_radius=0.09)","web":"a Figure (x_range=(1.6, 9.6), y_range=(0.2, 7.0), aspect=(8.0, 6.8))","wx":"a VariableNumber (initial_value=3.0)","wy":"a VariableNumber (initial_value=3.5)"},"beats":[{"start":0,"say":"Nineteen ninety eight. The web has millions of pages on it, and somebody has to put them in order. Counting the words on a page is easy to fake. What is much harder to fake is what everybody else links to. So treat a hyperlink as a vote.","live":[],"does":[[0,"card is shown on the screen, written out."],[1.5,"card: enter:write-left-to-right."],[14.9885,"card is hidden from the screen — left the board."]]},{"start":16.1885,"say":"Here is a web with six pages on it. Call them A through F, and every arrow is one hyperlink, pointing from the page that casts the vote to the page that receives it.","live":null,"does":[[16.1885,"head_web is shown on the screen, written out."],[16.1885,"web is shown on the screen, written out."],[17.361000000000004,"node_a is shown on the screen, written out."],[17.481000000000005,"node_b is shown on the screen, written out."],[17.601000000000003,"node_c is shown on the screen, written out."],[17.721000000000004,"node_d is shown on the screen, written out."],[17.841000000000005,"node_e is shown on the screen, written out."],[17.961000000000006,"node_f is shown on the screen, written out."],[21.216,"edge_ab is shown on the screen, drawn."],[21.326,"edge_ac is shown on the screen, drawn."],[21.436,"edge_bc is shown on the screen, drawn."],[21.546,"edge_bd is shown on the screen, drawn."],[21.656000000000002,"edge_ca is shown on the screen, drawn."],[21.766000000000002,"edge_da is shown on the screen, drawn."],[21.876,"edge_de is shown on the screen, drawn."],[21.986,"edge_ea is shown on the screen, drawn."],[22.096,"edge_ef is shown on the screen, drawn."],[22.206,"edge_fa is shown on the screen, drawn."],[24.408,"web moves to a new place on the board."],[24.408,"idea is shown on the screen, written out."]]},{"start":27.156,"say":"A links to B and to C. B links to C and to D. C links back to A. D links to A and to E. E links to A and to F. And F links only to A.","live":["idea","web","head_web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa"],"does":[[28.061999999999998,"edge_ab is emphasized."],[28.769999999999996,"edge_ab is no longer emphasized."],[28.769999999999996,"edge_ac is emphasized."],[30.36,"edge_ac is no longer emphasized."],[30.36,"edge_bc is emphasized."],[30.976,"edge_bc is no longer emphasized."],[30.976,"edge_bd is emphasized."],[32.519999999999996,"edge_bd is no longer emphasized."],[32.519999999999996,"edge_ca is emphasized."],[34.064,"edge_ca is no longer emphasized."],[34.064,"edge_da is emphasized."],[34.912,"edge_da is no longer emphasized."],[34.912,"edge_de is emphasized."],[36.479,"edge_de is no longer emphasized."],[36.479,"edge_ea is emphasized."],[37.187,"edge_ea is no longer emphasized."],[37.187,"edge_ef is emphasized."],[38.742999999999995,"edge_ef is no longer emphasized."],[38.742999999999995,"edge_fa is emphasized."],[39.887,"edge_fa is no longer emphasized."]]},{"start":40.486999999999995,"say":"The crude way to use that is simply to count. Four arrows point at A. Two point at C. And B, D, E and F have one each. So A wins, and four pages are tied for last, which is not much of a ranking.","live":null,"does":[[43.522999999999996,"edge_ca is emphasized."],[43.522999999999996,"edge_da is emphasized."],[43.522999999999996,"edge_ea is emphasized."],[43.522999999999996,"edge_fa is emphasized."],[45.507999999999996,"edge_ca is no longer emphasized."],[45.507999999999996,"edge_da is no longer emphasized."],[45.507999999999996,"edge_ea is no longer emphasized."],[45.507999999999996,"edge_fa is no longer emphasized."],[45.507999999999996,"edge_ac is emphasized."],[45.507999999999996,"edge_bc is emphasized."],[48.96799999999999,"edge_ac is no longer emphasized."],[48.96799999999999,"edge_bc is no longer emphasized."]]},{"start":55.74399999999999,"say":"And it is trivially cheatable. Every vote counted the same, so a link from a page nobody has ever read is worth exactly as much as a link from the front page of a newspaper.","live":null,"does":[[61.08499999999999,"point is shown on the screen, grown."],[63.08499999999999,"point is hidden from the screen."],[65.113,"point_2 is shown on the screen, grown."]]},{"start":66.642,"say":"So here is the fix, and the lovely thing about it is that it stops talking about voting altogether. Imagine somebody sitting at page A who does nothing but click links at random. A has two links out, so flip a coin. It comes up C.","live":["idea","web","head_web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa","point_2"],"does":[[67.113,"point_2 is hidden from the screen."],[73.02799999999999,"walker is shown on the screen, written out."],[79.95899999999999,"walker is redrawn as the numbers it depends on change."],[79.95899999999999,"wx ticks to 4.3."],[79.95899999999999,"wy ticks to 1.25."]]},{"start":81.08149999999999,"say":"C has only one link, so the surfer goes back to A. From A the coin says B this time. B has two links out and picks C again. C takes it back to A.","live":["idea","web","head_web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa","walker"],"does":[[84.18099999999998,"walker is redrawn as the numbers it depends on change."],[84.18099999999998,"wx ticks to 3.0."],[84.18099999999998,"wy ticks to 3.5."],[86.22499999999998,"walker is redrawn as the numbers it depends on change."],[86.22499999999998,"wx ticks to 4.3."],[86.22499999999998,"wy ticks to 5.75."],[89.33599999999998,"walker is redrawn as the numbers it depends on change."],[89.33599999999998,"wx ticks to 4.3."],[89.33599999999998,"wy ticks to 1.25."],[91.77399999999999,"walker is redrawn as the numbers it depends on change."],[91.77399999999999,"wx ticks to 3.0."],[91.77399999999999,"wy ticks to 3.5."]]},{"start":93.14049999999999,"say":"Nobody is choosing anything clever there. It is all coin flips. And the surfer never arrives anywhere, because it never stops, so the question to ask is not where it ends up. It is what fraction of its time it spends on each page.","live":null,"does":[[107.72299999999998,"walker is hidden from the screen."],[107.72299999999998,"head_web is hidden from the screen — left the board."],[107.72299999999998,"idea is hidden from the screen — left the board."]]},{"start":108.323,"say":"Before the walk starts we know nothing at all, so give every page an equal share of the credit: one sixth each, about zero point one six seven.","live":["web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa"],"does":[[108.323,"head_walk is shown on the screen, written out."],[108.323,"chart is shown on the screen, written out."],[109.08899999999998,"baseline is shown on the screen, written out."],[109.08899999999998,"tag_a is shown on the screen, written out."],[109.16899999999998,"tag_b is shown on the screen, written out."],[109.24899999999998,"tag_c is shown on the screen, written out."],[109.32899999999998,"tag_d is shown on the screen, written out."],[109.40899999999998,"tag_e is shown on the screen, written out."],[109.48899999999999,"tag_f is shown on the screen, written out."],[112.66499999999998,"bar_a is shown on the screen, written out."],[112.78499999999998,"bar_b is shown on the screen, written out."],[112.90499999999997,"bar_c is shown on the screen, written out."],[113.02499999999998,"bar_d is shown on the screen, written out."],[113.14499999999998,"bar_e is shown on the screen, written out."],[113.26499999999997,"bar_f is shown on the screen, written out."]]},{"start":118.246,"say":"Now let the surfer run for a hundred steps and count where it landed. A took about forty one percent of the visits, C about twenty five, B about seventeen, and D, E and F share what little is left.","live":["web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa","chart","head_walk","baseline","tag_a","tag_b","tag_c","tag_d","tag_e","tag_f","bar_a","bar_b","bar_c","bar_d","bar_e","bar_f"],"does":[[123.36599999999999,"bar_a is redrawn as the numbers it depends on change."],[123.36599999999999,"p_a ticks to 0.41."],[125.57199999999999,"bar_c is redrawn as the numbers it depends on change."],[125.57199999999999,"p_c ticks to 0.25."],[127.22,"bar_b is redrawn as the numbers it depends on change."],[127.22,"p_b ticks to 0.17."],[129.391,"bar_d is redrawn as the numbers it depends on change."],[129.391,"bar_e is redrawn as the numbers it depends on change."],[129.391,"bar_f is redrawn as the numbers it depends on change."],[129.391,"p_d ticks to 0.09."],[129.391,"p_e ticks to 0.05."],[129.391,"p_f ticks to 0.03."]]},{"start":131.7095,"say":"Ten thousand steps, and the numbers steady. A million, and they stop moving altogether. This is what the walk settles on.","live":null,"does":[[135.564,"bar_a is redrawn as the numbers it depends on change."],[135.564,"bar_b is redrawn as the numbers it depends on change."],[135.564,"bar_c is redrawn as the numbers it depends on change."],[135.564,"bar_d is redrawn as the numbers it depends on change."],[135.564,"bar_e is redrawn as the numbers it depends on change."],[135.564,"bar_f is redrawn as the numbers it depends on change."],[135.564,"p_a ticks to 0.372."],[135.564,"p_b ticks to 0.186."],[135.564,"p_c ticks to 0.279."],[135.564,"p_d ticks to 0.093."],[135.564,"p_e ticks to 0.047."],[135.564,"p_f ticks to 0.023."]]},{"start":141.493,"say":"A holds about thirty seven percent of the surfer's time, C twenty eight, B nineteen, and then it falls away sharply: nine, five and two percent for D, E and F. Those six numbers are the PageRank of this little web.","live":null,"does":[[142.57299999999998,"bar_a is indicated — a transient flash."],[144.98699999999997,"bar_c is indicated — a transient flash."],[145.97399999999996,"bar_b is indicated — a transient flash."],[148.84199999999996,"bar_d is indicated — a transient flash."],[149.39899999999997,"bar_e is indicated — a transient flash."],[149.95599999999996,"bar_f is indicated — a transient flash."]]},{"start":156.5005,"say":"And look at what those numbers are not. They are not the link count. B and D have exactly one arrow pointing at each of them, and yet B ends up worth twice as much as D.","live":null,"does":[[162.06199999999995,"point_3 is shown on the screen, grown."],[162.06199999999995,"point_4 is shown on the screen, grown."],[164.06199999999995,"point_3 is hidden from the screen."],[164.06199999999995,"point_4 is hidden from the screen."],[165.16199999999995,"bar_b is indicated — a transient flash."],[165.16199999999995,"bar_d is indicated — a transient flash."]]},{"start":167.399,"say":"Look at where each of those single votes comes from. The one pointing at B comes from A, the most visited page on this web, and A splits its rank between two links. So B gets half of A. The one pointing at D comes from B, split two ways again, so D gets half of B.","live":null,"does":[[171.683,"edge_ab is emphasized."],[181.13299999999998,"edge_ab is no longer emphasized."],[181.13299999999998,"edge_bd is emphasized."],[185.702,"edge_bd is no longer emphasized."]]},{"start":186.302,"say":"The same halving carries on down the chain. D hands half of what it has to E, and E hands half of that to F. That is why the last four numbers are each exactly half the one before them.","live":null,"does":[[189.26799999999997,"bar_d is indicated — a transient flash."],[190.86999999999998,"bar_e is indicated — a transient flash."],[192.99499999999998,"bar_f is indicated — a transient flash."]]},{"start":198.88899999999998,"say":"So a vote from a heavily visited page is worth more than a vote from a quiet one, and a page that links to everything gives less to each. That is the whole idea, and it came out of a coin flip. What we do not have yet is a way to compute it without walking for a million steps.","live":null,"does":[[215.90387499999997,"chart is hidden from the screen — left the board."],[215.90387499999997,"baseline is hidden from the screen — chart left the board."],[215.90387499999997,"tag_a is hidden from the screen — chart left the board."],[215.90387499999997,"tag_b is hidden from the screen — chart left the board."],[215.90387499999997,"tag_c is hidden from the screen — chart left the board."],[215.90387499999997,"tag_d is hidden from the screen — chart left the board."],[215.90387499999997,"tag_e is hidden from the screen — chart left the board."],[215.90387499999997,"tag_f is hidden from the screen — chart left the board."],[215.90387499999997,"bar_a is hidden from the screen — chart left the board."],[215.90387499999997,"bar_b is hidden from the screen — chart left the board."],[215.90387499999997,"bar_c is hidden from the screen — chart left the board."],[215.90387499999997,"bar_d is hidden from the screen — chart left the board."],[215.90387499999997,"bar_e is hidden from the screen — chart left the board."],[215.90387499999997,"bar_f is hidden from the screen — chart left the board."],[215.90387499999997,"head_walk is hidden from the screen — left the board."],[215.90387499999997,"web is hidden from the screen — left the board."],[215.90387499999997,"node_a is hidden from the screen — web left the board."],[215.90387499999997,"node_b is hidden from the screen — web left the board."],[215.90387499999997,"node_c is hidden from the screen — web left the board."],[215.90387499999997,"node_d is hidden from the screen — web left the board."],[215.90387499999997,"node_e is hidden from the screen — web left the board."],[215.90387499999997,"node_f is hidden from the screen — web left the board."],[215.90387499999997,"edge_ab is hidden from the screen — web left the board."],[215.90387499999997,"edge_ac is hidden from the screen — web left the board."],[215.90387499999997,"edge_bc is hidden from the screen — web left the board."],[215.90387499999997,"edge_bd is hidden from the screen — web left the board."],[215.90387499999997,"edge_ca is hidden from the screen — web left the board."],[215.90387499999997,"edge_da is hidden from the screen — web left the board."],[215.90387499999997,"edge_de is hidden from the screen — web left the board."],[215.90387499999997,"edge_ea is hidden from the screen — web left the board."],[215.90387499999997,"edge_ef is hidden from the screen — web left the board."],[215.90387499999997,"edge_fa is hidden from the screen — web left the board."]]}]},{"title":"The Same Walk as a Matrix","start":216.94554166666663,"end":447.83802083333325,"objects":{"H_math":"a Math [text] that says \"$H = mat(0, 0, 1, 1/2, 1/2, 1;1/2, 0, 0, 0, 0, 0;1/2, 1/2, 0, 0, 0, 0;0, 1/2, 0, 0, 0, 0;0, 0, 0, 1/2, 0, 0;0, 0, 0, 0, 1/2, 0)$\"","bar_a":"a Vector [green] labelled \"0.167\" drawn in chart (start=(0.7, 0.0), end=(0.7, <VariableNumber p_a = 0.372>))","bar_b":"a Vector [green] labelled \"0.167\" drawn in chart (start=(1.7, 0.0), end=(1.7, <VariableNumber p_b = 0.186>))","bar_c":"a Vector [green] labelled \"0.167\" drawn in chart (start=(2.7, 0.0), end=(2.7, <VariableNumber p_c = 0.279>))","bar_d":"a Vector [green] labelled \"0.167\" drawn in chart (start=(3.7, 0.0), end=(3.7, <VariableNumber p_d = 0.093>))","bar_e":"a Vector [green] labelled \"0.167\" drawn in chart (start=(4.7, 0.0), end=(4.7, <VariableNumber p_e = 0.047>))","bar_f":"a Vector [green] labelled \"0.167\" drawn in chart (start=(5.7, 0.0), end=(5.7, <VariableNumber p_f = 0.023>))","baseline":"a Line [gray] drawn in chart (start=(0.15, 0.0), end=(6.45, 0.0))","chart":"a Figure (x_range=(0.0, 6.6), y_range=(-0.16, 0.56), aspect=(6.6, 3.6))","edge_ab":"a Vector [gray] drawn in web (start=(3.0, 3.5), end=(4.3, 5.75), trim_tip=True)","edge_ac":"a CurvedArrow [gray] drawn in web (start=(3.0, 3.5), end=(4.3, 1.25), bend=0.35)","edge_bc":"a Vector [gray] drawn in web (start=(4.3, 5.75), end=(4.3, 1.25), trim_tip=True)","edge_bd":"a Vector [gray] drawn in web (start=(4.3, 5.75), end=(6.9, 5.75), trim_tip=True)","edge_ca":"a CurvedArrow [gray] drawn in web (start=(4.3, 1.25), end=(3.0, 3.5), bend=0.35)","edge_da":"a Vector [gray] drawn in web (start=(6.9, 5.75), end=(3.0, 3.5), trim_tip=True)","edge_de":"a Vector [gray] drawn in web (start=(6.9, 5.75), end=(8.2, 3.5), trim_tip=True)","edge_ea":"a Vector [gray] drawn in web (start=(8.2, 3.5), end=(3.0, 3.5), trim_tip=True)","edge_ef":"a Vector [gray] drawn in web (start=(8.2, 3.5), end=(6.9, 1.25), trim_tip=True)","edge_fa":"a Vector [gray] drawn in web (start=(6.9, 1.25), end=(3.0, 3.5), trim_tip=True)","eigen_eq":"a Math [text] that says \"$H x = x$\"","eq_a":"a Math [text] that says \"$y_A = x_C + frac(1, 2) x_D + frac(1, 2) x_E + x_F$\"","eq_b":"a Math [text] that says \"$y_B = frac(1, 2) x_A$\"","eq_c":"a Math [text] that says \"$y_C = frac(1, 2) x_A + frac(1, 2) x_B$\"","head_matrix":"a Heading that says \"Every Link, in One Matrix\"","head_power":"a Heading that says \"Multiply, and Multiply Again\"","head_step":"a Heading that says \"One Step of the Walk, as Arithmetic\"","node_a":"a Point [blue] labelled \"A\" drawn in web (location=(3.0, 3.5), marker_radius=0.15)","node_b":"a Point [blue] labelled \"B\" drawn in web (location=(4.3, 5.75), marker_radius=0.15)","node_c":"a Point [blue] labelled \"C\" drawn in web (location=(4.3, 1.25), marker_radius=0.15)","node_d":"a Point [blue] labelled \"D\" drawn in web (location=(6.9, 5.75), marker_radius=0.15)","node_e":"a Point [blue] labelled \"E\" drawn in web (location=(8.2, 3.5), marker_radius=0.15)","node_f":"a Point [blue] labelled \"F\" drawn in web (location=(6.9, 1.25), marker_radius=0.15)","p_a":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_b":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_c":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_d":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_e":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_f":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","step_eq":"a Math [text] that says \"$x_(k+1) = H x_k$\"","tag_a":"a Math [text] that says \"$A$\" drawn in chart","tag_b":"a Math [text] that says \"$B$\" drawn in chart","tag_c":"a Math [text] that says \"$C$\" drawn in chart","tag_d":"a Math [text] that says \"$D$\" drawn in chart","tag_e":"a Math [text] that says \"$E$\" drawn in chart","tag_f":"a Math [text] that says \"$F$\" drawn in chart","web":"a Figure (x_range=(1.6, 9.6), y_range=(0.2, 7.0), aspect=(8.0, 6.8))","work":"an Arithmetic [text] that says \"$0.167 0.083 0.083 0.167 0.500$\" (operator='+', operands=('0.167', '0.083', '0.083', '0.167'), result='0.500')"},"beats":[{"start":216.94554166666663,"say":"The surfer's rule is short. Take whatever rank you have, divide it equally among your outgoing links, and hand it on. Let's write that down one page at a time, calling the new numbers y and the old ones x.","live":[],"does":[[216.94554166666663,"head_step is shown on the screen, written out."],[216.94554166666663,"web is shown on the screen, written out."],[216.94554166666663,"node_a is shown on the screen, written out."],[217.04554166666662,"node_b is shown on the screen, written out."],[217.14554166666662,"node_c is shown on the screen, written out."],[217.24554166666664,"node_d is shown on the screen, written out."],[217.34554166666663,"node_e is shown on the screen, written out."],[217.44554166666663,"node_f is shown on the screen, written out."],[217.48554166666662,"edge_ab is shown on the screen, drawn."],[217.57554166666662,"edge_ac is shown on the screen, drawn."],[217.66554166666663,"edge_bc is shown on the screen, drawn."],[217.75554166666663,"edge_bd is shown on the screen, drawn."],[217.84554166666663,"edge_ca is shown on the screen, drawn."],[217.93554166666664,"edge_da is shown on the screen, drawn."],[218.02554166666664,"edge_de is shown on the screen, drawn."],[218.11554166666662,"edge_ea is shown on the screen, drawn."],[218.20554166666662,"edge_ef is shown on the screen, drawn."],[218.29554166666662,"edge_fa is shown on the screen, drawn."]]},{"start":230.13054166666663,"say":"Start with B, because B is the easy one. Exactly one page points at it, and that is A. A has two links out, so A hands over half of what it has. The new value of B is half the old value of A.","live":["web","head_step","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa"],"does":[[236.1685416666666,"edge_ab is emphasized."],[239.62754166666662,"web moves to a new place on the board."],[239.62754166666662,"eq_b is shown on the screen, written out."],[244.66654166666663,"edge_ab is no longer emphasized."]]},{"start":245.26654166666663,"say":"C is fed by two pages, A and B, and both of them have two links out, so both hand over half of theirs. The new C is half of A, plus half of B.","live":["eq_b","web","head_step","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa"],"does":[[245.98654166666662,"edge_ac is emphasized."],[245.98654166666662,"edge_bc is emphasized."],[253.09154166666661,"eq_c is shown on the screen, written out."],[253.09154166666661,"edge_ac is no longer emphasized."],[253.09154166666661,"edge_bc is no longer emphasized."]]},{"start":256.50104166666665,"say":"A is fed by four pages. C and F have only one link each, so they hand over everything they have. D and E have two links each, so they hand over half. The new A is C, plus half of D, plus half of E, plus F.","live":["eq_b","eq_c","web","head_step","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa"],"does":[[260.29754166666663,"edge_ca is emphasized."],[260.29754166666663,"edge_fa is emphasized."],[264.6975416666666,"edge_ca is no longer emphasized."],[264.6975416666666,"edge_fa is no longer emphasized."],[264.6975416666666,"edge_da is emphasized."],[264.6975416666666,"edge_ea is emphasized."],[267.58854166666663,"eq_a is shown on the screen, written out."],[267.58854166666663,"edge_da is no longer emphasized."],[267.58854166666663,"edge_ea is no longer emphasized."]]},{"start":272.5190416666666,"say":"There are six of these, one per page, and every one of them has the same shape: a weighted sum of the old numbers, with the weights read straight off the links. Which is precisely what a matrix is for.","live":["eq_b","eq_c","eq_a","web","head_step","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa"],"does":[[284.3265416666666,"eq_a moves to a new place on the board."],[284.3265416666666,"eq_b is hidden from the screen — left the board."],[284.3265416666666,"eq_c is hidden from the screen — left the board."],[284.3265416666666,"head_step is hidden from the screen — left the board."]]},{"start":285.5265416666666,"say":"Here is the whole web as one matrix. Six rows and six columns, one of each per page, in the order A, B, C, D, E, F.","live":["eq_a","web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa"],"does":[[285.5265416666666,"head_matrix is shown on the screen, written out."],[287.2795416666666,"H_math is shown on the screen, written out."]]},{"start":295.9835416666666,"say":"A column tells you what one page does with its rank. The column for A has two entries of one half, sitting in the B row and the C row, because A splits its vote between B and C.","live":["eq_a","web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa","H_math","head_matrix"],"does":[[299.89554166666665,"H_math (the \"column=1\" part) is emphasized."],[307.1520416666666,"H_math (the \"column=1\" part) is no longer emphasized."]]},{"start":307.7520416666666,"say":"The column for C has a single one in it, up in the A row, because C has one link and gives everything to A. And every column adds up to exactly one, which is the bookkeeping that says rank is never created and never destroyed.","live":null,"does":[[309.0415416666666,"H_math (the \"column=3\" part) is emphasized."],[314.6835416666666,"H_math (the \"column=3\" part) is no longer emphasized."],[317.3885416666666,"H_math is indicated — a transient flash."]]},{"start":321.5990416666666,"say":"Read across instead of down and you get what a page receives. The A row has four non zero entries, and they are exactly the four terms we wrote a minute ago: C, half of D, half of E, and F.","live":null,"does":[[326.5335416666666,"H_math (the \"row=1\" part) is emphasized."],[330.09754166666664,"eq_a is indicated — a transient flash."],[334.4050416666666,"H_math (the \"row=1\" part) is no longer emphasized."]]},{"start":335.0050416666666,"say":"So one step of the walk is one matrix times one vector. Call the numbers at step k, x sub k. Then the next lot is H times x sub k. And then you do it again.","live":null,"does":[[337.9075416666666,"step_eq is shown on the screen, written out."],[346.8125416666666,"step_eq moves to a new place on the board."],[346.8125416666666,"H_math is hidden from the screen — left the board."],[346.8125416666666,"eq_a is hidden from the screen — left the board."],[346.8125416666666,"head_matrix is hidden from the screen — left the board."],[346.8125416666666,"web is hidden from the screen — left the board."],[346.8125416666666,"node_a is hidden from the screen — web left the board."],[346.8125416666666,"node_b is hidden from the screen — web left the board."],[346.8125416666666,"node_c is hidden from the screen — web left the board."],[346.8125416666666,"node_d is hidden from the screen — web left the board."],[346.8125416666666,"node_e is hidden from the screen — web left the board."],[346.8125416666666,"node_f is hidden from the screen — web left the board."],[346.8125416666666,"edge_ab is hidden from the screen — web left the board."],[346.8125416666666,"edge_ac is hidden from the screen — web left the board."],[346.8125416666666,"edge_bc is hidden from the screen — web left the board."],[346.8125416666666,"edge_bd is hidden from the screen — web left the board."],[346.8125416666666,"edge_ca is hidden from the screen — web left the board."],[346.8125416666666,"edge_da is hidden from the screen — web left the board."],[346.8125416666666,"edge_de is hidden from the screen — web left the board."],[346.8125416666666,"edge_ea is hidden from the screen — web left the board."],[346.8125416666666,"edge_ef is hidden from the screen — web left the board."],[346.8125416666666,"edge_fa is hidden from the screen — web left the board."]]},{"start":348.0125416666666,"say":"Start from the vector that knows nothing at all: one sixth on every page.","live":["step_eq"],"does":[[348.0125416666666,"head_power is shown on the screen, written out."],[348.0125416666666,"chart is shown on the screen, written out."],[348.0125416666666,"baseline is shown on the screen, written out."],[348.0125416666666,"tag_a is shown on the screen, written out."],[348.09254166666665,"tag_b is shown on the screen, written out."],[348.1725416666666,"tag_c is shown on the screen, written out."],[348.2525416666666,"tag_d is shown on the screen, written out."],[348.3325416666666,"tag_e is shown on the screen, written out."],[348.4125416666666,"tag_f is shown on the screen, written out."],[351.2635416666666,"bar_a is shown on the screen, written out."],[351.3835416666666,"bar_b is shown on the screen, written out."],[351.5035416666666,"bar_c is shown on the screen, written out."],[351.6235416666666,"bar_d is shown on the screen, written out."],[351.7435416666666,"bar_e is shown on the screen, written out."],[351.8635416666666,"bar_f is shown on the screen, written out."]]},{"start":353.7090416666666,"say":"Multiply once, and watch what A collects. All of C, which is zero point one six seven. Half of D, and then half of E, which is zero point zero eight three apiece. And all of F, another zero point one six seven.","live":["step_eq","chart","head_power","baseline","tag_a","tag_b","tag_c","tag_d","tag_e","tag_f","bar_a","bar_b","bar_c","bar_d","bar_e","bar_f"],"does":[[357.5755416666666,"work is shown on the screen, written out."],[360.8145416666666,"work is shown on the screen, written out."],[361.7895416666666,"work is shown on the screen, written out."],[365.4815416666666,"work is shown on the screen, written out."]]},{"start":368.3570416666666,"say":"Rule a line under those four and add them up. A comes out at exactly one half. Which is a wildly lopsided first step: everything that pointed at A has dumped its whole share in at once.","live":null,"does":[[368.46154166666656,"work is shown on the screen, drawn."],[369.2615416666666,"work is shown on the screen, drawn."],[373.1985416666666,"work is shown on the screen, written out."],[375.7525416666666,"bar_a is redrawn as the numbers it depends on change."],[375.7525416666666,"bar_b is redrawn as the numbers it depends on change."],[375.7525416666666,"bar_c is redrawn as the numbers it depends on change."],[375.7525416666666,"bar_d is redrawn as the numbers it depends on change."],[375.7525416666666,"bar_e is redrawn as the numbers it depends on change."],[375.7525416666666,"bar_f is redrawn as the numbers it depends on change."],[375.7525416666666,"p_a ticks to 0.5."],[375.7525416666666,"p_b ticks to 0.083."],[375.7525416666666,"p_c ticks to 0.167."],[375.7525416666666,"p_d ticks to 0.083."],[375.7525416666666,"p_e ticks to 0.083."],[375.7525416666666,"p_f ticks to 0.083."]]},{"start":381.15854166666657,"say":"Multiply again and it swings back the other way. A gives half of that pile to B and half to C, so those two jump up, and A itself drops to a third.","live":null,"does":[[382.9695416666666,"bar_a is redrawn as the numbers it depends on change."],[382.9695416666666,"bar_b is redrawn as the numbers it depends on change."],[382.9695416666666,"bar_c is redrawn as the numbers it depends on change."],[382.9695416666666,"bar_d is redrawn as the numbers it depends on change."],[382.9695416666666,"bar_e is redrawn as the numbers it depends on change."],[382.9695416666666,"bar_f is redrawn as the numbers it depends on change."],[382.9695416666666,"p_a ticks to 0.333."],[382.9695416666666,"p_b ticks to 0.25."],[382.9695416666666,"p_c ticks to 0.292."],[382.9695416666666,"p_d ticks to 0.042."],[382.9695416666666,"p_e ticks to 0.042."],[382.9695416666666,"p_f ticks to 0.042."]]},{"start":392.0220416666666,"say":"Do it a third time, and the numbers swing again. And a fourth, and again. They wobble, and every time round the wobble is a little smaller than it was.","live":null,"does":[[392.6135416666666,"bar_a is redrawn as the numbers it depends on change."],[392.6135416666666,"bar_b is redrawn as the numbers it depends on change."],[392.6135416666666,"bar_d is redrawn as the numbers it depends on change."],[392.6135416666666,"bar_e is redrawn as the numbers it depends on change."],[392.6135416666666,"bar_f is redrawn as the numbers it depends on change."],[392.6135416666666,"p_a ticks to 0.375."],[392.6135416666666,"p_b ticks to 0.167."],[392.6135416666666,"p_c ticks to 0.292."],[392.6135416666666,"p_d ticks to 0.125."],[392.6135416666666,"p_e ticks to 0.021."],[392.6135416666666,"p_f ticks to 0.021."],[395.65554166666664,"bar_a is redrawn as the numbers it depends on change."],[395.65554166666664,"bar_b is redrawn as the numbers it depends on change."],[395.65554166666664,"bar_c is redrawn as the numbers it depends on change."],[395.65554166666664,"bar_d is redrawn as the numbers it depends on change."],[395.65554166666664,"bar_e is redrawn as the numbers it depends on change."],[395.65554166666664,"bar_f is redrawn as the numbers it depends on change."],[395.65554166666664,"p_a ticks to 0.385."],[395.65554166666664,"p_b ticks to 0.188."],[395.65554166666664,"p_c ticks to 0.271."],[395.65554166666664,"p_d ticks to 0.083."],[395.65554166666664,"p_e ticks to 0.063."],[395.65554166666664,"p_f ticks to 0.01."]]},{"start":402.1770416666666,"say":"By about the twelfth multiplication they have stopped changing in the third decimal place, and they are the same six numbers the surfer found by walking. Three seven two on A, two seven nine on C, one eight six on B.","live":null,"does":[[403.04754166666663,"bar_a is redrawn as the numbers it depends on change."],[403.04754166666663,"bar_b is redrawn as the numbers it depends on change."],[403.04754166666663,"bar_c is redrawn as the numbers it depends on change."],[403.04754166666663,"bar_d is redrawn as the numbers it depends on change."],[403.04754166666663,"bar_e is redrawn as the numbers it depends on change."],[403.04754166666663,"bar_f is redrawn as the numbers it depends on change."],[403.04754166666663,"p_a ticks to 0.372."],[403.04754166666663,"p_b ticks to 0.186."],[403.04754166666663,"p_c ticks to 0.279."],[403.04754166666663,"p_d ticks to 0.093."],[403.04754166666663,"p_e ticks to 0.047."],[403.04754166666663,"p_f ticks to 0.023."],[410.5945416666666,"bar_a is indicated — a transient flash."],[412.48654166666665,"bar_c is indicated — a transient flash."],[414.40254166666665,"bar_b is indicated — a transient flash."]]},{"start":416.5230416666666,"say":"This is the power method. Multiplying by H over and over drives any starting vector towards the one vector that H leaves alone. An eigenvector of the link matrix, with eigenvalue one.","live":null,"does":[[423.89554166666665,"eigen_eq is shown on the screen, written out."]]},{"start":429.4650416666666,"say":"And that is genuinely how it is done. On a web of a billion pages the matrix is almost entirely zeros, so a single multiplication is cheap, and a few dozen of them is the whole computation. There is only one problem. All of that assumes the walk can always carry on.","live":["step_eq","eigen_eq","chart","head_power","baseline","tag_a","tag_b","tag_c","tag_d","tag_e","tag_f","bar_a","bar_b","bar_c","bar_d","bar_e","bar_f"],"does":[[446.79635416666656,"chart is hidden from the screen — left the board."],[446.79635416666656,"baseline is hidden from the screen — chart left the board."],[446.79635416666656,"tag_a is hidden from the screen — chart left the board."],[446.79635416666656,"tag_b is hidden from the screen — chart left the board."],[446.79635416666656,"tag_c is hidden from the screen — chart left the board."],[446.79635416666656,"tag_d is hidden from the screen — chart left the board."],[446.79635416666656,"tag_e is hidden from the screen — chart left the board."],[446.79635416666656,"tag_f is hidden from the screen — chart left the board."],[446.79635416666656,"bar_a is hidden from the screen — chart left the board."],[446.79635416666656,"bar_b is hidden from the screen — chart left the board."],[446.79635416666656,"bar_c is hidden from the screen — chart left the board."],[446.79635416666656,"bar_d is hidden from the screen — chart left the board."],[446.79635416666656,"bar_e is hidden from the screen — chart left the board."],[446.79635416666656,"bar_f is hidden from the screen — chart left the board."],[446.79635416666656,"eigen_eq is hidden from the screen — left the board."],[446.79635416666656,"head_power is hidden from the screen — left the board."],[446.79635416666656,"step_eq is hidden from the screen — left the board."],[446.79635416666656,"work is hidden from the screen — left the board."]]}]},{"title":"Dangling Pages, Traps, and the Bored Surfer","start":447.83802083333325,"end":680.7949583333332,"objects":{"bar_a":"a Vector [green] labelled \"0.167\" drawn in chart (start=(0.7, 0.0), end=(0.7, <VariableNumber p_a = 0.354>))","bar_b":"a Vector [green] labelled \"0.167\" drawn in chart (start=(1.7, 0.0), end=(1.7, <VariableNumber p_b = 0.175>))","bar_c":"a Vector [green] labelled \"0.167\" drawn in chart (start=(2.7, 0.0), end=(2.7, <VariableNumber p_c = 0.25>))","bar_d":"a Vector [green] labelled \"0.167\" drawn in chart (start=(3.7, 0.0), end=(3.7, <VariableNumber p_d = 0.1>))","bar_e":"a Vector [green] labelled \"0.167\" drawn in chart (start=(4.7, 0.0), end=(4.7, <VariableNumber p_e = 0.067>))","bar_f":"a Vector [green] labelled \"0.167\" drawn in chart (start=(5.7, 0.0), end=(5.7, <VariableNumber p_f = 0.054>))","baseline":"a Line [gray] drawn in chart (start=(0.15, 0.0), end=(6.45, 0.0))","chart":"a Figure (x_range=(0.0, 6.6), y_range=(-0.16, 0.56), aspect=(6.6, 3.6))","damp_eq":"a Math [text] that says \"$x_(k+1) = 0.85 thin H x_k + frac(0.15, n) bold(1)$\"","dead_note":"a Tex [text] that says \"$F$ has no links out, so its column of $H$ is all zeros.\"","edge_ab":"a Vector [gray] drawn in web (start=(3.0, 3.5), end=(4.3, 5.75), trim_tip=True)","edge_ac":"a CurvedArrow [gray] drawn in web (start=(3.0, 3.5), end=(4.3, 1.25), bend=0.35)","edge_bc":"a Vector [gray] drawn in web (start=(4.3, 5.75), end=(4.3, 1.25), trim_tip=True)","edge_bd":"a Vector [gray] drawn in web (start=(4.3, 5.75), end=(6.9, 5.75), trim_tip=True)","edge_ca":"a CurvedArrow [gray] drawn in web (start=(4.3, 1.25), end=(3.0, 3.5), bend=0.35)","edge_da":"a Vector [gray] drawn in web (start=(6.9, 5.75), end=(3.0, 3.5), trim_tip=True)","edge_de":"a Vector [gray] drawn in web (start=(6.9, 5.75), end=(8.2, 3.5), trim_tip=True)","edge_ea":"a Vector [gray] drawn in web (start=(8.2, 3.5), end=(3.0, 3.5), trim_tip=True)","edge_ef":"a Vector [gray] drawn in web (start=(8.2, 3.5), end=(6.9, 1.25), trim_tip=True)","edge_fa":"a Vector [gray] drawn in web (start=(6.9, 1.25), end=(3.0, 3.5), trim_tip=True)","edge_fe":"a Vector [red] drawn in web (start=(6.9, 1.25), end=(8.2, 3.5), trim_tip=True)","head_damp":"a Heading that says \"The Surfer Gets Bored\"","head_dangling":"a Heading that says \"A Page With No Way Out\"","head_final":"a Heading that says \"The Ranking, With Damping On\"","head_trap":"a Heading that says \"A Pair That Keeps It All\"","node_a":"a Point [blue] labelled \"A\" drawn in web (location=(3.0, 3.5), marker_radius=0.15)","node_b":"a Point [blue] labelled \"B\" drawn in web (location=(4.3, 5.75), marker_radius=0.15)","node_c":"a Point [blue] labelled \"C\" drawn in web (location=(4.3, 1.25), marker_radius=0.15)","node_d":"a Point [blue] labelled \"D\" drawn in web (location=(6.9, 5.75), marker_radius=0.15)","node_e":"a Point [blue] labelled \"E\" drawn in web (location=(8.2, 3.5), marker_radius=0.15)","node_f":"a Point [blue] labelled \"F\" drawn in web (location=(6.9, 1.25), marker_radius=0.15)","p_a":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_b":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_c":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_d":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_e":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","p_f":"a VariableNumber (initial_value=0.16666666666666666, format_spec='.3f')","point":"a Point [yellow] drawn in web (location=(6.9, 1.25))","point_2":"a Point [yellow] drawn in web (location=(6.9, 5.75))","readout":"a Point [text] labelled \"upright(\"total\") = 1.000\" drawn in chart (location=(3.3, 0.5), show_marker=False)","tag_a":"a Math [text] that says \"$A$\" drawn in chart","tag_b":"a Math [text] that says \"$B$\" drawn in chart","tag_c":"a Math [text] that says \"$C$\" drawn in chart","tag_d":"a Math [text] that says \"$D$\" drawn in chart","tag_e":"a Math [text] that says \"$E$\" drawn in chart","tag_f":"a Math [text] that says \"$F$\" drawn in chart","teleport_note":"a Panel that says \"With probability $0.85$ the surfer clicks a random link. With probability $0.15$ it stops clicking and jumps to a page chosen uniformly at random. Here $bold(1)$ is the vector of all ones and $n$ is the number of pages.\"","total":"a VariableNumber (initial_value=1.0, format_spec='.3f')","trap_note":"a Tex [text] that says \"$E$ and $F$ link only to each other: a rank sink.\"","walker":"a Point [yellow] drawn in web (location=(<VariableNumber wx = 3.0>, <VariableNumber wy = 3.5>), marker_radius=0.09)","web":"a Figure (x_range=(1.6, 9.6), y_range=(0.2, 7.0), aspect=(8.0, 6.8))","wx":"a VariableNumber (initial_value=8.2)","wy":"a VariableNumber (initial_value=3.5)"},"beats":[{"start":447.83802083333325,"say":"Real webs are not that tidy. Plenty of pages have no outgoing links at all: a PDF, an image, a page that simply never links anywhere. So take our web and delete the single link out of F.","live":[],"does":[[447.83802083333325,"head_dangling is shown on the screen, written out."],[447.83802083333325,"web is shown on the screen, written out."],[447.83802083333325,"node_a is shown on the screen, written out."],[447.93802083333327,"node_b is shown on the screen, written out."],[448.03802083333323,"node_c is shown on the screen, written out."],[448.13802083333326,"node_d is shown on the screen, written out."],[448.2380208333332,"node_e is shown on the screen, written out."],[448.33802083333325,"node_f is shown on the screen, written out."],[448.37802083333327,"edge_ab is shown on the screen, drawn."],[448.46802083333324,"edge_ac is shown on the screen, drawn."],[448.5580208333333,"edge_bc is shown on the screen, drawn."],[448.64802083333325,"edge_bd is shown on the screen, drawn."],[448.7380208333332,"edge_ca is shown on the screen, drawn."],[448.82802083333326,"edge_da is shown on the screen, drawn."],[448.91802083333323,"edge_de is shown on the screen, drawn."],[449.00802083333326,"edge_ea is shown on the screen, drawn."],[449.09802083333324,"edge_ef is shown on the screen, drawn."],[449.18802083333327,"edge_fa is shown on the screen, drawn."],[458.43802083333327,"edge_fa is hidden from the screen."]]},{"start":461.10452083333325,"say":"Now the surfer walks into F and stops dead, because there is nothing there to click on. In the matrix, that column is all zeros. F takes rank in, and hands none of it back out.","live":["web","head_dangling","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef"],"does":[[461.10452083333325,"walker is shown on the screen, written out."],[463.06702083333323,"walker is redrawn as the numbers it depends on change."],[463.06702083333323,"wx ticks to 6.9."],[463.06702083333323,"wy ticks to 1.25."],[468.11702083333324,"web moves to a new place on the board."],[468.11702083333324,"dead_note is shown on the screen, written out."]]},{"start":473.24502083333323,"say":"Watch what that does to the numbers. At every step, whatever share is sitting on F simply vanishes. After one multiplication the total has already fallen to zero point eight three.","live":["dead_note","web","head_dangling","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","walker"],"does":[[473.24502083333323,"chart is shown on the screen, written out."],[473.24502083333323,"baseline is shown on the screen, written out."],[473.24502083333323,"readout is shown on the screen, written out."],[473.24502083333323,"tag_a is shown on the screen, written out."],[473.32502083333327,"tag_b is shown on the screen, written out."],[473.40502083333325,"tag_c is shown on the screen, written out."],[473.48502083333324,"tag_d is shown on the screen, written out."],[473.5650208333332,"tag_e is shown on the screen, written out."],[473.64502083333326,"tag_f is shown on the screen, written out."],[473.84502083333325,"bar_a is shown on the screen, written out."],[473.9450208333332,"bar_b is shown on the screen, written out."],[474.04502083333324,"bar_c is shown on the screen, written out."],[474.14502083333326,"bar_d is shown on the screen, written out."],[474.24502083333323,"bar_e is shown on the screen, written out."],[474.34502083333325,"bar_f is shown on the screen, written out."],[482.38202083333323,"readout is redrawn as the numbers it depends on change."],[482.38202083333323,"bar_a is redrawn as the numbers it depends on change."],[482.38202083333323,"bar_b is redrawn as the numbers it depends on change."],[482.38202083333323,"bar_c is redrawn as the numbers it depends on change."],[482.38202083333323,"bar_d is redrawn as the numbers it depends on change."],[482.38202083333323,"bar_e is redrawn as the numbers it depends on change."],[482.38202083333323,"bar_f is redrawn as the numbers it depends on change."],[482.38202083333323,"p_a ticks to 0.333."],[482.38202083333323,"p_b ticks to 0.083."],[482.38202083333323,"p_c ticks to 0.167."],[482.38202083333323,"p_d ticks to 0.083."],[482.38202083333323,"p_e ticks to 0.083."],[482.38202083333323,"p_f ticks to 0.083."],[482.38202083333323,"total ticks to 0.833."]]},{"start":485.03702083333326,"say":"Again, and it is down to three quarters. Again, and it keeps slipping away. Twenty steps in, there is essentially nothing left anywhere, and it is still falling.","live":["dead_note","chart","web","head_dangling","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","walker","baseline","readout","tag_a","tag_b","tag_c","tag_d","tag_e","tag_f","bar_a","bar_b","bar_c","bar_d","bar_e","bar_f"],"does":[[487.12702083333323,"readout is redrawn as the numbers it depends on change."],[487.12702083333323,"bar_a is redrawn as the numbers it depends on change."],[487.12702083333323,"bar_b is redrawn as the numbers it depends on change."],[487.12702083333323,"bar_c is redrawn as the numbers it depends on change."],[487.12702083333323,"bar_d is redrawn as the numbers it depends on change."],[487.12702083333323,"bar_e is redrawn as the numbers it depends on change."],[487.12702083333323,"bar_f is redrawn as the numbers it depends on change."],[487.12702083333323,"p_a ticks to 0.25."],[487.12702083333323,"p_b ticks to 0.167."],[487.12702083333323,"p_c ticks to 0.208."],[487.12702083333323,"p_d ticks to 0.042."],[487.12702083333323,"p_e ticks to 0.042."],[487.12702083333323,"p_f ticks to 0.042."],[487.12702083333323,"total ticks to 0.75."],[489.54202083333325,"readout is redrawn as the numbers it depends on change."],[489.54202083333325,"bar_b is redrawn as the numbers it depends on change."],[489.54202083333325,"bar_d is redrawn as the numbers it depends on change."],[489.54202083333325,"bar_e is redrawn as the numbers it depends on change."],[489.54202083333325,"bar_f is redrawn as the numbers it depends on change."],[489.54202083333325,"p_a ticks to 0.25."],[489.54202083333325,"p_b ticks to 0.125."],[489.54202083333325,"p_c ticks to 0.208."],[489.54202083333325,"p_d ticks to 0.083."],[489.54202083333325,"p_e ticks to 0.021."],[489.54202083333325,"p_f ticks to 0.021."],[489.54202083333325,"total ticks to 0.708."],[492.80402083333325,"readout is redrawn as the numbers it depends on change."],[492.80402083333325,"bar_a is redrawn as the numbers it depends on change."],[492.80402083333325,"bar_b is redrawn as the numbers it depends on change."],[492.80402083333325,"bar_c is redrawn as the numbers it depends on change."],[492.80402083333325,"bar_d is redrawn as the numbers it depends on change."],[492.80402083333325,"bar_e is redrawn as the numbers it depends on change."],[492.80402083333325,"bar_f is redrawn as the numbers it depends on change."],[492.80402083333325,"p_a ticks to 0.018."],[492.80402083333325,"p_b ticks to 0.009."],[492.80402083333325,"p_c ticks to 0.013."],[492.80402083333325,"p_d ticks to 0.005."],[492.80402083333325,"p_e ticks to 0.003."],[492.80402083333325,"p_f ticks to 0.002."],[492.80402083333325,"total ticks to 0.05."]]},{"start":496.17902083333325,"say":"Which ranks nothing against anything. Every page has been driven towards zero, and the ordering has gone with it.","live":null,"does":[[500.25402083333324,"readout is indicated — a transient flash."],[502.93602083333326,"dead_note is hidden from the screen — left the board."],[502.93602083333326,"head_dangling is hidden from the screen — left the board."]]},{"start":503.5360208333332,"say":"Now the opposite failure. Give F a link out again, but point it at E rather than at A, and cut the link from E to A. Set the numbers back to an even sixth each.","live":["chart","web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","walker","baseline","readout","tag_a","tag_b","tag_c","tag_d","tag_e","tag_f","bar_a","bar_b","bar_c","bar_d","bar_e","bar_f"],"does":[[503.5360208333332,"head_trap is shown on the screen, written out."],[507.2980208333332,"edge_fe is shown on the screen, written out."],[509.53802083333323,"edge_ea is hidden from the screen."],[509.53802083333323,"trap_note is shown on the screen, written out."],[512.0340208333332,"readout is redrawn as the numbers it depends on change."],[512.0340208333332,"bar_a is redrawn as the numbers it depends on change."],[512.0340208333332,"bar_b is redrawn as the numbers it depends on change."],[512.0340208333332,"bar_c is redrawn as the numbers it depends on change."],[512.0340208333332,"bar_d is redrawn as the numbers it depends on change."],[512.0340208333332,"bar_e is redrawn as the numbers it depends on change."],[512.0340208333332,"bar_f is redrawn as the numbers it depends on change."],[512.0340208333332,"p_a ticks to 0.16666666666666666."],[512.0340208333332,"p_b ticks to 0.16666666666666666."],[512.0340208333332,"p_c ticks to 0.16666666666666666."],[512.0340208333332,"p_d ticks to 0.16666666666666666."],[512.0340208333332,"p_e ticks to 0.16666666666666666."],[512.0340208333332,"p_f ticks to 0.16666666666666666."],[512.0340208333332,"total ticks to 1.0."]]},{"start":514.5850208333333,"say":"The surfer wanders in, and then it bounces between the two of them forever. There is no way out at all. That pattern has a name: a rank sink, or a spider trap.","live":["chart","web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ef","walker","baseline","readout","tag_a","tag_b","tag_c","tag_d","tag_e","tag_f","bar_a","bar_b","bar_c","bar_d","bar_e","bar_f","trap_note","head_trap","edge_fe"],"does":[[516.9530208333332,"walker is redrawn as the numbers it depends on change."],[516.9530208333332,"wx ticks to 8.2."],[516.9530208333332,"wy ticks to 3.5."],[518.1530208333332,"walker is redrawn as the numbers it depends on change."],[518.1530208333332,"wx ticks to 6.9."],[518.1530208333332,"wy ticks to 1.25."],[519.3530208333332,"walker is redrawn as the numbers it depends on change."],[519.3530208333332,"wx ticks to 8.2."],[519.3530208333332,"wy ticks to 3.5."],[520.5530208333332,"walker is redrawn as the numbers it depends on change."],[520.5530208333332,"wx ticks to 6.9."],[520.5530208333332,"wy ticks to 1.25."]]},{"start":525.3675208333332,"say":"And the numbers go the other way. Instead of draining out of the web, everything piles into the pair. After enough steps E and F hold the whole thing between them, and A, B, C and D are all heading for zero.","live":null,"does":[[530.0690208333333,"bar_a is redrawn as the numbers it depends on change."],[530.0690208333333,"bar_b is redrawn as the numbers it depends on change."],[530.0690208333333,"bar_c is redrawn as the numbers it depends on change."],[530.0690208333333,"bar_d is redrawn as the numbers it depends on change."],[530.0690208333333,"bar_e is redrawn as the numbers it depends on change."],[530.0690208333333,"bar_f is redrawn as the numbers it depends on change."],[530.0690208333333,"p_a ticks to 0.001."],[530.0690208333333,"p_b ticks to 0.001."],[530.0690208333333,"p_c ticks to 0.001."],[530.0690208333333,"p_d ticks to 0.001."],[530.0690208333333,"p_e ticks to 0.498."],[530.0690208333333,"p_f ticks to 0.498."]]},{"start":538.4245208333332,"say":"Two pages that nobody else even links to have taken the entire ranking. And both failures come from the same place: the walk cannot carry on properly. So set the numbers level again, and let's fix it.","live":null,"does":[[548.8040208333332,"bar_a is redrawn as the numbers it depends on change."],[548.8040208333332,"bar_b is redrawn as the numbers it depends on change."],[548.8040208333332,"bar_c is redrawn as the numbers it depends on change."],[548.8040208333332,"bar_d is redrawn as the numbers it depends on change."],[548.8040208333332,"bar_e is redrawn as the numbers it depends on change."],[548.8040208333332,"bar_f is redrawn as the numbers it depends on change."],[548.8040208333332,"p_a ticks to 0.16666666666666666."],[548.8040208333332,"p_b ticks to 0.16666666666666666."],[548.8040208333332,"p_c ticks to 0.16666666666666666."],[548.8040208333332,"p_d ticks to 0.16666666666666666."],[548.8040208333332,"p_e ticks to 0.16666666666666666."],[548.8040208333332,"p_f ticks to 0.16666666666666666."],[551.3230208333332,"bar_a is hidden from the screen."],[551.3230208333332,"bar_b is hidden from the screen."],[551.3230208333332,"bar_c is hidden from the screen."],[551.3230208333332,"bar_d is hidden from the screen."],[551.3230208333332,"bar_e is hidden from the screen."],[551.3230208333332,"bar_f is hidden from the screen."],[551.3230208333332,"tag_a is hidden from the screen."],[551.3230208333332,"tag_b is hidden from the screen."],[551.3230208333332,"tag_c is hidden from the screen."],[551.3230208333332,"tag_d is hidden from the screen."],[551.3230208333332,"tag_e is hidden from the screen."],[551.3230208333332,"tag_f is hidden from the screen."],[551.3230208333332,"baseline is hidden from the screen."],[551.3230208333332,"readout is hidden from the screen."],[551.3230208333332,"chart is hidden from the screen."],[551.3230208333332,"head_trap is hidden from the screen — left the board."],[551.3230208333332,"trap_note is hidden from the screen — left the board."]]},{"start":552.5230208333332,"say":"Both of them have the same one line cure, and it is the nicest idea in the whole algorithm. The surfer gets bored.","live":["web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ef","walker","edge_fe"],"does":[[552.5230208333332,"head_damp is shown on the screen, written out."]]},{"start":560.6815208333333,"say":"Eighty five times out of a hundred, click a random link, exactly as before. The other fifteen times, stop clicking altogether: type an address straight into the bar, and jump to a page picked uniformly at random from the entire web.","live":["web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ef","walker","edge_fe","head_damp"],"does":[[560.9370208333332,"teleport_note is shown on the screen, written out."]]},{"start":576.1650208333333,"say":"So the update gains a second term. Zero point eight five times H times x, which is the clicking, plus zero point one five over n on every page, which is the jumping. That first constant is the damping factor.","live":["web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ef","walker","edge_fe","teleport_note","head_damp"],"does":[[577.8020208333332,"damp_eq is shown on the screen, written out."],[582.6900208333333,"damp_eq (the \"0.85 thin H x_k\" part) is emphasized."],[587.2530208333333,"damp_eq (the \"0.85 thin H x_k\" part) is no longer emphasized."],[587.2530208333333,"damp_eq (the \"frac(0.15, n) bold(1)\" part) is emphasized."],[590.1900208333333,"damp_eq (the \"0.85\" part) is indicated — a transient flash."],[590.1900208333333,"damp_eq (the \"frac(0.15, n) bold(1)\" part) is no longer emphasized."]]},{"start":592.2650208333332,"say":"Watch it undo both problems. From a dead end, jumping is the only move there is, so the walk carries on and nothing leaks away. From inside the trap, the surfer escapes fifteen times in a hundred, so it can never be held there forever.","live":["web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ef","walker","edge_fe","teleport_note","damp_eq","head_damp"],"does":[[596.7110208333332,"walker is redrawn as the numbers it depends on change."],[596.7110208333332,"wx ticks to 4.3."],[596.7110208333332,"wy ticks to 1.25."],[603.7590208333332,"walker is redrawn as the numbers it depends on change."],[603.7590208333332,"wx ticks to 3.0."],[603.7590208333332,"wy ticks to 3.5."]]},{"start":608.7240208333333,"say":"And every page in the web now receives at least zero point one five over n, no matter who links to it. So no rank is ever exactly zero, and the ordering always exists, whatever the link structure happens to look like.","live":null,"does":[[611.0230208333332,"point is shown on the screen, grown."],[613.0230208333332,"point is hidden from the screen."],[613.4230208333333,"point_2 is shown on the screen, grown."],[615.4230208333333,"point_2 is hidden from the screen."],[621.7275208333333,"damp_eq is hidden from the screen — left the board."],[621.7275208333333,"head_damp is hidden from the screen — left the board."],[621.7275208333333,"teleport_note is hidden from the screen — left the board."]]},{"start":622.3275208333332,"say":"So put the original web back, with F pointing at A once more and E linking out again, and run the damped iteration on it.","live":["web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ef","walker","edge_fe"],"does":[[622.3275208333332,"head_final is shown on the screen, written out."],[622.3275208333332,"walker is hidden from the screen."],[625.3690208333333,"edge_fe is hidden from the screen."],[625.3690208333333,"edge_fa is shown on the screen, written out."],[627.4710208333332,"edge_ea is shown on the screen, written out."],[629.2240208333333,"chart is shown on the screen, written out."],[629.2240208333333,"baseline is shown on the screen, written out."],[629.2240208333333,"readout is shown on the screen, written out."],[629.2240208333333,"tag_a is shown on the screen, written out."],[629.3040208333333,"tag_b is shown on the screen, written out."],[629.3840208333332,"tag_c is shown on the screen, written out."],[629.4640208333333,"tag_d is shown on the screen, written out."],[629.5440208333332,"tag_e is shown on the screen, written out."],[629.6240208333332,"tag_f is shown on the screen, written out."],[629.8240208333333,"bar_a is shown on the screen, written out."],[629.9240208333333,"bar_b is shown on the screen, written out."],[630.0240208333332,"bar_c is shown on the screen, written out."],[630.1240208333332,"bar_d is shown on the screen, written out."],[630.2240208333333,"bar_e is shown on the screen, written out."],[630.3240208333333,"bar_f is shown on the screen, written out."]]},{"start":631.5885208333332,"say":"These are the numbers it settles on. A lands at about zero point three five, C at zero point two five, B at zero point one eight, and then D, E and F at a tenth, seven hundredths and five hundredths.","live":["chart","web","node_a","node_b","node_c","node_d","node_e","node_f","edge_ab","edge_ac","edge_bc","edge_bd","edge_ca","edge_da","edge_de","edge_ea","edge_ef","edge_fa","baseline","readout","tag_a","tag_b","tag_c","tag_d","tag_e","tag_f","bar_a","bar_b","bar_c","bar_d","bar_e","bar_f","head_final"],"does":[[632.8190208333333,"bar_a is redrawn as the numbers it depends on change."],[632.8190208333333,"bar_b is redrawn as the numbers it depends on change."],[632.8190208333333,"bar_c is redrawn as the numbers it depends on change."],[632.8190208333333,"bar_d is redrawn as the numbers it depends on change."],[632.8190208333333,"bar_e is redrawn as the numbers it depends on change."],[632.8190208333333,"bar_f is redrawn as the numbers it depends on change."],[632.8190208333333,"p_a ticks to 0.354."],[632.8190208333333,"p_b ticks to 0.175."],[632.8190208333333,"p_c ticks to 0.25."],[632.8190208333333,"p_d ticks to 0.1."],[632.8190208333333,"p_e ticks to 0.067."],[632.8190208333333,"p_f ticks to 0.054."],[634.2010208333332,"bar_a is indicated — a transient flash."],[637.2310208333333,"bar_c is indicated — a transient flash."],[640.2730208333332,"bar_b is indicated — a transient flash."],[643.1760208333333,"bar_d is indicated — a transient flash."],[643.6980208333333,"bar_e is indicated — a transient flash."],[644.1280208333333,"bar_f is indicated — a transient flash."]]},{"start":648.2920208333333,"say":"Same order as the undamped walk gave us, but everything has been pulled a little way towards the flat one sixth. A has given some back, and F has more than doubled. That is the fifteen percent of ignorance mixing itself back in.","live":null,"does":[[655.7450208333332,"bar_a is indicated — a transient flash."],[658.1250208333332,"bar_f is indicated — a transient flash."],[659.9360208333333,"readout is indicated — a transient flash."]]},{"start":663.7055208333333,"say":"So that is PageRank. A link is a vote. A vote is worth the rank of the page casting it, divided between all the links that page casts. And the ranking is the vector that stops changing when you multiply it by the damped link matrix.","live":null,"does":[[679.7532916666665,"chart is hidden from the screen — left the board."],[679.7532916666665,"baseline is hidden from the screen — chart left the board."],[679.7532916666665,"readout is hidden from the screen — chart left the board."],[679.7532916666665,"tag_a is hidden from the screen — chart left the board."],[679.7532916666665,"tag_b is hidden from the screen — chart left the board."],[679.7532916666665,"tag_c is hidden from the screen — chart left the board."],[679.7532916666665,"tag_d is hidden from the screen — chart left the board."],[679.7532916666665,"tag_e is hidden from the screen — chart left the board."],[679.7532916666665,"tag_f is hidden from the screen — chart left the board."],[679.7532916666665,"bar_a is hidden from the screen — chart left the board."],[679.7532916666665,"bar_b is hidden from the screen — chart left the board."],[679.7532916666665,"bar_c is hidden from the screen — chart left the board."],[679.7532916666665,"bar_d is hidden from the screen — chart left the board."],[679.7532916666665,"bar_e is hidden from the screen — chart left the board."],[679.7532916666665,"bar_f is hidden from the screen — chart left the board."],[679.7532916666665,"head_final is hidden from the screen — left the board."],[679.7532916666665,"web is hidden from the screen — left the board."],[679.7532916666665,"node_a is hidden from the screen — web left the board."],[679.7532916666665,"node_b is hidden from the screen — web left the board."],[679.7532916666665,"node_c is hidden from the screen — web left the board."],[679.7532916666665,"node_d is hidden from the screen — web left the board."],[679.7532916666665,"node_e is hidden from the screen — web left the board."],[679.7532916666665,"node_f is hidden from the screen — web left the board."],[679.7532916666665,"edge_ab is hidden from the screen — web left the board."],[679.7532916666665,"edge_ac is hidden from the screen — web left the board."],[679.7532916666665,"edge_bc is hidden from the screen — web left the board."],[679.7532916666665,"edge_bd is hidden from the screen — web left the board."],[679.7532916666665,"edge_ca is hidden from the screen — web left the board."],[679.7532916666665,"edge_da is hidden from the screen — web left the board."],[679.7532916666665,"edge_de is hidden from the screen — web left the board."],[679.7532916666665,"edge_ea is hidden from the screen — web left the board."],[679.7532916666665,"edge_ef is hidden from the screen — web left the board."],[679.7532916666665,"edge_fa is hidden from the screen — web left the board."]]}]}]},"durationSeconds":681,"chapters":[{"title":"A Surfer on a Small Web","startSeconds":0,"narration":"Nineteen ninety eight. The web has millions of pages on it, and somebody has to put them in order. Counting the words on a page is easy to fake. What is much harder to fake is what everybody else links to. So treat a hyperlink as a vote. Here is a web with six pages on it. Call them A through F, and every arrow is one hyperlink, pointing from the page that casts the vote to the page that receives it. A links to B and to C. B links to C and to D. C links back to A. D links to A and to E. E links to A and to F. And F links only to A. The crude way to use that is simply to count. Four arrows point at A. Two point at C. And B, D, E and F have one each. So A wins, and four pages are tied for last, which is not much of a ranking. And it is trivially cheatable. Every vote counted the same, so a link from a page nobody has ever read is worth exactly as much as a link from the front page of a newspaper. So here is the fix, and the lovely thing about it is that it stops talking about voting altogether. Imagine somebody sitting at page A who does nothing but click links at random. A has two links out, so flip a coin. It comes up C. C has only one link, so the surfer goes back to A. From A the coin says B this time. B has two links out and picks C again. C takes it back to A. Nobody is choosing anything clever there. It is all coin flips. And the surfer never arrives anywhere, because it never stops, so the question to ask is not where it ends up. It is what fraction of its time it spends on each page. Before the walk starts we know nothing at all, so give every page an equal share of the credit: one sixth each, about zero point one six seven. Now let the surfer run for a hundred steps and count where it landed. A took about forty one percent of the visits, C about twenty five, B about seventeen, and D, E and F share what little is left. Ten thousand steps, and the numbers steady. A million, and they stop moving altogether. This is what the walk settles on. A holds about thirty seven percent of the surfer's time, C twenty eight, B nineteen, and then it falls away sharply: nine, five and two percent for D, E and F. Those six numbers are the PageRank of this little web. And look at what those numbers are not. They are not the link count. B and D have exactly one arrow pointing at each of them, and yet B ends up worth twice as much as D. Look at where each of those single votes comes from. The one pointing at B comes from A, the most visited page on this web, and A splits its rank between two links. So B gets half of A. The one pointing at D comes from B, split two ways again, so D gets half of B. The same halving carries on down the chain. D hands half of what it has to E, and E hands half of that to F. That is why the last four numbers are each exactly half the one before them. So a vote from a heavily visited page is worth more than a vote from a quiet one, and a page that links to everything gives less to each. That is the whole idea, and it came out of a coin flip. What we do not have yet is a way to compute it without walking for a million steps."},{"title":"The Same Walk as a Matrix","startSeconds":216.94554166666663,"narration":"The surfer's rule is short. Take whatever rank you have, divide it equally among your outgoing links, and hand it on. Let's write that down one page at a time, calling the new numbers y and the old ones x. Start with B, because B is the easy one. Exactly one page points at it, and that is A. A has two links out, so A hands over half of what it has. The new value of B is half the old value of A. C is fed by two pages, A and B, and both of them have two links out, so both hand over half of theirs. The new C is half of A, plus half of B. A is fed by four pages. C and F have only one link each, so they hand over everything they have. D and E have two links each, so they hand over half. The new A is C, plus half of D, plus half of E, plus F. There are six of these, one per page, and every one of them has the same shape: a weighted sum of the old numbers, with the weights read straight off the links. Which is precisely what a matrix is for. Here is the whole web as one matrix. Six rows and six columns, one of each per page, in the order A, B, C, D, E, F. A column tells you what one page does with its rank. The column for A has two entries of one half, sitting in the B row and the C row, because A splits its vote between B and C. The column for C has a single one in it, up in the A row, because C has one link and gives everything to A. And every column adds up to exactly one, which is the bookkeeping that says rank is never created and never destroyed. Read across instead of down and you get what a page receives. The A row has four non zero entries, and they are exactly the four terms we wrote a minute ago: C, half of D, half of E, and F. So one step of the walk is one matrix times one vector. Call the numbers at step k, x sub k. Then the next lot is H times x sub k. And then you do it again. Start from the vector that knows nothing at all: one sixth on every page. Multiply once, and watch what A collects. All of C, which is zero point one six seven. Half of D, and then half of E, which is zero point zero eight three apiece. And all of F, another zero point one six seven. Rule a line under those four and add them up. A comes out at exactly one half. Which is a wildly lopsided first step: everything that pointed at A has dumped its whole share in at once. Multiply again and it swings back the other way. A gives half of that pile to B and half to C, so those two jump up, and A itself drops to a third. Do it a third time, and the numbers swing again. And a fourth, and again. They wobble, and every time round the wobble is a little smaller than it was. By about the twelfth multiplication they have stopped changing in the third decimal place, and they are the same six numbers the surfer found by walking. Three seven two on A, two seven nine on C, one eight six on B. This is the power method. Multiplying by H over and over drives any starting vector towards the one vector that H leaves alone. An eigenvector of the link matrix, with eigenvalue one. And that is genuinely how it is done. On a web of a billion pages the matrix is almost entirely zeros, so a single multiplication is cheap, and a few dozen of them is the whole computation. There is only one problem. All of that assumes the walk can always carry on."},{"title":"Dangling Pages, Traps, and the Bored Surfer","startSeconds":447.83802083333325,"narration":"Real webs are not that tidy. Plenty of pages have no outgoing links at all: a PDF, an image, a page that simply never links anywhere. So take our web and delete the single link out of F. Now the surfer walks into F and stops dead, because there is nothing there to click on. In the matrix, that column is all zeros. F takes rank in, and hands none of it back out. Watch what that does to the numbers. At every step, whatever share is sitting on F simply vanishes. After one multiplication the total has already fallen to zero point eight three. Again, and it is down to three quarters. Again, and it keeps slipping away. Twenty steps in, there is essentially nothing left anywhere, and it is still falling. Which ranks nothing against anything. Every page has been driven towards zero, and the ordering has gone with it. Now the opposite failure. Give F a link out again, but point it at E rather than at A, and cut the link from E to A. Set the numbers back to an even sixth each. The surfer wanders in, and then it bounces between the two of them forever. There is no way out at all. That pattern has a name: a rank sink, or a spider trap. And the numbers go the other way. Instead of draining out of the web, everything piles into the pair. After enough steps E and F hold the whole thing between them, and A, B, C and D are all heading for zero. Two pages that nobody else even links to have taken the entire ranking. And both failures come from the same place: the walk cannot carry on properly. So set the numbers level again, and let's fix it. Both of them have the same one line cure, and it is the nicest idea in the whole algorithm. The surfer gets bored. Eighty five times out of a hundred, click a random link, exactly as before. The other fifteen times, stop clicking altogether: type an address straight into the bar, and jump to a page picked uniformly at random from the entire web. So the update gains a second term. Zero point eight five times H times x, which is the clicking, plus zero point one five over n on every page, which is the jumping. That first constant is the damping factor. Watch it undo both problems. From a dead end, jumping is the only move there is, so the walk carries on and nothing leaks away. From inside the trap, the surfer escapes fifteen times in a hundred, so it can never be held there forever. And every page in the web now receives at least zero point one five over n, no matter who links to it. So no rank is ever exactly zero, and the ordering always exists, whatever the link structure happens to look like. So put the original web back, with F pointing at A once more and E linking out again, and run the damped iteration on it. These are the numbers it settles on. A lands at about zero point three five, C at zero point two five, B at zero point one eight, and then D, E and F at a tenth, seven hundredths and five hundredths. Same order as the undamped walk gave us, but everything has been pulled a little way towards the flat one sixth. A has given some back, and F has more than doubled. That is the fifteen percent of ignorance mixing itself back in. So that is PageRank. A link is a vote. A vote is worth the rank of the page casting it, divided between all the links that page casts. And the ranking is the vector that stops changing when you multiply it by the damped link matrix."}]}}
