Boost logo

Boost Users :

Subject: [Boost-users] How to create distributed_property_map
From: îÉËÏÌÁÊ ëÉÎÁÛ (peroksid90_at_[hidden])
Date: 2014-01-05 16:15:12


Hello.

I try to calculate brandes_betweenness_centrality.

#include <boost/graph/use_mpi.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/graph/distributed/mpi_process_group.hpp>
#include <boost/graph/parallel/process_group.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/distributed/adjacency_list.hpp>
#include <boost/graph/small_world_generator.hpp>
#include <boost/random/linear_congruential.hpp>
#include <boost/graph/distributed/betweenness_centrality.hpp>
#include <boost/graph/distributed/graphviz.hpp>
#include <boost/graph/rmat_graph_generator.hpp>
#include <boost/random/linear_congruential.hpp>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace boost;
using namespace graph;
using namespace distributed;
namespace mpi = boost::mpi;

typedef boost::adjacency_list<listS,
distributedS<mpi_process_group,vecS>,
undirectedS> 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);

typedef boost::property_map<Graph, vertex_index_t>::type LocalMap;

boost::parallel::distributed_property_map<mpi_process_group, LocalMap,
||||||> centrality_map;
//brandes_betweenness_centrality(g, centrality_map);
}

What should be here "|||||" ?

I see
http://www.boost.org/doc/libs/1_55_0/libs/graph_parallel/doc/html/distributed_property_map.html

template<typename ProcessGroup, typename LocalPropertyMap, typename Key,
typename GhostCellS = gc_mapS>

Key: The key_type of the distributed property map, which must model the
Global Descriptor concept

But don`t understand, is not work - typedef
property_traits<LocalMap>::key_type key_type;

Can you provide example?



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