incubator-hama-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward J. Yoon" <edwardy...@apache.org>
Subject Re: [Hama Wiki] Update of "PageRank" by udanax
Date Wed, 13 Aug 2008 13:22:10 GMT
It would be nice if someone can review this with Google Pagerank and
Personal Vector.

-Edward

On Wed, Aug 13, 2008 at 8:24 PM, Apache Wiki <wikidiffs@apache.org> wrote:
> Dear Wiki user,
>
> You have subscribed to a wiki page or wiki category on "Hama Wiki" for change notification.
>
> The following page has been changed by udanax:
> http://wiki.apache.org/hama/PageRank
>
> ------------------------------------------------------------------------------
> - Describe PageRank here.
> + {{{
> + public class PageRank {
>
> +   public static void main(String[] argv) {
> +     int[][] data = {
> +       { 2, 3, 4, 5, 7 },
> +       { 1 },
> +       { 1, 2 },
> +       { 2, 3, 5 },
> +       { 1, 3, 4, 6 },
> +       { 1, 5 },
> +       { 5 }
> +     };
> +
> +     double[][] a = new double[data.length][data.length];
> +     for (int i = 0; i < data.length; i++) {
> +       for (int j = 0; j < data[i].length; j++) {
> +         a[data[i][j] - 1][i] = 1.0 / data[i].length;
> +       }
> +     }
> +     double[] eigVector = new Matrix(a).eigenDecomposition().getV().transpose().getArray()[0];
> +     double norm1 = new Matrix(eigVector , eigVector .length).norm1();
> +     for (int i = 0; i < eigVector.length; i++)
> +       System.out.println(eigVector[i] / norm1);
> +   }
> + }
> + }}}
> +
>



-- 
Best regards, Edward J. Yoon
edwardyoon@apache.org
http://blog.udanax.org

Mime
View raw message