52 #ifndef HAVOQGT_MPI_TRIANGLE_COUNT_HPP_INCLUDED
53 #define HAVOQGT_MPI_TRIANGLE_COUNT_HPP_INCLUDED
56 #include <boost/container/deque.hpp>
59 namespace havoqgt {
namespace mpi {
62 template <
typename Visitor>
67 std::priority_queue< Visitor, std::deque<Visitor>,
72 bool push(Visitor
const & task)
90 return m_data.size();;
95 return m_data.empty();
105 template<
typename Graph>
142 template<
typename VisitorQueueHandle>
143 bool visit(Graph& g, VisitorQueueHandle vis_queue)
const {
145 if(!
first.is_valid()) {
146 typedef typename Graph::edge_iterator eitr_type;
147 for(eitr_type eitr = g.edges_begin(
vertex); eitr != g.edges_end(
vertex); ++eitr) {
148 vertex_locator neighbor = eitr.target();
149 my_type new_visitor( neighbor,
vertex, g.degree(
vertex) );
150 vis_queue->queue_visitor(new_visitor);
152 }
else if(!
second.is_valid()) {
153 typedef typename Graph::edge_iterator eitr_type;
154 for(eitr_type eitr = g.edges_begin(
vertex); eitr != g.edges_end(
vertex); ++eitr) {
155 vertex_locator neighbor = eitr.target();
157 vis_queue->queue_visitor(new_visitor);
161 typedef typename Graph::edge_iterator eitr_type;
162 for(eitr_type eitr = g.edges_begin(
vertex); eitr != g.edges_end(
vertex); ++eitr) {
163 vertex_locator neighbor = eitr.target();
173 if(!
first.is_valid()) {
182 typedef typename Graph::template vertex_data<uint64_t, std::allocator<uint64_t> >
vdtd_type;
187 static vdtd_type* data;
204 template<
typename Graph>
208 template <
typename TGraph>
212 visitor_type::m_ptr_graph = &g;
215 visitor_queue_type vq(&g);
217 typename graph_type::template vertex_data<uint64_t, std::allocator<uint64_t> > tc_data(g);
218 visitor_type::set_tc_data(&tc_data);
220 vq.init_visitor_traversal(s);
222 return tc_data.global_accumulate();
234 #endif //HAVOQGT_MPI_TRIANGLE_COUNT_HPP_INCLUDED
hmpi::delegate_partitioned_graph< segment_manager_t > graph_type
Graph::template vertex_data< uint64_t, std::allocator< uint64_t > > vdtd_type
triangle_count_visitor(vertex_locator v)
triangle_count_visitor(vertex_locator v, vertex_locator f, vertex_locator s, uint32_t deg)
triangle_priority_queue()
friend bool operator>(const triangle_count_visitor &v1, const triangle_count_visitor &v2)
triangle_count_visitor(vertex_locator v, vertex_locator f, uint32_t deg)
static void set_tc_data(vdtd_type *_data)
triangle_count_visitor< Graph > my_type
static Graph * m_ptr_graph
static vdtd_type *& tc_data()
uint64_t triangle_count(TGraph &g, typename TGraph::vertex_locator s)
bool push(Visitor const &task)
bool visit(Graph &g, VisitorQueueHandle vis_queue) const
Graph::vertex_locator vertex_locator
std::priority_queue< Visitor, std::deque< Visitor >, std::greater< Visitor > > m_data
friend bool operator<(const triangle_count_visitor &v1, const triangle_count_visitor &v2)