32 double *
rscale, *prold, *prnew, *prtmp;
33 double fromsinks,
error;
43 prold = gk_dsmalloc(nrows, 0,
"gk_rw_PageRank: prnew");
44 prnew = gk_dsmalloc(nrows, 0,
"gk_rw_PageRank: prold");
45 rscale = gk_dsmalloc(nrows, 0,
"gk_rw_PageRank: rscale");
49 for (
i=0;
i<nrows;
i++) {
50 for (
j=rowptr[
i];
j<rowptr[
i+1];
j++)
57 for (
i=0;
i<nrows;
i++)
63 gk_dset(nrows, 0.0, prnew);
68 for (fromsinks=0.0,
i=0;
i<nrows;
i++) {
70 fromsinks += prold[
i];
74 for (
i=0;
i<nrows;
i++) {
75 for (
j=rowptr[
i];
j<rowptr[
i+1];
j++)
76 prnew[rowind[
j]] += prold[
i]*
rscale[
i]*rowval[
j];
80 for (
i=0;
i<nrows;
i++) {
81 prnew[
i] = lamda*(fromsinks*pr[
i]+prnew[
i]) + (1.0-lamda)*pr[
i];
95 for (
i=0;
i<nrows;
i++)
100 return (
int)(
iter+1);