1 #ifndef __SOCIAL_NETWORK_GRAPH__
2 #define __SOCIAL_NETWORK_GRAPH__
7 #include <boost/random/mersenne_twister.hpp>
8 #include <boost/random/discrete_distribution.hpp>
29 template <
class TopoDiscoveryStrategy_t >
34 std::set<size_t>
execute(
size_t numMasters,
size_t dimensions,
size_t id,
49 boost::random::mt19937
gen_;
62 int64_t south =
myID_ - m;
65 size_t east =
myID_ + 1;
66 if((
myID_ + 1) % m == 0)
68 size_t west =
myID_ - 1;
103 int x_from = from / m;
104 int y_from = from % m;
108 return abs(x_from - x_to) +
abs(y_from - y_to);
115 std::vector<double> probabilities(
numMasters_, 0.0);
119 if(i ==
myID_)
continue;
125 if(i ==
myID_)
continue;
131 boost::random::discrete_distribution<>
132 dist(probabilities.begin(), probabilities.end());
boost::random::mt19937 gen_
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
double manhattenDistance(size_t from, size_t to)
T::PETE_Expr_t::PETE_Return_t sum(const PETE_Expr< T > &expr)
void setNetworkNeighbors()
void chooseRandomNeighbor()
Tps< T > pow(const Tps< T > &x, int y)
Integer power.
Tps< T > sqrt(const Tps< T > &x)
Square root.
std::set< size_t > realNetworkNeighborPIDs_
Modeling social graph (Cartesian neighbors plus additional random link) as underlaying master network...
std::set< size_t > execute(size_t numMasters, size_t dimensions, size_t id, int island_id)