Forget it.
I done:
struct centrality_t {
typedef vertex_property_tag kind;
};
typedef property VertexCentrality;
typedef boost::adjacency_list,
undirectedS, VertexCentrality> Graph;
typedef boost::unique_rmat_iterator RMATGen;
struct no_self_loops
{
no_self_loops() {}
bool operator()(const std::pair& e) { return e.first != e.second; }
};
int main(int argc, char* argv[])
{
boost::mpi::environment env(argc, argv);
boost::minstd_rand gen;
unsigned int SCALE = atoi(argv[1]);
unsigned int EDGE_FACTOR = atoi(argv[2]);
unsigned int N = pow(2, SCALE);
unsigned int E = EDGE_FACTOR * N;
Graph g(
boost::make_filter_iterator
(
RMATGen(gen, N, E, 0.45, 0.15, 0.15, 0.25), RMATGen()),
boost::make_filter_iterator(RMATGen(), RMATGen
()),
N);
boost::property_map::type centrality_map = get
(centrality_t(), g);
boost::property_map::type index_map = get
(vertex_index_t(), g);
boost::brandes_betweenness_centrality(g, centrality_map);
typedef graph_traits<Graph>::vertex_iterator vertex_iter;
std::pair vp;
for (vp = vertices(g); vp.first != vp.second; ++vp.first)
std::cout << index_map[*vp.first] << ": " << centrality_map
[*vp.first] << "\n";
}
But output looks like mistake.
mpiexec -np 1 ./network2 4 3
0: 5
1: 4
2: 1
3: 0
4: 2
5: 8
6: 1
7: 0
8: 3
9: 3
10: 1
11: 0
12: 5.5
13: 3
14: 1
15: 0