// Copyright (C) 2006 The Trustees of Indiana University. // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Authors: Douglas Gregor // Andrew Lumsdaine // A test of the distributed compressed sparse row graph type #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef BOOST_NO_EXCEPTIONS void boost::throw_exception(std::exception const& ex) { std::cout << ex.what() << std::endl; abort(); } #endif using namespace boost; using boost::graph::distributed::mpi_process_group; void concept_checks() { typedef compressed_sparse_row_graph > Digraph; typedef graph_traits::vertex_descriptor vertex_descriptor; typedef graph_traits::edge_descriptor edge_descriptor; function_requires< GraphConcept >(); function_requires< IncidenceGraphConcept >(); function_requires< AdjacencyGraphConcept >(); function_requires< DistributedVertexListGraphConcept >(); function_requires< DistributedEdgeListGraphConcept >(); function_requires< ReadablePropertyGraphConcept >(); function_requires< ReadablePropertyGraphConcept >(); function_requires< ReadablePropertyGraphConcept >(); function_requires< ReadablePropertyGraphConcept >(); function_requires< ReadablePropertyGraphConcept >(); // DPG TBD: edge_owner, edge_local property maps function_requires< ReadablePropertyGraphConcept >(); // Check default construction Digraph g; } int test_main(int argc, char* argv[]) { mpi::environment env(argc, argv); concept_checks(); typedef compressed_sparse_row_graph > Digraph; // Build an Erdos-Renyi graph to test with typedef sorted_erdos_renyi_iterator ERIter; int n = 40; double prob = 0.1; minstd_rand gen; Digraph g(ERIter(gen, n, prob), ERIter(), n); breadth_first_search(g, vertex(0, g), visitor(bfs_visitor<>())); std::ofstream out("dcsr.dot"); write_graphviz(out, g); return 0; }