对于PageRank算法,维基百科和网上很多大牛的博客已经讲得很详细了,这里附上一个自己写的PageRank算法C++实现版本:
/*
* Author: YANG Xiangyu
* The Chinese university of Hong Kong
*/
#include<cstdio>
#include<iostream>
#include<fstream>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
#define MAX 1000000
struct edge //define edge
{
int u;
int v;
}edge[5200000];
int rednum[MAX]={0}; //to mark a point that if it has been visited, and record a new number
int orinum[MAX]={0}; //to record the original number of the new recorded number
int d[MAX]={0}; //to mark the out degree of the point
double ra[MAX]={0}; //to mark the current rank value of the point
double rb[MAX]={0}; //to mark the updated rank value of the point
int cmp(const int &a, const int &b)
{
if(ra[rednu