public class Transition
extends Object
Compilation: javac Transition.java
Execution: java Transition < input.txt
Data files: http://introcs.cs.princeton.edu/16pagerank/tiny.txt
http://introcs.cs.princeton.edu/16pagerank/medium.txt
This program is a filter that reads links from standard input and
produces the corresponding transition matrix on standard output.
First, it processes the input to count the outlinks from each page.
Then it applies the 90-10 rule to compute the transition matrix.
It assumes that there are no pages that have no outlinks in the
input (see Exercise 1.6.3).
% more tiny.txt
5
0 1
1 2 1 2
1 3 1 3 1 4
2 3
3 0
4 0 4 2
% java Transition < tiny.txt
5 5
0.02 0.92 0.02 0.02 0.02
0.02 0.02 0.38 0.38 0.20
0.02 0.02 0.02 0.92 0.02
0.92 0.02 0.02 0.02 0.02
0.47 0.02 0.47 0.02 0.02