#define PARALLEL_GRAPH
using
namespace boost;
using boost::graph::distributed::mpi_process_group;
typedef adjacency_list <vecS, vecS, undirectedS> SerialGraph;
typedef adjacency_list<vecS, distributedS<mpi_process_group, vecS>, undirectedS> Graph;
typedef iterator_property_map<std::vector<int>::iterator,
property_map<Graph, vertex_index_t>::type> LocalMap;
static
char help[] =
"";
int main(int
argc,char **args)
{
PetscErrorCode ierr;
PetscInitialize(&argc,&args,(char*)0,help);
int nV =
40000;
int num =
0;
#ifdef PARALLEL_GRAPH
Graph G(nV+1);
synchronize(G);
std::vector<int> localComponent(nV+1);
LocalMap components(localComponent.begin(),get(vertex_index, G));
num = connected_components_ps(G, components);
#else
SerialGraph G(nV+1);
std::vector<int> globalComponent(nV+1);
num = connected_components(G, &globalComponent[0]);
#endif
std::cout << num <<
" connected components" << std::endl;
ierr = PetscFinalize();
return
0;
}