| 1 |  | 
|---|
| 2 | #include <boost/graph/use_mpi.hpp> | 
|---|
| 3 |  | 
|---|
| 4 | #include <boost/graph/distributed/betweenness_centrality.hpp> | 
|---|
| 5 |  | 
|---|
| 6 | #include <boost/graph/distributed/adjacency_list.hpp> | 
|---|
| 7 |  | 
|---|
| 8 | #include <boost/config.hpp> | 
|---|
| 9 | #include <boost/throw_exception.hpp> | 
|---|
| 10 | #include <boost/graph/distributed/mpi_process_group.hpp> | 
|---|
| 11 | #include <boost/graph/distributed/concepts.hpp> | 
|---|
| 12 | #include <boost/graph/erdos_renyi_generator.hpp> | 
|---|
| 13 |  | 
|---|
| 14 | #include <boost/random/linear_congruential.hpp> | 
|---|
| 15 | #include <boost/graph/graphviz.hpp> | 
|---|
| 16 | #include <boost/property_map/vector_property_map.hpp> | 
|---|
| 17 |  | 
|---|
| 18 | // METIS Input | 
|---|
| 19 | #include <boost/graph/metis.hpp> | 
|---|
| 20 | #include <boost/graph/distributed/graphviz.hpp> | 
|---|
| 21 |  | 
|---|
| 22 | //#include <cstring> | 
|---|
| 23 |  | 
|---|
| 24 | #ifdef BOOST_NO_EXCEPTIONS | 
|---|
| 25 | void | 
|---|
| 26 | boost::throw_exception(std::exception const& ex) | 
|---|
| 27 | { | 
|---|
| 28 | std::cout << ex.what() << std::endl; | 
|---|
| 29 | abort(); | 
|---|
| 30 | } | 
|---|
| 31 | #endif | 
|---|
| 32 |  | 
|---|
| 33 | using namespace boost; | 
|---|
| 34 | using boost::graph::distributed::mpi_process_group; | 
|---|
| 35 |  | 
|---|
| 36 | int main(int argc, char* argv[]) | 
|---|
| 37 | { | 
|---|
| 38 | mpi::environment env(argc, argv); | 
|---|
| 39 |  | 
|---|
| 40 | typedef adjacency_list<vecS, | 
|---|
| 41 | distributedS<mpi_process_group, vecS>, | 
|---|
| 42 | undirectedS, | 
|---|
| 43 | property<vertex_centrality_t,float>, | 
|---|
| 44 | property<edge_weight_t, int> > Graph; | 
|---|
| 45 |  | 
|---|
| 46 | const char* filename = argv[1]; | 
|---|
| 47 |  | 
|---|
| 48 | // Open the METIS input file | 
|---|
| 49 | std::ifstream in(filename); | 
|---|
| 50 | graph::metis_reader reader(in); | 
|---|
| 51 |  | 
|---|
| 52 | /* | 
|---|
| 53 | const char* partitions_file = argv[2]; | 
|---|
| 54 | mpi_process_group pg; | 
|---|
| 55 | std::ifstream in_partitions(partitions_file); | 
|---|
| 56 | boost::graph::metis_distribution dist(in_partitions, pg); | 
|---|
| 57 | */ | 
|---|
| 58 |  | 
|---|
| 59 |  | 
|---|
| 60 | // Load the graph using the default distribution | 
|---|
| 61 | Graph g(reader.begin(), reader.end(), reader.weight_begin(), | 
|---|
| 62 | reader.num_vertices()/*, pg, dist*/); | 
|---|
| 63 |  | 
|---|
| 64 | // Test Betweenness Centrality | 
|---|
| 65 | brandes_betweenness_centrality(g, centrality_map(get(vertex_centrality,g))); | 
|---|
| 66 |  | 
|---|
| 67 | return 0; | 
|---|
| 68 | } | 
|---|