56 #include <boost/random.hpp>
60 namespace havoqgt {
namespace detail {
62 template <
typename DUMMY=u
int64_t>
66 typedef typename std::pair<uint64_t,uint64_t>
edge_type;
74 m_ptr_mask = ~(std::numeric_limits<vertex_descriptor>::max() >> 1);
75 m_alpha = (beta / double(
m_k) + double(1)) / (beta /
double(
m_k) + 2);
85 boost::random::uniform_01<boost::random::mt19937> rand_prob(
m_rng);
86 boost::random::uniform_int_distribution<uint64_t> uid(0,_edge_index-1);
87 uint64_t rand = uid(
m_rng) * 2;
94 uint64_t edge_rand = rand/2;
112 to_return = (uint64_t) floor(
double(-0.5f) +
113 sqrt(
double(0.25f)+
double(2)*
double(i))+1);
125 double tmp = double(-0.5f) + sqrt(
double(0.25f)+
double(2)*
double(i))+1;
126 to_return = (uint64_t) ((tmp - floor(tmp)) * floor(tmp));
142 uint64_t my_partition = i%_num_partitions;
143 uint64_t my_partition_offset = i/_num_partitions;
144 uint64_t edges_per_partition =
m_num_edges / _num_partitions;
145 return my_partition * edges_per_partition + my_partition_offset;
bool is_pointer(vertex_descriptor i)
vertex_descriptor make_pointer(vertex_descriptor i)
uint64_t calc_target(uint64_t i)
preferential_attachment_helper(uint64_t k, uint64_t m, double beta, uint64_t rng_seed=5489)
std::pair< uint64_t, uint64_t > edge_type
boost::random::mt19937 m_rng
edge_type gen_edge(uint64_t _edge_index)
uint64_t vertex_descriptor
uint64_t calc_source(uint64_t i)
uint64_t value_of_pointer(vertex_descriptor i, uint64_t _num_partitions=1)
vertex_descriptor m_ptr_mask