52 #ifndef HAVOQGT_RMAT_EDGE_GENERATOR_HPP_INCLUDED
53 #define HAVOQGT_RMAT_EDGE_GENERATOR_HPP_INCLUDED
55 #include <boost/random.hpp>
78 class input_iterator_type :
public std::iterator<std::input_iterator_tag, edge_type, ptrdiff_t, const edge_type*, const edge_type&> {
142 boost::uniform_01<boost::mt19937>
m_gen;
151 uint64_t edge_count,
double a,
double b,
double c,
152 double d,
bool scramble,
bool undirected)
193 auto itr_end =
end();
196 while (itr != itr_end) {
197 value = std::max(value, (*itr).first);
198 value = std::max(value, (*itr).second);
201 std::cout <<
" value: " << value << std::endl;
223 uint64_t u = 0, v = 0;
230 else if (p >= rmat_a && p < rmat_a + rmat_b)
232 else if (p >= rmat_a + rmat_b && p < rmat_a + rmat_b + rmat_c)
243 rmat_a *= 0.9 + 0.2 * gen();
244 rmat_b *= 0.9 + 0.2 * gen();
245 rmat_c *= 0.9 + 0.2 * gen();
246 rmat_d *= 0.9 + 0.2 * gen();
248 double S = rmat_a + rmat_b + rmat_c + rmat_d;
250 rmat_a /=
S; rmat_b /=
S; rmat_c /=
S;
253 rmat_d = 1. - rmat_a - rmat_b - rmat_c;
260 return std::make_pair(u, v);
266 boost::uniform_01<boost::mt19937>
m_gen;
279 #endif //HAVOQGT_RMAT_EDGE_GENERATOR_HPP_INCLUDED
const uint64_t m_vertex_scale
uint64_t vertex_descriptor
edge_type generate_edge()
Generates a new RMAT edge. This function was adapted from the Boost Graph Library.
std::pair< uint64_t, uint64_t > edge_type
input_iterator_type begin()
Returns the begin of the input iterator.
rmat_edge_generator(uint64_t seed, uint64_t vertex_scale, uint64_t edge_count, double a, double b, double c, double d, bool scramble, bool undirected)
seed used to be 5489
uint64_t hash_nbits(uint64_t input, int n)
const uint64_t m_edge_count
void sanity_max_vertex_id()
boost::uniform_01< boost::mt19937 > m_gen
input_iterator_type end()
Returns the end of the input iterator.
edge_type generate_edge(boost::uniform_01< boost::mt19937 > &gen)