IBM SYSTEMG G RUNTIME & NATIVE STORE
0.5
IBM Native Graph Computing and Storage System based on IBM Parallel Programming Library
|
compute page rank within gShell. This implementaion is adapted from the 2nd page rank algorithm on wiki pagerank, the Matlab description of which is given below. Note that in our adaption, we do not use matrices, but mapped all operations onto graph elements. This plug-in allows uer to specify a vertex subproperty (optional), where we can load/save the page ranks. This plugin is memory-demanding for large scale graphs, since it allocates variables for each vertex and each edge. This plug-in only works for directed graph. More...
#include <plugin_pagerank.h>
Inherits query_base.
Public Member Functions | |
REGISTER_QUERY_TYPE (analytic_pagerank) | |
void | options (command_options &opt) |
int | run (struct query_param_type) |
perform pagerank | |
void | rank_fast (graph_type *g, double damping_factor, double v_quadratic_error, const string &p, bool is_restart, size_t max_iter, bool is_display, internal_outputFormat *o) |
page rank algo implementation | |
double | normalize (graph_type *g, unordered_map< size_t, double > &v, unordered_map< size_t, double > &old_v) |
void | disp (graph_type *g, unordered_map< size_t, double > &v, internal_outputFormat *o) |
compute page rank within gShell. This implementaion is adapted from the 2nd page rank algorithm on wiki pagerank, the Matlab description of which is given below. Note that in our adaption, we do not use matrices, but mapped all operations onto graph elements. This plug-in allows uer to specify a vertex subproperty (optional), where we can load/save the page ranks. This plugin is memory-demanding for large scale graphs, since it allocates variables for each vertex and each edge. This plug-in only works for directed graph.
function [v] = rank2(M, d, v_quadratic_error) N = size(M, 2); % N is equal to half the size of M v = rand(N, 1); v = v ./ norm(v, 1); % This is now L1, not L2 last_v = ones(N, 1) * inf; M_hat = (d .* M) + (((1 - d) / N) .* ones(N, N)); while(norm(v - last_v, 2) > v_quadratic_error) last_v = v; v = M_hat * v; end endfunction
void analytic_pagerank::options | ( | command_options & | opt | ) |
–damp | damping factor |
–quad | quadratic_error |
–prop | vertex subprop name to load/store page ranks (optional) |
–num | maximum number of iterations allowd (optional) |
–restart | ignore PR loaded from vertex subprop |
–display | show the results |