1.PageRank算法介绍
PageRank,网页排名,又称网页级别、Google左侧排名或佩奇排名,是一种由[1] 根据网页之间相互的超链接计算的技术,而作为网页排名的要素之一,以Google公司创办人拉里·佩奇(Larry Page)之姓来命名。Google用它来体现网页的相关性和重要性,在搜索引擎优化操作中是经常被用来评估网页优化的成效因素之一。Google的创始人拉里·佩奇和谢尔盖·布林于1998年在斯坦福大学发明了这项技术。
PageRank通过网络浩瀚的超链接关系来确定一个页面的等级。Google把从A页面到B页面的链接解释为A页面给B页面投票,Google根据投票来源(甚至来源的来源,即链接到A页面的页面)和投票目标的等级来决定新的等级。简单的说,一个高等级的页面可以使其他低等级页面的等级提升。
2.PageRank算法原理
3.GraphLite图运算系统的PageRank算法实现
/**
* @file PageRankVertex.cc
* This file implements the PageRank algorithm using graphlite API.
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "GraphLite.h"
#define VERTEX_CLASS_NAME(name) PageRankVertex##name
#define EPS 1e-6
//class PageRankVertexInputFormatter: public InputFormatter
class VERTEX_CLASS_NAME(InputFormatter): public InputFormatter {
public:
int64_t getVertexNum() {
unsigned long long n;
sscanf(m_ptotal_vertex_line, "%lld", &n);// read one long long number ,and let n=it
printf("at class PageRankVertexInputFormatter: m_total_vertex= %lld \n",n);
m_total_vertex= n;
return m_total_vertex;
}
int64_t getEdgeNum() {
unsigned long long n;
sscanf(m_ptotal_edge_line, "%lld", &n);// read one long long number ,and let n=it
m_total_edge= n;
printf("at class PageRankVertexInputFormatter: m_total_edge= %lld \n",n);
return m_total_edge;
}
int getVertexValueSize() {
m_n_value_size =