53 #ifndef HAVOQGT_MPI_PAGE_RANK_HPP_INCLUDED
54 #define HAVOQGT_MPI_PAGE_RANK_HPP_INCLUDED
59 #include <boost/container/deque.hpp>
62 namespace havoqgt {
namespace mpi {
64 template <
typename Visitor>
73 bool push(Visitor
const & task)
75 m_data.push_back(task);
91 return m_data.size();;
96 return m_data.empty();
107 template<
typename Graph,
typename PRData>
127 template<
typename VisitorQueueHandle>
128 bool visit(Graph& g, VisitorQueueHandle vis_queue)
const {
130 uint64_t degree = g.degree(
vertex);
131 double send_rank = 1;
134 typedef typename Graph::edge_iterator eitr_type;
135 for(eitr_type eitr = g.edges_begin(
vertex); eitr != g.edges_end(
vertex); ++eitr) {
136 vertex_locator neighbor = eitr.target();
138 vis_queue->queue_visitor(new_visitor);
155 if(_data) data = _data;
165 template <
typename TGraph,
typename PRData>
168 visitor_type::rank_data(&pr_data);
171 visitor_queue_type vq(&g);
172 vq.init_visitor_traversal();
173 pr_data.all_reduce();
183 #endif //HAVOQGT_MPI_PAGE_RANK_HPP_INCLUDED
friend bool operator>(const pr_visitor &v1, const pr_visitor &v2)
bool push(Visitor const &task)
void page_rank(TGraph &g, PRData &pr_data)
friend bool operator<(const pr_visitor &v1, const pr_visitor &v2)
std::vector< Visitor > m_data
Graph::vertex_locator vertex_locator
bool visit(Graph &g, VisitorQueueHandle vis_queue) const
pr_visitor(vertex_locator _vertex)
pr_visitor(vertex_locator _vertex, double _rank)
static PRData & rank_data(PRData *_data=NULL)