27#ifndef _H_GRB_PREGEL_PAGERANK
28#define _H_GRB_PREGEL_PAGERANK
35 namespace algorithms {
53 template<
typename IOType,
bool localConverge >
88 IOType ¤t_score,
89 const IOType &incoming_message,
90 IOType &outgoing_message,
91 const Data ¶meters,
95 if( pregel.
round == 0 ) {
96 current_score =
static_cast< IOType
>( 1 );
102 const bool dbg = pregel.
vertexID == 0;
104 std::cout <<
"ID: " << pregel.
vertexID <<
"\n"
105 <<
"\t active: " << pregel.
active <<
"\n"
106 <<
"\t round: " << pregel.
round <<
"\n"
107 <<
"\t previous score: " << current_score <<
"\n"
108 <<
"\t incoming message: " << incoming_message <<
"\n";
113 if( pregel.
round > 0 ) {
114 const IOType old_score = current_score;
115 current_score = parameters.
alpha +
116 (
static_cast< IOType
>(1) - parameters.
alpha) * incoming_message;
117 if( fabs(current_score-old_score) < parameters.
tolerance ) {
119 std::cout <<
"\t\t vertex " << pregel.
vertexID <<
" converged\n";
121 if( localConverge ) {
138 std::cout <<
"\t current score: " << current_score <<
"\n"
139 <<
"\t voteToHalt: " << pregel.
voteToHalt <<
"\n"
140 <<
"\t outgoing message: " << outgoing_message <<
"\n";
182 template<
typename PregelType >
188 const size_t max_steps = 0
201 return pregel.template
execute<
A GraphBLAS vector.
Definition: vector.hpp:64
Standard identity for numerical addition.
Definition: identities.hpp:57
A Pregel run-time instance.
Definition: pregel.hpp:340
size_t num_vertices() const noexcept
Queries the maximum vertex ID for programs running on this Pregel instance.
Definition: pregel.hpp:928
This operator takes the sum of the two input parameters and writes it to the output variable.
Definition: ops.hpp:177
size_t size(const Vector< DataType, backend, Coords > &x) noexcept
Request the size of a given vector.
Definition: io.hpp:235
constexpr const SparsificationStrategy out_sparsify
What sparsification strategy should be applied to the outgoing messages.
Definition: pregel.hpp:242
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:452
RC
Return codes of ALP primitives.
Definition: rc.hpp:47
@ MISMATCH
One or more of the ALP/GraphBLAS objects passed to the primitive that returned this error have mismat...
Definition: rc.hpp:90
This file defines a vertex-centric programming API called ALP/Pregel, which automatically translates ...
The state of the vertex-center Pregel program that the user may interface with.
Definition: pregel.hpp:266
bool & voteToHalt
Represents whether this (active) vertex votes to terminate the program.
Definition: pregel.hpp:291
bool & active
Represents whether the current vertex is active.
Definition: pregel.hpp:282
const size_t & round
The current round the vertex-centric program is currently executing.
Definition: pregel.hpp:316
const size_t & vertexID
A unique ID of this vertex.
Definition: pregel.hpp:324
const size_t & outdegree
The out-degree of this vertex.
Definition: pregel.hpp:306