Boost logo

Boost Users :

Subject: Re: [Boost-users] How to create distributed_property_map(??????? ?????)
From: Nikolay Kinash (peroksid90_at_[hidden])
Date: 2014-01-08 23:16:10


Forget it.

I done:

struct centrality_t {
        typedef vertex_property_tag kind;
};

typedef property<centrality_t, double> VertexCentrality;

typedef boost::adjacency_list<listS,
                              distributedS<mpi_process_group,vecS>,
                              undirectedS, VertexCentrality> Graph;

typedef boost::unique_rmat_iterator<boost::minstd_rand, Graph> RMATGen;

struct no_self_loops
{
        no_self_loops() {}
bool operator()(const std::pair<int,int>& 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<no_self_loops>
           (
    RMATGen(gen, N, E, 0.45, 0.15, 0.15, 0.25), RMATGen()),
             boost::make_filter_iterator<no_self_loops>(RMATGen(), RMATGen
()),
           N);

   boost::property_map<Graph, centrality_t>::type centrality_map = get
(centrality_t(), g);

   boost::property_map<Graph, vertex_index_t>::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<vertex_iter, vertex_iter> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net