├── .gitattributes ├── .github └── workflows │ └── ci.yml ├── CMakeLists.txt ├── build.jam ├── build └── Jamfile.v2 ├── doc ├── BUILD_DOCS.tcl ├── DistributedEdgeListGraph.rst ├── DistributedGraph.rst ├── DistributedVertexListGraph.rst ├── GlobalDescriptor.rst ├── architecture.graffle ├── architecture.png ├── betweenness_centrality.rst ├── boman_et_al_graph_coloring.rst ├── breadth_first_search.rst ├── connected_components.rst ├── connected_components_parallel_search.rst ├── dehne_gotz_min_spanning_tree.rst ├── dijkstra_dist3_graph.graffle ├── dijkstra_dist3_graph.png ├── dijkstra_example.rst ├── dijkstra_seq_graph.graffle ├── dijkstra_seq_graph.png ├── dijkstra_shortest_paths.rst ├── dist-adjlist.graffle ├── dist-adjlist.png ├── dist-pmap.graffle ├── dist-pmap.png ├── distributed-graph.graffle ├── distributed-graph.png ├── distributedS.rst ├── distributed_adjacency_list.rst ├── distributed_property_map.rst ├── distributed_queue.rst ├── fruchterman_reingold.rst ├── graph.png ├── html │ ├── DistributedEdgeListGraph.html │ ├── DistributedGraph.html │ ├── DistributedVertexListGraph.html │ ├── GlobalDescriptor.html │ ├── betweenness_centrality.html │ ├── boman_et_al_graph_coloring.html │ ├── breadth_first_search.html │ ├── chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_4.png │ ├── chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_4_speedup_1.png │ ├── chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_5.png │ ├── chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_5_speedup_1.png │ ├── chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_4.png │ ├── chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_4_speedup_1.png │ ├── chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_5.png │ ├── chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_5_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_cluster_Odin_columns_11.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_cluster_Odin_columns_11_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_4.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_4_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_5.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_5_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_6.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_6_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_7.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_7_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_8.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_8_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_9.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_9_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_cluster_Odin_columns_11.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_cluster_Odin_columns_11_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_4.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_4_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_5.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_5_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_6.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_6_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_7.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_7_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_8.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_8_speedup_1.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_9.png │ ├── chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_9_speedup_1.png │ ├── chart_php_generator_ER_dataset_TimeDense_columns_5_6_7_8.png │ ├── chart_php_generator_ER_dataset_TimeDense_columns_5_6_7_8_speedup_1.png │ ├── chart_php_generator_ER_dataset_TimeSparse_columns_5_6_7_8.png │ ├── chart_php_generator_ER_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png │ ├── chart_php_generator_SF_dataset_TimeDense_columns_5_6_7_8.png │ ├── chart_php_generator_SF_dataset_TimeDense_columns_5_6_7_8_speedup_1.png │ ├── chart_php_generator_SF_dataset_TimeSparse_columns_5_6_7_8.png │ ├── chart_php_generator_SF_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png │ ├── chart_php_generator_SW_dataset_TimeDense_columns_5_6_7_8.png │ ├── chart_php_generator_SW_dataset_TimeDense_columns_5_6_7_8_speedup_1.png │ ├── chart_php_generator_SW_dataset_TimeSparse_columns_5_6_7_8.png │ ├── chart_php_generator_SW_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png │ ├── connected_components.html │ ├── connected_components_parallel_search.html │ ├── dehne_gotz_min_spanning_tree.html │ ├── dijkstra_example.html │ ├── dijkstra_shortest_paths.html │ ├── distributedS.html │ ├── distributed_adjacency_list.html │ ├── distributed_property_map.html │ ├── distributed_queue.html │ ├── fruchterman_reingold.html │ ├── index.html │ ├── local_subgraph.html │ ├── mesh_generator.html │ ├── metis.html │ ├── mpi_bsp_process_group.html │ ├── non_distributed_betweenness_centrality.html │ ├── overview.html │ ├── page_rank.html │ ├── pbgl-logo.png │ ├── process_group.html │ ├── rmat_generator.html │ ├── scalable_rmat_generator.html │ ├── simple_trigger.html │ ├── sorted_rmat_generator.html │ ├── sorted_unique_rmat_generator.html │ ├── ssca_generator.html │ ├── st_connected.html │ ├── strong_components.html │ ├── tsin_depth_first_visit.html │ ├── unique_rmat_generator.html │ └── vertex_list_adaptor.html ├── index.rst ├── local_subgraph.rst ├── mesh_generator.rst ├── metis.rst ├── mpi_bsp_process_group.rst ├── non_distributed_betweenness_centrality.rst ├── overview.rst ├── page_rank.rst ├── process_group.rst ├── rmat_generator.rst ├── scalable_rmat_generator.rst ├── simple_trigger.rst ├── sorted_rmat_generator.rst ├── sorted_unique_rmat_generator.rst ├── ssca_generator.rst ├── st_connected.rst ├── strong_components.rst ├── tsin_depth_first_visit.rst ├── unique_rmat_generator.rst ├── vertex_coloring.png └── vertex_list_adaptor.rst ├── example ├── Jamfile.v2 ├── breadth_first_search.cpp └── dijkstra_shortest_paths.cpp ├── include └── boost │ └── graph │ ├── accounting.hpp │ ├── distributed │ ├── adjacency_list.hpp │ ├── adjlist │ │ ├── handlers.hpp │ │ ├── initialize.hpp │ │ ├── redistribute.hpp │ │ └── serialization.hpp │ ├── betweenness_centrality.hpp │ ├── boman_et_al_graph_coloring.hpp │ ├── breadth_first_search.hpp │ ├── compressed_sparse_row_graph.hpp │ ├── concepts.hpp │ ├── connected_components.hpp │ ├── connected_components_parallel_search.hpp │ ├── crauser_et_al_shortest_paths.hpp │ ├── dehne_gotz_min_spanning_tree.hpp │ ├── delta_stepping_shortest_paths.hpp │ ├── depth_first_search.hpp │ ├── detail │ │ ├── dijkstra_shortest_paths.hpp │ │ ├── filtered_queue.hpp │ │ ├── mpi_process_group.ipp │ │ ├── queue.ipp │ │ ├── remote_update_set.hpp │ │ └── tag_allocator.hpp │ ├── dijkstra_shortest_paths.hpp │ ├── distributed_graph_utility.hpp │ ├── eager_dijkstra_shortest_paths.hpp │ ├── filtered_graph.hpp │ ├── fruchterman_reingold.hpp │ ├── graphviz.hpp │ ├── hohberg_biconnected_components.hpp │ ├── local_subgraph.hpp │ ├── mpi_process_group.hpp │ ├── named_graph.hpp │ ├── one_bit_color_map.hpp │ ├── page_rank.hpp │ ├── queue.hpp │ ├── reverse_graph.hpp │ ├── rmat_graph_generator.hpp │ ├── selector.hpp │ ├── shuffled_distribution.hpp │ ├── st_connected.hpp │ ├── strong_components.hpp │ ├── two_bit_color_map.hpp │ ├── unsafe_serialize.hpp │ └── vertex_list_adaptor.hpp │ └── parallel │ ├── algorithm.hpp │ ├── basic_reduce.hpp │ ├── container_traits.hpp │ ├── detail │ ├── inplace_all_to_all.hpp │ ├── property_holders.hpp │ └── untracked_pair.hpp │ ├── distribution.hpp │ ├── process_group.hpp │ ├── properties.hpp │ └── simple_trigger.hpp ├── index.html ├── meta └── libraries.json ├── src ├── mpi_process_group.cpp └── tag_allocator.cpp └── test ├── Jamfile.v2 ├── adjlist_build_test.cpp ├── adjlist_redist_test.cpp ├── adjlist_remove_test.cpp ├── algorithm_performance.cpp ├── distributed_adjacency_list_test.cpp ├── distributed_betweenness_centrality_test.cpp ├── distributed_connected_components_test.cpp ├── distributed_csr_algorithm_test.cpp ├── distributed_csr_test.cpp ├── distributed_dfs_test.cpp ├── distributed_dimacs_reader.cpp ├── distributed_graph_coloring_test.cpp ├── distributed_mst_test.cpp ├── distributed_page_rank_test.cpp ├── distributed_property_map_test.cpp ├── distributed_queue_test.cpp ├── distributed_rmat_cc.cpp ├── distributed_rmat_cc_ps.cpp ├── distributed_rmat_pagerank.cpp ├── distributed_shortest_paths_test.cpp ├── distributed_st_connected_test.cpp ├── distributed_strong_components_test.cpp ├── hohberg_biconnected_components_test.cpp ├── mesh_generator_test.cpp ├── named_vertices_hash_test.cpp ├── named_vertices_seq.cpp ├── named_vertices_test.cpp ├── process_group_serialization.cpp └── ssca.cpp /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto !eol svneol=native#text/plain 2 | *.gitattributes text svneol=native#text/plain 3 | 4 | # Scriptish formats 5 | *.bat text svneol=native#text/plain 6 | *.bsh text svneol=native#text/x-beanshell 7 | *.cgi text svneol=native#text/plain 8 | *.cmd text svneol=native#text/plain 9 | *.js text svneol=native#text/javascript 10 | *.php text svneol=native#text/x-php 11 | *.pl text svneol=native#text/x-perl 12 | *.pm text svneol=native#text/x-perl 13 | *.py text svneol=native#text/x-python 14 | *.sh eol=lf svneol=LF#text/x-sh 15 | configure eol=lf svneol=LF#text/x-sh 16 | 17 | # Image formats 18 | *.bmp binary svneol=unset#image/bmp 19 | *.gif binary svneol=unset#image/gif 20 | *.ico binary svneol=unset#image/ico 21 | *.jpeg binary svneol=unset#image/jpeg 22 | *.jpg binary svneol=unset#image/jpeg 23 | *.png binary svneol=unset#image/png 24 | *.tif binary svneol=unset#image/tiff 25 | *.tiff binary svneol=unset#image/tiff 26 | *.svg text svneol=native#image/svg%2Bxml 27 | 28 | # Data formats 29 | *.pdf binary svneol=unset#application/pdf 30 | *.avi binary svneol=unset#video/avi 31 | *.doc binary svneol=unset#application/msword 32 | *.dsp text svneol=crlf#text/plain 33 | *.dsw text svneol=crlf#text/plain 34 | *.eps binary svneol=unset#application/postscript 35 | *.gz binary svneol=unset#application/gzip 36 | *.mov binary svneol=unset#video/quicktime 37 | *.mp3 binary svneol=unset#audio/mpeg 38 | *.ppt binary svneol=unset#application/vnd.ms-powerpoint 39 | *.ps binary svneol=unset#application/postscript 40 | *.psd binary svneol=unset#application/photoshop 41 | *.rdf binary svneol=unset#text/rdf 42 | *.rss text svneol=unset#text/xml 43 | *.rtf binary svneol=unset#text/rtf 44 | *.sln text svneol=native#text/plain 45 | *.swf binary svneol=unset#application/x-shockwave-flash 46 | *.tgz binary svneol=unset#application/gzip 47 | *.vcproj text svneol=native#text/xml 48 | *.vcxproj text svneol=native#text/xml 49 | *.vsprops text svneol=native#text/xml 50 | *.wav binary svneol=unset#audio/wav 51 | *.xls binary svneol=unset#application/vnd.ms-excel 52 | *.zip binary svneol=unset#application/zip 53 | 54 | # Text formats 55 | .htaccess text svneol=native#text/plain 56 | *.bbk text svneol=native#text/xml 57 | *.cmake text svneol=native#text/plain 58 | *.css text svneol=native#text/css 59 | *.dtd text svneol=native#text/xml 60 | *.htm text svneol=native#text/html 61 | *.html text svneol=native#text/html 62 | *.ini text svneol=native#text/plain 63 | *.log text svneol=native#text/plain 64 | *.mak text svneol=native#text/plain 65 | *.qbk text svneol=native#text/plain 66 | *.rst text svneol=native#text/plain 67 | *.sql text svneol=native#text/x-sql 68 | *.txt text svneol=native#text/plain 69 | *.xhtml text svneol=native#text/xhtml%2Bxml 70 | *.xml text svneol=native#text/xml 71 | *.xsd text svneol=native#text/xml 72 | *.xsl text svneol=native#text/xml 73 | *.xslt text svneol=native#text/xml 74 | *.xul text svneol=native#text/xul 75 | *.yml text svneol=native#text/plain 76 | boost-no-inspect text svneol=native#text/plain 77 | CHANGES text svneol=native#text/plain 78 | COPYING text svneol=native#text/plain 79 | INSTALL text svneol=native#text/plain 80 | Jamfile text svneol=native#text/plain 81 | Jamroot text svneol=native#text/plain 82 | Jamfile.v2 text svneol=native#text/plain 83 | Jamrules text svneol=native#text/plain 84 | Makefile* text svneol=native#text/plain 85 | README text svneol=native#text/plain 86 | TODO text svneol=native#text/plain 87 | 88 | # Code formats 89 | *.c text svneol=native#text/plain 90 | *.cpp text svneol=native#text/plain 91 | *.h text svneol=native#text/plain 92 | *.hpp text svneol=native#text/plain 93 | *.ipp text svneol=native#text/plain 94 | *.tpp text svneol=native#text/plain 95 | *.jam text svneol=native#text/plain 96 | *.java text svneol=native#text/plain 97 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Evan Miller 2 | # Copyright 2020 Matt Borland 3 | # Copyright 2021 John Maddock 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) 6 | 7 | name: CI 8 | on: [ push, pull_request ] 9 | jobs: 10 | ubuntu: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | fail-fast: false 14 | matrix: 15 | compiler: [ g++-13, g++-14, clang++-19 ] 16 | steps: 17 | - uses: actions/checkout@v2 18 | with: 19 | fetch-depth: '0' 20 | - uses: mstachniuk/ci-skip@v1 21 | with: 22 | commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]' 23 | commit-filter-separator: ';' 24 | fail-fast: true 25 | - name: Set TOOLSET 26 | run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV 27 | - name: Install packages 28 | run: sudo apt install g++-13 g++-14 clang-19 mpich 29 | - name: Checkout main boost 30 | run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root 31 | - name: Update tools/boostdep 32 | run: git submodule update --init tools/boostdep 33 | working-directory: ../boost-root 34 | - name: Copy files 35 | run: cp -r $GITHUB_WORKSPACE/* libs/graph_parallel 36 | working-directory: ../boost-root 37 | - name: Install deps 38 | run: python tools/boostdep/depinst/depinst.py graph_parallel 39 | working-directory: ../boost-root 40 | - name: Bootstrap 41 | run: ./bootstrap.sh 42 | working-directory: ../boost-root 43 | - name: Generate headers 44 | run: ./b2 headers 45 | working-directory: ../boost-root 46 | - name: Generate user config 47 | run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} ;" > ~/user-config.jam && echo "using mpi ;" >> ~/user-config.jam' 48 | working-directory: ../boost-root 49 | - name: Config info 50 | run: ../../../b2 print_config_info toolset=$TOOLSET cxxstd=03,11,14,17,2a 51 | working-directory: ../boost-root/libs/config/test 52 | - name: Test 53 | run: ../../../b2 toolset=$TOOLSET cxxstd=03,11,14,17,2a 54 | working-directory: ../boost-root/libs/graph_parallel/test 55 | macos: 56 | runs-on: macos-latest 57 | strategy: 58 | fail-fast: false 59 | matrix: 60 | toolset: [ clang ] 61 | steps: 62 | - uses: actions/checkout@v2 63 | with: 64 | fetch-depth: '0' 65 | - uses: mstachniuk/ci-skip@v1 66 | with: 67 | commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[linux];[Linux];[LINUX]' 68 | commit-filter-separator: ';' 69 | fail-fast: true 70 | - name: Checkout main boost 71 | run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root 72 | - name: Update tools/boostdep 73 | run: git submodule update --init tools/boostdep 74 | working-directory: ../boost-root 75 | - name: Copy files 76 | run: cp -r $GITHUB_WORKSPACE/* libs/graph_parallel 77 | working-directory: ../boost-root 78 | - name: Install deps 79 | run: python tools/boostdep/depinst/depinst.py graph_parallel 80 | working-directory: ../boost-root 81 | - name: Bootstrap 82 | run: ./bootstrap.sh 83 | working-directory: ../boost-root 84 | - name: Generate headers 85 | run: ./b2 headers 86 | working-directory: ../boost-root 87 | - name: Install MPI 88 | run: brew install mpich 89 | - name: Generate user-config 90 | run: echo "using mpi ;" > ~/user-config.jam 91 | - name: Config info 92 | run: ../../../b2 print_config_info toolset=${{ matrix.toolset }} cxxstd=03,11,14,17,2a 93 | working-directory: ../boost-root/libs/config/test 94 | - name: Test 95 | run: ../../../b2 toolset=${{ matrix.toolset }} cxxstd=03,11,14,17,2a define=CI_SUPPRESS_KNOWN_ISSUES 96 | working-directory: ../boost-root/libs/graph_parallel/test 97 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated by `boostdep --cmake graph_parallel` 2 | # Copyright 2020 Peter Dimov 3 | # Distributed under the Boost Software License, Version 1.0. 4 | # https://www.boost.org/LICENSE_1_0.txt 5 | 6 | cmake_minimum_required(VERSION 3.5...3.16) 7 | 8 | project(boost_graph_parallel VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) 9 | 10 | add_library(boost_graph_parallel 11 | src/mpi_process_group.cpp 12 | src/tag_allocator.cpp 13 | ) 14 | 15 | add_library(Boost::graph_parallel ALIAS boost_graph_parallel) 16 | 17 | target_include_directories(boost_graph_parallel PUBLIC include) 18 | 19 | target_link_libraries(boost_graph_parallel 20 | PUBLIC 21 | Boost::assert 22 | Boost::concept_check 23 | Boost::config 24 | Boost::container_hash 25 | Boost::core 26 | Boost::detail 27 | Boost::dynamic_bitset 28 | Boost::filesystem 29 | Boost::foreach 30 | Boost::function 31 | Boost::graph 32 | Boost::iterator 33 | Boost::lexical_cast 34 | Boost::mpi 35 | Boost::mpl 36 | Boost::optional 37 | Boost::property_map 38 | Boost::property_map_parallel 39 | Boost::random 40 | Boost::serialization 41 | Boost::smart_ptr 42 | Boost::static_assert 43 | Boost::tuple 44 | Boost::type_traits 45 | Boost::variant 46 | ) 47 | 48 | target_compile_definitions(boost_graph_parallel 49 | PUBLIC BOOST_GRAPH_PARALLEL_NO_LIB 50 | PRIVATE BOOST_GRAPH_PARALLEL_SOURCE 51 | ) 52 | 53 | if(BUILD_SHARED_LIBS) 54 | target_compile_definitions(boost_graph_parallel PUBLIC BOOST_GRAPH_PARALLEL_DYN_LINK) 55 | else() 56 | target_compile_definitions(boost_graph_parallel PUBLIC BOOST_GRAPH_PARALLEL_STATIC_LINK) 57 | endif() 58 | 59 | if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") 60 | 61 | add_subdirectory(test) 62 | 63 | endif() 64 | 65 | -------------------------------------------------------------------------------- /build.jam: -------------------------------------------------------------------------------- 1 | # Copyright René Ferdinand Rivera Morell 2024 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE_1_0.txt or copy at 4 | # http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | require-b2 5.2 ; 7 | 8 | constant boost_dependencies : 9 | /boost/algorithm//boost_algorithm 10 | /boost/assert//boost_assert 11 | /boost/concept_check//boost_concept_check 12 | /boost/config//boost_config 13 | /boost/container_hash//boost_container_hash 14 | /boost/core//boost_core 15 | /boost/detail//boost_detail 16 | /boost/dynamic_bitset//boost_dynamic_bitset 17 | /boost/filesystem//boost_filesystem 18 | /boost/foreach//boost_foreach 19 | /boost/function//boost_function 20 | /boost/graph//boost_graph 21 | /boost/iterator//boost_iterator 22 | /boost/lexical_cast//boost_lexical_cast 23 | /boost/mpi//boost_mpi 24 | /boost/mpl//boost_mpl 25 | /boost/optional//boost_optional 26 | /boost/property_map//boost_property_map 27 | /boost/property_map_parallel//boost_property_map_parallel 28 | /boost/random//boost_random 29 | /boost/serialization//boost_serialization 30 | /boost/smart_ptr//boost_smart_ptr 31 | /boost/static_assert//boost_static_assert 32 | /boost/tuple//boost_tuple 33 | /boost/type_traits//boost_type_traits 34 | /boost/variant//boost_variant ; 35 | 36 | project /boost/graph_parallel 37 | ; 38 | 39 | explicit 40 | [ alias boost_graph_parallel : build//boost_graph_parallel ] 41 | [ alias all : boost_graph_parallel example test ] 42 | ; 43 | 44 | call-if : boost-library graph_parallel 45 | : install boost_graph_parallel 46 | ; 47 | 48 | -------------------------------------------------------------------------------- /build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2002 Trustees of Indiana University 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. 4 | # (See accompanying file LICENSE_1_0.txt or copy at 5 | # http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | import mpi ; 8 | 9 | project 10 | : common-requirements ../include $(boost_dependencies) 11 | : requirements ../src 12 | : source-location ../src 13 | : usage-requirements BOOST_GRAPH_PARALLEL_NO_LIB=1 14 | ; 15 | 16 | local optional_sources ; 17 | local optional_reqs ; 18 | 19 | if [ mpi.configured ] 20 | { 21 | lib boost_graph_parallel 22 | : mpi_process_group.cpp tag_allocator.cpp 23 | : /boost/mpi//boost_mpi 24 | /mpi//mpi [ mpi.extra-requirements ] 25 | BOOST_GRAPH_NO_LIB=1 26 | shared:BOOST_GRAPH_DYN_LINK=1 27 | # # Intel compiler ICEs if we turn optimization on 28 | intel-vc71-win-9.1:off 29 | # Without these flags, MSVC 7.1 crash 30 | # User reports that VC++ 8 no longer has this problem 31 | msvc-7.1:-GR- 32 | global 33 | ; 34 | 35 | } 36 | else 37 | { 38 | alias boost_graph_parallel ; 39 | if ! ( --without-graph_parallel in [ modules.peek : ARGV ] ) 40 | { 41 | message boost_graph_parallel 42 | : "warning: Graph library does not contain MPI-based parallel components." 43 | : "note: to enable them, add \"using mpi ;\" to your user-config.jam." 44 | : "note: to suppress this message, pass \"--without-graph_parallel\" to bjam." 45 | ; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /doc/BUILD_DOCS.tcl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # \ 3 | exec tclsh "$0" "$@" 4 | 5 | # Copyright (C) 2009 The Trustees of Indiana University. 6 | # Use, modification and distribution is subject to the Boost Software 7 | # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 8 | # http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | # Authors: Jeremiah Willcock, Andrew Lumsdaine 11 | 12 | foreach input [glob *.rst] { 13 | set output [file join html "[file rootname $input].html"] 14 | puts "Processing $input -> $output" 15 | set processor [open "|rst2html.py --stylesheet=../../../../rst.css -gdt --link-stylesheet --traceback --trim-footnote-reference-space --footnote-references=superscript >$output" w] 16 | set inputfd [open $input r] 17 | set data [read $inputfd] 18 | close $inputfd 19 | foreach line [split $data \n] { 20 | if {[regexp {^\.\. image:: (http:.*)$} $line _ url]} { 21 | set tag $url 22 | regsub -all {.*/} $tag {} tag 23 | regsub -all {[^a-zA-Z0-9]} $tag _ tag 24 | set imageoutput [file join html "$tag.png"] 25 | puts "Getting image $url -> $imageoutput" 26 | exec wget -q -O $imageoutput $url 27 | puts $processor ".. image:: [file tail $imageoutput]" 28 | } else { 29 | puts $processor $line 30 | } 31 | } 32 | close $processor 33 | } 34 | -------------------------------------------------------------------------------- /doc/DistributedEdgeListGraph.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | ========================================== 7 | |Logo| Concept Distributed Edge List Graph 8 | ========================================== 9 | 10 | .. contents:: 11 | 12 | Description 13 | ----------- 14 | 15 | A Distributed Edge List Graph is a graph whose vertices are 16 | distributed across multiple processes or address spaces. The 17 | ``vertices`` and ``num_vertices`` functions retain the same 18 | signatures as in the `Edge List Graph`_ concept, but return only 19 | the local set (and size of the local set) of vertices. 20 | 21 | Notation 22 | -------- 23 | 24 | G 25 | A type that models the Distributed Edge List Graph concept. 26 | 27 | g 28 | An object of type ``G``. 29 | 30 | Refinement of 31 | ------------- 32 | 33 | - `Graph`_ 34 | 35 | Associated types 36 | ---------------- 37 | 38 | +----------------+---------------------------------------+---------------------------------+ 39 | |Edge |``graph_traits::edge_descriptor`` |Must model the | 40 | |descriptor type | |`Global Descriptor`_ concept. | 41 | +----------------+---------------------------------------+---------------------------------+ 42 | |Edge iterator |``graph_traits::edge_iterator`` |Iterates over edges stored | 43 | |type | |locally. The value type must be | 44 | | | |``edge_descriptor``. | 45 | +----------------+---------------------------------------+---------------------------------+ 46 | |Edges size |``graph_traits::edges_size_type`` |The unsigned integral type used | 47 | |type | |to store the number of edges | 48 | | | |in the local subgraph. | 49 | +----------------+---------------------------------------+---------------------------------+ 50 | 51 | Valid Expressions 52 | ----------------- 53 | 54 | +----------------+---------------------+----------------------+-------------------------------------+ 55 | |Name |Expression |Type |Semantics | 56 | +================+=====================+======================+=====================================+ 57 | |Local edge set |``edges(g)`` |``std::pair<`` |Returns an iterator range | 58 | | | |``edge_iterator,`` |providing access to the local | 59 | | | |``edge_iterator>`` |edges in the graph. | 60 | +----------------+---------------------+----------------------+-------------------------------------+ 61 | |Number of local |``num_edges(g)`` |``edges_size_type`` |Returns the number of edges | 62 | |edges. | | |stored locally in the graph. | 63 | +----------------+---------------------+----------------------+-------------------------------------+ 64 | 65 | 66 | Models 67 | ------ 68 | 69 | - `Distributed adjacency list`_ 70 | 71 | ----------------------------------------------------------------------------- 72 | 73 | Copyright (C) 2005 The Trustees of Indiana University. 74 | 75 | Authors: Douglas Gregor and Andrew Lumsdaine 76 | 77 | .. |Logo| image:: pbgl-logo.png 78 | :align: middle 79 | :alt: Parallel BGL 80 | :target: http://www.osl.iu.edu/research/pbgl 81 | 82 | .. _Graph: http://www.boost.org/libs/graph/doc/Graph.html 83 | .. _Edge List Graph: http://www.boost.org/libs/graph/doc/EdgeListGraph.html 84 | .. _Distributed Graph: DistributedGraph.html 85 | .. _Global descriptor: GlobalDescriptor.html 86 | .. _Distributed adjacency list: distributed_adjacency_list.html 87 | -------------------------------------------------------------------------------- /doc/DistributedGraph.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | ================================ 7 | |Logo| Concept Distributed Graph 8 | ================================ 9 | 10 | .. contents:: 11 | 12 | Description 13 | ----------- 14 | 15 | A Distributed Graph is a graph whose vertices or edges are 16 | distributed across multiple processes or address spaces. The 17 | descriptors of a Distributed Graph must model the `Global 18 | Descriptor`_ concept. 19 | 20 | Notation 21 | -------- 22 | 23 | G 24 | A type that models the Distributed Graph concept. 25 | 26 | 27 | Refinement of 28 | ------------- 29 | 30 | - Graph_ 31 | 32 | Associated types 33 | ---------------- 34 | 35 | +----------------+---------------------------------------+---------------------------------+ 36 | |Vertex |``graph_traits::vertex_descriptor`` |Must model the | 37 | |descriptor type | |`Global Descriptor`_ concept. | 38 | +----------------+---------------------------------------+---------------------------------+ 39 | |Edge |``graph_traits::edge_descriptor`` |Must model the | 40 | |descriptor type | |`Global Descriptor`_ concept. | 41 | +----------------+---------------------------------------+---------------------------------+ 42 | 43 | 44 | Models 45 | ------ 46 | 47 | - `Distributed adjacency list`_ 48 | 49 | ----------------------------------------------------------------------------- 50 | 51 | Copyright (C) 2005 The Trustees of Indiana University. 52 | 53 | Authors: Douglas Gregor and Andrew Lumsdaine 54 | 55 | .. |Logo| image:: pbgl-logo.png 56 | :align: middle 57 | :alt: Parallel BGL 58 | :target: http://www.osl.iu.edu/research/pbgl 59 | 60 | .. _Graph: http://www.boost.org/libs/graph/doc/Graph.html 61 | .. _Global descriptor: GlobalDescriptor.html 62 | .. _Distributed adjacency list: distributed_adjacency_list.html 63 | -------------------------------------------------------------------------------- /doc/DistributedVertexListGraph.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | ============================================ 7 | |Logo| Concept Distributed Vertex List Graph 8 | ============================================ 9 | 10 | .. contents:: 11 | 12 | Description 13 | ----------- 14 | 15 | A Distributed Vertex List Graph is a graph whose vertices are 16 | distributed across multiple processes or address spaces. The 17 | ``vertices`` and ``num_vertices`` functions retain the same 18 | signatures as in the `Vertex List Graph`_ concept, but return only 19 | the local set (and size of the local set) of vertices. 20 | 21 | Notation 22 | -------- 23 | 24 | G 25 | A type that models the Distributed Vertex List Graph concept. 26 | 27 | g 28 | An object of type ``G``. 29 | 30 | Refinement of 31 | ------------- 32 | 33 | - `Graph`_ 34 | 35 | Associated types 36 | ---------------- 37 | 38 | +----------------+---------------------------------------+---------------------------------+ 39 | |Vertex |``graph_traits::vertex_descriptor`` |Must model the | 40 | |descriptor type | |`Global Descriptor`_ concept. | 41 | +----------------+---------------------------------------+---------------------------------+ 42 | |Vertex iterator |``graph_traits::vertex_iterator`` |Iterates over vertices stored | 43 | |type | |locally. The value type must be | 44 | | | |``vertex_descriptor``. | 45 | +----------------+---------------------------------------+---------------------------------+ 46 | |Vertices size |``graph_traits::vertices_size_type``|The unsigned integral type used | 47 | |type | |to store the number of vertices | 48 | | | |in the local subgraph. | 49 | +----------------+---------------------------------------+---------------------------------+ 50 | 51 | Valid Expressions 52 | ----------------- 53 | 54 | +----------------+---------------------+----------------------+-------------------------------------+ 55 | |Name |Expression |Type |Semantics | 56 | +================+=====================+======================+=====================================+ 57 | |Local vertex set|``vertices(g)`` |``std::pair<`` |Returns an iterator range | 58 | | | |``vertex_iterator,`` |providing access to the local | 59 | | | |``vertex_iterator>`` |vertices in the graph. | 60 | +----------------+---------------------+----------------------+-------------------------------------+ 61 | |Number of local |``num_vertices(g)`` |``vertices_size_type``|Returns the number of vertices | 62 | |vertices. | | |stored locally in the graph. | 63 | +----------------+---------------------+----------------------+-------------------------------------+ 64 | 65 | 66 | Models 67 | ------ 68 | 69 | - `Distributed adjacency list`_ 70 | 71 | ----------------------------------------------------------------------------- 72 | 73 | Copyright (C) 2005 The Trustees of Indiana University. 74 | 75 | Authors: Douglas Gregor and Andrew Lumsdaine 76 | 77 | .. |Logo| image:: pbgl-logo.png 78 | :align: middle 79 | :alt: Parallel BGL 80 | :target: http://www.osl.iu.edu/research/pbgl 81 | 82 | .. _Graph: http://www.boost.org/libs/graph/doc/Graph.html 83 | .. _Vertex List Graph: http://www.boost.org/libs/graph/doc/VertexListGraph.html 84 | .. _Distributed Graph: DistributedGraph.html 85 | .. _Global descriptor: GlobalDescriptor.html 86 | .. _Distributed adjacency list: distributed_adjacency_list.html 87 | -------------------------------------------------------------------------------- /doc/GlobalDescriptor.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | ================================ 7 | |Logo| Concept Global Descriptor 8 | ================================ 9 | 10 | .. contents:: 11 | 12 | Description 13 | ----------- 14 | 15 | A global descriptor is an object that represents an entity that is 16 | owned by some process and may reside in an address space not 17 | accessible to the currently-executing process. The global descriptor 18 | consists of two parts: the *owner* of the entity, which is the 19 | identifier of that process in which the entity resides, and a *local 20 | descriptor*, that uniquely identifies the entity with the address 21 | space of the owner. 22 | 23 | Refinement of 24 | ------------- 25 | 26 | - `Default Constructible`_ 27 | - Assignable_ 28 | 29 | Notation 30 | -------- 31 | X 32 | A type that models the Global Descriptor concept. 33 | 34 | x 35 | Object of type X 36 | 37 | 38 | Associated types 39 | ---------------- 40 | 41 | +----------------+--------------------+---------------------------------+ 42 | |Process ID type |``process_id_type`` |Determined by the process group | 43 | | | |associated with type X. | 44 | +----------------+--------------------+---------------------------------+ 45 | |Local descriptor|``local_type`` |Determined by the data structure | 46 | |type | |the descriptor accesses. | 47 | | | |Must model `Equality Comparable`_| 48 | | | |and `Copy Constructible`_. | 49 | +----------------+--------------------+---------------------------------+ 50 | 51 | Valid Expressions 52 | ----------------- 53 | 54 | +----------------+---------------------+---------------------+-------------------------------------+ 55 | |Name |Expression |Type |Semantics | 56 | +================+=====================+=====================+=====================================+ 57 | |Owner |``owner(x)`` |``process_id_type`` |Returns the owner of ``x``. | 58 | +----------------+---------------------+---------------------+-------------------------------------+ 59 | |Local descriptor|``local(x)`` |``local_type`` |Returns the local descriptor | 60 | | | | |uniquely identifying ``x``. | 61 | +----------------+---------------------+---------------------+-------------------------------------+ 62 | 63 | 64 | ----------------------------------------------------------------------------- 65 | 66 | Copyright (C) 2005 The Trustees of Indiana University. 67 | 68 | Authors: Douglas Gregor and Andrew Lumsdaine 69 | 70 | .. |Logo| image:: pbgl-logo.png 71 | :align: middle 72 | :alt: Parallel BGL 73 | :target: http://www.osl.iu.edu/research/pbgl 74 | 75 | .. _Assignable: http://www.sgi.com/tech/stl/Assignable.html 76 | .. _Copy constructible: http://www.sgi.com/tech/stl/CopyConstructible.html 77 | .. _Default constructible: http://www.sgi.com/tech/stl/DefaultConstructible.html 78 | .. _Equality comparable: http://www.sgi.com/tech/stl/EqualityComparable.html 79 | -------------------------------------------------------------------------------- /doc/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/architecture.png -------------------------------------------------------------------------------- /doc/connected_components_parallel_search.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2009 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | =========================================== 7 | |Logo| Connected Components Parallel Search 8 | =========================================== 9 | 10 | :: 11 | 12 | namespace graph { namespace distributed { 13 | template 14 | typename property_traits::value_type 15 | connected_components_ps(const Graph& g, ComponentMap c) 16 | } } 17 | 18 | The ``connected_components_ps()`` function computes the connected 19 | components of a graph by performing a breadth-first search from 20 | several sources in parallel while recording and eventually resolving 21 | the collisions. 22 | 23 | .. contents:: 24 | 25 | Where Defined 26 | ------------- 27 | <``boost/graph/distributed/connected_components_parallel_search.hpp``> 28 | 29 | Parameters 30 | ---------- 31 | 32 | IN: ``const Graph& g`` 33 | The graph type must be a model of `Distributed Graph`_. The graph 34 | type must also model the `Incidence Graph`_ and be directed. 35 | 36 | OUT: ``ComponentMap c`` 37 | The algorithm computes how many connected components are in the 38 | graph, and assigns each component an integer label. The algorithm 39 | then records to which component each vertex in the graph belongs by 40 | recording the component number in the component property map. The 41 | ``ComponentMap`` type must be a `Distributed Property Map`_. The 42 | value type must be the ``vertices_size_type`` of the graph. The key 43 | type must be the graph's vertex descriptor type. 44 | 45 | Complexity 46 | ---------- 47 | 48 | *O(PN^2 + VNP)* work, in *O(N + V)* time, where N is the 49 | number of mappings and V is the number of local vertices. 50 | 51 | Algorithm Description 52 | --------------------- 53 | 54 | Every *N* th nodes starts a parallel search from the first vertex in 55 | their local vertex list during the first superstep (the other nodes 56 | remain idle during the first superstep to reduce the number of 57 | conflicts in numbering the components). At each superstep, all new 58 | component mappings from remote nodes are handled. If there is no work 59 | from remote updates, a new vertex is removed from the local list and 60 | added to the work queue. 61 | 62 | Components are allocated from the ``component_value_allocator`` 63 | object, which ensures that a given component number is unique in the 64 | system, currently by using the rank and number of processes to stride 65 | allocations. 66 | 67 | When two components are discovered to actually be the same component, 68 | a collision is recorded. The lower component number is prefered in 69 | the resolution, so component numbering resolution is consistent. 70 | After the search has exhausted all vertices in the graph, the mapping 71 | is shared with all processes and they independently resolve the 72 | comonent mapping. This phase can likely be significantly sped up if a 73 | clever algorithm for the reduction can be found. 74 | 75 | ----------------------------------------------------------------------------- 76 | 77 | Copyright (C) 2009 The Trustees of Indiana University. 78 | 79 | Authors: Brian Barrett, Douglas Gregor, and Andrew Lumsdaine 80 | 81 | .. |Logo| image:: pbgl-logo.png 82 | :align: middle 83 | :alt: Parallel BGL 84 | :target: http://www.osl.iu.edu/research/pbgl 85 | 86 | .. _Distributed Graph: DistributedGraph.html 87 | .. _Distributed Property Map: distributed_property_map.html 88 | .. _Incidence Graph: http://www.boost.org/libs/graph/doc/IncidenceGraph.html 89 | -------------------------------------------------------------------------------- /doc/dijkstra_dist3_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/dijkstra_dist3_graph.png -------------------------------------------------------------------------------- /doc/dijkstra_seq_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/dijkstra_seq_graph.png -------------------------------------------------------------------------------- /doc/dist-adjlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/dist-adjlist.png -------------------------------------------------------------------------------- /doc/dist-pmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/dist-pmap.png -------------------------------------------------------------------------------- /doc/distributed-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/distributed-graph.png -------------------------------------------------------------------------------- /doc/distributedS.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | ====================================== 7 | ``distributedS`` Distribution Selector 8 | ====================================== 9 | 10 | The Boost Graph Library's class template adjacency_list_ supports 11 | several selectors that indicate what data structure should be used for 12 | the storage of edges or vertices. The selector ``vecS``, for instance, 13 | indicates storage in a ``std::vector`` whereas ``listS`` indicates 14 | storage in a ``std::list``. The Parallel BGL's `distributed 15 | adjacency list`_ supports an additional selector, ``distributedS``, 16 | that indicates that the storage should be distributed across multiple 17 | processes. This selector can transform a sequential adjacency list 18 | into a distributed adjacency list. 19 | 20 | :: 21 | 22 | template 23 | struct distributedS; 24 | 25 | 26 | Template parameters 27 | ~~~~~~~~~~~~~~~~~~~ 28 | 29 | **ProcessGroup**: 30 | The type of the process group over which the property map is 31 | distributed and also the medium for communication. This type must 32 | model the `Process Group`_ concept, but certain data structures may 33 | place additional requirements on this parameter. 34 | 35 | **LocalSelector**: 36 | A selector type (e.g., ``vecS``) that indicates how vertices or 37 | edges should be stored in each process. 38 | 39 | ----------------------------------------------------------------------------- 40 | 41 | Copyright (C) 2005 The Trustees of Indiana University. 42 | 43 | Authors: Douglas Gregor and Andrew Lumsdaine 44 | 45 | 46 | .. _adjacency_list: http://www.boost.org/libs/graph/doc/adjacency_list.html 47 | .. _Distributed adjacency list: distributed_adjacency_list.html 48 | .. _Process group: process_group.html 49 | 50 | -------------------------------------------------------------------------------- /doc/fruchterman_reingold.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2009 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | =========================== 7 | |Logo| Fruchterman Reingold 8 | =========================== 9 | 10 | :: 11 | 12 | namespace graph { namespace distributed { 13 | 14 | template 17 | void 18 | fruchterman_reingold_force_directed_layout 19 | (const Graph& g, 20 | PositionMap position, 21 | typename property_traits::value_type const& origin, 22 | typename property_traits::value_type const& extent, 23 | AttractiveForce attractive_force, 24 | RepulsiveForce repulsive_force, 25 | ForcePairs force_pairs, 26 | Cooling cool, 27 | DisplacementMap displacement) 28 | 29 | template 32 | void 33 | fruchterman_reingold_force_directed_layout 34 | (const Graph& g, 35 | PositionMap position, 36 | typename property_traits::value_type const& origin, 37 | typename property_traits::value_type const& extent, 38 | AttractiveForce attractive_force, 39 | RepulsiveForce repulsive_force, 40 | ForcePairs force_pairs, 41 | Cooling cool, 42 | DisplacementMap displacement, 43 | simple_tiling tiling) 44 | } } 45 | 46 | .. contents:: 47 | 48 | Where Defined 49 | ------------- 50 | <``boost/graph/distributed/fruchterman_reingold.hpp``> 51 | 52 | also accessible from 53 | 54 | <``boost/graph/fruchterman_reingold.hpp``> 55 | 56 | Parameters 57 | ---------- 58 | 59 | IN: ``const Graph& g`` 60 | The graph type must be a model of `Distributed Graph`_. The graph 61 | type must also model the `Incidence Graph`_. 62 | 63 | OUT: ``PositionMap position`` 64 | 65 | IN: ``property_traits::value_type origin`` 66 | 67 | IN: ``property_traits::value_type extent`` 68 | 69 | IN: ``AttractiveForce attractive_force`` 70 | 71 | IN: ``RepulsiveForce repulsive_force`` 72 | 73 | IN: ``ForcePairs force_pairs`` 74 | 75 | IN: ``Cooling cool`` 76 | 77 | IN: ``DisplacementMap displacement`` 78 | 79 | .. 80 | Complexity 81 | ---------- 82 | 83 | .. 84 | Algorithm Description 85 | --------------------- 86 | 87 | ----------------------------------------------------------------------------- 88 | 89 | Copyright (C) 2009 The Trustees of Indiana University. 90 | 91 | Authors: Nick Edmonds and Andrew Lumsdaine 92 | 93 | .. |Logo| image:: pbgl-logo.png 94 | :align: middle 95 | :alt: Parallel BGL 96 | :target: http://www.osl.iu.edu/research/pbgl 97 | 98 | .. _Distributed Graph: DistributedGraph.html 99 | .. _Incidence Graph: http://www.boost.org/libs/graph/doc/IncidenceGraph.html 100 | .. _Distributed Property Map: distributed_property_map.html 101 | -------------------------------------------------------------------------------- /doc/graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/graph.png -------------------------------------------------------------------------------- /doc/html/DistributedGraph.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Parallel BGL Concept Distributed Graph 8 | 9 | 10 | 11 |
12 |

Parallel BGL Concept Distributed Graph

13 | 14 | 18 |
19 |

Contents

20 | 27 |
28 |
29 |

Description

30 |

A Distributed Graph is a graph whose vertices or edges are 31 | distributed across multiple processes or address spaces. The 32 | descriptors of a Distributed Graph must model the Global 33 | Descriptor concept.

34 |
35 |
36 |

Notation

37 |
38 |
G
39 |
A type that models the Distributed Graph concept.
40 |
41 |
42 |
43 |

Refinement of

44 |
45 | 48 |
49 |
50 |
51 |

Associated types

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 61 | 62 | 64 | 65 | 67 | 68 | 70 | 71 | 72 |
Vertex 60 | descriptor typegraph_traits<G>::vertex_descriptorMust model the 63 | Global Descriptor concept.
Edge 66 | descriptor typegraph_traits<G>::edge_descriptorMust model the 69 | Global Descriptor concept.
73 |
74 |
75 |

Models

76 |
77 | 80 |
81 |
82 |

Copyright (C) 2005 The Trustees of Indiana University.

83 |

Authors: Douglas Gregor and Andrew Lumsdaine

84 |
85 |
86 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_4.png -------------------------------------------------------------------------------- /doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_4_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_4_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_5.png -------------------------------------------------------------------------------- /doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_5_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_5_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_4.png -------------------------------------------------------------------------------- /doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_4_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_4_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_5.png -------------------------------------------------------------------------------- /doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_5_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_5_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_cluster_Odin_columns_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_cluster_Odin_columns_11.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_cluster_Odin_columns_11_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_cluster_Odin_columns_11_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_4.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_4_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_4_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_5.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_5_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_5_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_6.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_6_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_6_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_7.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_7_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_7_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_8.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_8_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_8_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_9.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_9_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_9_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_cluster_Odin_columns_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_cluster_Odin_columns_11.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_cluster_Odin_columns_11_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_cluster_Odin_columns_11_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_4.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_4_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_4_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_5.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_5_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_5_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_6.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_6_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_6_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_7.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_7_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_7_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_8.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_8_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_8_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_9.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_9_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_9_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_dataset_TimeDense_columns_5_6_7_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_dataset_TimeDense_columns_5_6_7_8.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_dataset_TimeDense_columns_5_6_7_8_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_dataset_TimeDense_columns_5_6_7_8_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_dataset_TimeSparse_columns_5_6_7_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_dataset_TimeSparse_columns_5_6_7_8.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_ER_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_ER_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_SF_dataset_TimeDense_columns_5_6_7_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_SF_dataset_TimeDense_columns_5_6_7_8.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_SF_dataset_TimeDense_columns_5_6_7_8_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_SF_dataset_TimeDense_columns_5_6_7_8_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_SF_dataset_TimeSparse_columns_5_6_7_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_SF_dataset_TimeSparse_columns_5_6_7_8.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_SF_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_SF_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_SW_dataset_TimeDense_columns_5_6_7_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_SW_dataset_TimeDense_columns_5_6_7_8.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_SW_dataset_TimeDense_columns_5_6_7_8_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_SW_dataset_TimeDense_columns_5_6_7_8_speedup_1.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_SW_dataset_TimeSparse_columns_5_6_7_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_SW_dataset_TimeSparse_columns_5_6_7_8.png -------------------------------------------------------------------------------- /doc/html/chart_php_generator_SW_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/chart_php_generator_SW_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png -------------------------------------------------------------------------------- /doc/html/distributedS.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | distributedS Distribution Selector 8 | 9 | 10 | 11 |
12 |

distributedS Distribution Selector

13 | 14 | 18 |

The Boost Graph Library's class template adjacency_list supports 19 | several selectors that indicate what data structure should be used for 20 | the storage of edges or vertices. The selector vecS, for instance, 21 | indicates storage in a std::vector whereas listS indicates 22 | storage in a std::list. The Parallel BGL's distributed 23 | adjacency list supports an additional selector, distributedS, 24 | that indicates that the storage should be distributed across multiple 25 | processes. This selector can transform a sequential adjacency list 26 | into a distributed adjacency list.

27 |
28 | template<typename ProcessGroup, typename LocalSelector = vecS>
29 | struct distributedS;
30 | 
31 |
32 |

Template parameters

33 |
34 |
ProcessGroup:
35 |
The type of the process group over which the property map is 36 | distributed and also the medium for communication. This type must 37 | model the Process Group concept, but certain data structures may 38 | place additional requirements on this parameter.
39 |
LocalSelector:
40 |
A selector type (e.g., vecS) that indicates how vertices or 41 | edges should be stored in each process.
42 |
43 |
44 |

Copyright (C) 2005 The Trustees of Indiana University.

45 |

Authors: Douglas Gregor and Andrew Lumsdaine

46 |
47 |
48 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /doc/html/local_subgraph.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Parallel BGL Local Subgraph Adaptor 8 | 9 | 10 | 11 |
12 |

Parallel BGL Local Subgraph Adaptor

13 | 14 | 18 |

The local subgraph adaptor takes an existing Distributed Graph and 19 | filters out all of the nonlocal edges and vertices, presenting only 20 | the local portion of the distributed graph to the user. The behavior 21 | is equivalent to (and implemented with) a filtered graph, and is a 22 | noncopying view into the graph itself. Changes made through the 23 | filtered graph will be reflected in the original graph and vice-versa.

24 |
25 | template<typename DistributedGraph> class local_subgraph;
26 | 
27 | template<typename DistributedGraph>
28 | local_subgraph<DistributedGraph> make_local_subgraph(DistributedGraph& g);
29 | 
30 |
31 |

Where Defined

32 |

<boost/graph/distributed/local_subgraph.hpp>

33 |
34 |
35 |

Reference

36 |

The local subgraph adaptor adapts and forwards all operations of 37 | distributed graphs, the signatures of which will be omitted. Only 38 | operations unique to the local subgraph adaptor are presented.

39 |
40 |

Member Functions

41 |
42 | local_subgraph(DistributedGraph& g);
43 | 
44 |

Constructs a local subgraph presenting the local portion of the 45 | distributed graph g.

46 |
47 |
48 | DistributedGraph&         base()               { return g; }
49 | const DistributedGraph&   base() const         { return g; }
50 | 
51 |

Returns the underlying distributed graph.

52 |
53 |
54 |

Free Functions

55 |
56 | template<typename DistributedGraph>
57 | local_subgraph<DistributedGraph> make_local_subgraph(DistributedGraph& g);
58 | 
59 |

Constructs a local subgraph presenting the local portion of the 60 | distributed graph g.

61 |
62 |
63 |
64 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /doc/html/mesh_generator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Parallel BGL Mesh Generator 8 | 9 | 10 | 11 |
12 |

Parallel BGL Mesh Generator

13 | 14 | 18 |
19 |

Copyright (C) 2009 The Trustees of Indiana University.

20 |

Authors: Nick Edmonds and Andrew Lumsdaine

21 |
22 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /doc/html/pbgl-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/html/pbgl-logo.png -------------------------------------------------------------------------------- /doc/html/simple_trigger.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Parallel BGL Simple Triggers 8 | 9 | 10 | 11 |
12 |

Parallel BGL Simple Triggers

13 | 14 | 18 |
19 |

Contents

20 | 25 |
26 |
27 |

Introduction

28 |

Triggers in the process group interface are used to asynchronously 29 | receive and process messages destined for distributed data 30 | structures. The trigger interface is relatively versatile, permitting 31 | one to attach any function object to handle requests. The 32 | simple_trigger function simplifies a common case for triggers: 33 | attaching a trigger that invokes a specific member function of the 34 | distributed data structure.

35 |
36 |
37 |

Where Defined

38 |

Header <boost/graph/parallel/simple_trigger.hpp>

39 |
40 |
41 |

Reference

42 |
43 |
44 | template<typename ProcessGroup, typename Class, typename T>
45 |   void
46 |   simple_trigger(ProcessGroup& pg, int tag, Class* self,
47 |                  void (Class::*pmf)(int source, int tag, const T& data,
48 |                                     trigger_receive_context context))
49 | 
50 | template<typename ProcessGroup, typename Class, typename T, typename Result>
51 |   void
52 |   simple_trigger(ProcessGroup& pg, int tag, Class* self,
53 |                  Result (Class::*pmf)(int source, int tag, const T& data,
54 |                                       trigger_receive_context context))
55 | 
56 |
57 |

The simple_trigger function registers a trigger that invokes the 58 | given member function (pmf) on the object self whenever a 59 | message is received. If the member function has a return value, then 60 | the trigger has a reply, and can only be used via out-of-band sends 61 | that expect a reply. Otherwise, the member function returns void, 62 | and the function is registered as a normal trigger.

63 |
64 |

Copyright (C) 2007 Douglas Gregor

65 |

Copyright (C) 2007 Matthias Troyer

66 |
67 |
68 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /doc/html/ssca_generator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Parallel BGL SSCA Generator 8 | 9 | 10 | 11 |
12 |

Parallel BGL SSCA Generator

13 | 14 | 18 |

Generator from the Scalable Synthetic Compact Application #2 Graph Analysis benchmark.

19 |
20 |

Copyright (C) 2009 The Trustees of Indiana University.

21 |

Authors: Nick Edmonds and Andrew Lumsdaine

22 |
23 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /doc/local_subgraph.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | ============================= 7 | |Logo| Local Subgraph Adaptor 8 | ============================= 9 | 10 | The local subgraph adaptor takes an existing `Distributed Graph` and 11 | filters out all of the nonlocal edges and vertices, presenting only 12 | the local portion of the distributed graph to the user. The behavior 13 | is equivalent to (and implemented with) a `filtered graph`_, and is a 14 | noncopying view into the graph itself. Changes made through the 15 | filtered graph will be reflected in the original graph and vice-versa. 16 | 17 | :: 18 | 19 | template class local_subgraph; 20 | 21 | template 22 | local_subgraph make_local_subgraph(DistributedGraph& g); 23 | 24 | Where Defined 25 | ------------- 26 | 27 | 28 | Reference 29 | --------- 30 | The local subgraph adaptor adapts and forwards all operations of 31 | distributed graphs, the signatures of which will be omitted. Only 32 | operations unique to the local subgraph adaptor are presented. 33 | 34 | Member Functions 35 | ~~~~~~~~~~~~~~~~ 36 | 37 | :: 38 | 39 | local_subgraph(DistributedGraph& g); 40 | 41 | Constructs a local subgraph presenting the local portion of the 42 | distributed graph ``g``. 43 | 44 | -------------------------------------------------------------------------- 45 | 46 | :: 47 | 48 | DistributedGraph& base() { return g; } 49 | const DistributedGraph& base() const { return g; } 50 | 51 | Returns the underlying distributed graph. 52 | 53 | Free Functions 54 | ~~~~~~~~~~~~~~ 55 | 56 | :: 57 | 58 | template 59 | local_subgraph make_local_subgraph(DistributedGraph& g); 60 | 61 | Constructs a local subgraph presenting the local portion of the 62 | distributed graph ``g``. 63 | 64 | .. |Logo| image:: pbgl-logo.png 65 | :align: middle 66 | :alt: Parallel BGL 67 | :target: http://www.osl.iu.edu/research/pbgl 68 | 69 | .. _filtered graph: http://www.boost.org/libs/graph/doc/filtered_graph.html 70 | -------------------------------------------------------------------------------- /doc/mesh_generator.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2009 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | =========================== 7 | |Logo| Mesh Generator 8 | =========================== 9 | 10 | 11 | ----------------------------------------------------------------------------- 12 | 13 | Copyright (C) 2009 The Trustees of Indiana University. 14 | 15 | Authors: Nick Edmonds and Andrew Lumsdaine 16 | 17 | .. |Logo| image:: pbgl-logo.png 18 | :align: middle 19 | :alt: Parallel BGL 20 | :target: http://www.osl.iu.edu/research/pbgl 21 | -------------------------------------------------------------------------------- /doc/mpi_bsp_process_group.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2009 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | ============================ 7 | |Logo| MPI BSP Process Group 8 | ============================ 9 | 10 | .. contents:: 11 | 12 | Introduction 13 | ------------ 14 | 15 | The MPI ``mpi_process_group`` is an implementation of the `process 16 | group`_ interface using the Message Passing Interface (MPI). It is the 17 | primary process group used in the Parallel BGL at this time. 18 | 19 | Where Defined 20 | ------------- 21 | 22 | Header ```` 23 | 24 | Reference 25 | --------- 26 | 27 | :: 28 | 29 | namespace boost { namespace graph { namespace distributed { 30 | 31 | class mpi_process_group 32 | { 33 | public: 34 | typedef boost::mpi::communicator communicator_type; 35 | 36 | // Process group constructors 37 | mpi_process_group(communicator_type comm = communicator_type()); 38 | mpi_process_group(std::size_t num_headers, std::size_t buffer_size, 39 | communicator_type comm = communicator_type()); 40 | 41 | mpi_process_group(); 42 | mpi_process_group(const mpi_process_group&, boost::parallel::attach_distributed_object); 43 | 44 | // Triggers 45 | template 46 | void trigger(int tag, const Handler& handler); 47 | 48 | template 49 | void trigger_with_reply(int tag, const Handler& handler); 50 | 51 | trigger_receive_context trigger_context() const; 52 | 53 | // Helper operations 54 | void poll(); 55 | mpi_process_group base() const; 56 | }; 57 | 58 | // Process query 59 | int process_id(const mpi_process_group&); 60 | int num_processes(const mpi_process_group&); 61 | 62 | // Message transmission 63 | template 64 | void send(const mpi_process_group& pg, int dest, int tag, const T& value); 65 | 66 | template 67 | void receive(const mpi_process_group& pg, int source, int tag, T& value); 68 | 69 | optional > probe(const mpi_process_group& pg); 70 | 71 | // Synchronization 72 | void synchronize(const mpi_process_group& pg); 73 | 74 | // Out-of-band communication 75 | template 76 | void send_oob(const mpi_process_group& pg, int dest, int tag, const T& value); 77 | 78 | template 79 | void 80 | send_oob_with_reply(const mpi_process_group& pg, int dest, int 81 | tag, const T& send_value, U& receive_value); 82 | 83 | template 84 | void receive_oob(const mpi_process_group& pg, int source, int tag, T& value); 85 | 86 | } } } 87 | 88 | Since the ``mpi_process_group`` is an implementation of the `process 89 | group`_ interface, we omit the description of most of the functions in 90 | the prototype. Two constructors need special mentioning: 91 | 92 | :: 93 | 94 | mpi_process_group(communicator_type comm = communicator_type()); 95 | 96 | The constructor can take an optional MPI communicator. As default a communicator 97 | constructed from MPI_COMM_WORLD is used. 98 | 99 | :: 100 | 101 | mpi_process_group(std::size_t num_headers, std::size_t buffer_size, 102 | communicator_type comm = communicator_type()); 103 | 104 | 105 | For performance fine tuning the maximum number of headers in a message batch 106 | (num_headers) and the maximum combined size of batched messages (buffer_size) 107 | can be specified. The maximum message size of a batch is 108 | 16*num_headers+buffer_size. Sensible default values have been found by optimizing 109 | a typical application on a cluster with Ethernet network, and are num_header=64k 110 | and buffer_size=1MB, for a total maximum batches message size of 2MB. 111 | 112 | 113 | 114 | ----------------------------------------------------------------------------- 115 | 116 | Copyright (C) 2007 Douglas Gregor 117 | 118 | Copyright (C) 2007 Matthias Troyer 119 | 120 | .. |Logo| image:: pbgl-logo.png 121 | :align: middle 122 | :alt: Parallel BGL 123 | :target: http://www.osl.iu.edu/research/pbgl 124 | 125 | .. _process group: process_group.html 126 | -------------------------------------------------------------------------------- /doc/page_rank.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | =============== 7 | |Logo| PageRank 8 | =============== 9 | 10 | :: 11 | 12 | namespace graph { 13 | template 14 | inline void 15 | page_rank(const Graph& g, RankMap rank_map, Done done, 16 | typename property_traits::value_type damping = 0.85); 17 | 18 | template 19 | inline void 20 | page_rank(const Graph& g, RankMap rank_map); 21 | } 22 | 23 | The ``page_rank`` algorithm computes the ranking of vertices in a 24 | graph, based on the connectivity of a directed graph [PBMW98]_. The 25 | idea of PageRank is based on a random model of a Web surfer, who 26 | starts a random web page and then either follows a link from that web 27 | page (choosing from the links randomly) or jumps to a completely 28 | different web page (not necessarily linked from the current 29 | page). The PageRank of each page is the probability of the random web 30 | surfer visiting that page. 31 | 32 | .. contents:: 33 | 34 | Where Defined 35 | ~~~~~~~~~~~~~ 36 | <``boost/graph/distributed/page_rank.hpp``> 37 | 38 | also accessible from 39 | 40 | <``boost/graph/page_rank.hpp``> 41 | 42 | Parameters 43 | ~~~~~~~~~~ 44 | 45 | IN: ``Graph& g`` 46 | The graph type must be a model of `Distributed Vertex List Graph`_ and 47 | `Distributed Edge List Graph`_. The graph must be directed. 48 | 49 | OUT: ``RankMap rank`` 50 | Stores the rank of each vertex. The type ``RankMap`` must model the 51 | `Read/Write Property Map`_ concept and must be a `distributed 52 | property map`_. Its key type must be the vertex descriptor of the 53 | graph type and its value type must be a floating-point or rational 54 | type. 55 | 56 | IN: ``Done done`` 57 | A function object that determines when the PageRank algorithm 58 | should complete. It will be passed two parameters, the rank map and 59 | a reference to the graph, and should return ``true`` when the 60 | algorithm should terminate. 61 | 62 | **Default**: ``graph::n_iterations(20)`` 63 | 64 | IN: ``typename property_traits::value_type damping`` 65 | The damping factor is the probability that the Web surfer will 66 | select an outgoing link from the current page instead of jumping to 67 | a random page. 68 | 69 | **Default**: 0.85 70 | 71 | Complexity 72 | ~~~~~~~~~~ 73 | Each iteration of PageRank requires *O((V + E)/p)* time on *p* 74 | processors and performs *O(V)* communication. The number of 75 | iterations is dependent on the input to the algorithm. 76 | 77 | Bibliography 78 | ------------ 79 | 80 | .. [PBMW98] Lawrence Page, Sergey Brin, Rajeev Motwani, and Terry 81 | Winograd. The PageRank Citation Ranking: Bringing Order to the 82 | Web. Technical report, Stanford Digital Library Technologies Project, 83 | November 1998. 84 | 85 | ----------------------------------------------------------------------------- 86 | 87 | Copyright (C) 2005 The Trustees of Indiana University. 88 | 89 | Authors: Douglas Gregor and Andrew Lumsdaine 90 | 91 | .. |Logo| image:: pbgl-logo.png 92 | :align: middle 93 | :alt: Parallel BGL 94 | :target: http://www.osl.iu.edu/research/pbgl 95 | 96 | .. _Distributed Vertex List Graph: DistributedVertexListGraph.html 97 | .. _Distributed Edge List Graph: DistributedEdgeListGraph.html 98 | .. _Distributed property map: distributed_property_map.html 99 | .. _Readable Property Map: http://www.boost.org/libs/property_map/ReadablePropertyMap.html 100 | .. _Read/Write Property Map: http://www.boost.org/libs/property_map/ReadWritePropertyMap.html 101 | 102 | -------------------------------------------------------------------------------- /doc/rmat_generator.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2009 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | =================================== 7 | |Logo| R-MAT generator 8 | =================================== 9 | 10 | :: 11 | 12 | template 13 | class rmat_iterator 14 | { 15 | public: 16 | typedef std::input_iterator_tag iterator_category; 17 | typedef std::pair value_type; 18 | typedef const value_type& reference; 19 | typedef const value_type* pointer; 20 | typedef void difference_type; 21 | 22 | rmat_iterator(); 23 | rmat_iterator(RandomGenerator& gen, vertices_size_type n, 24 | edges_size_type m, double a, double b, double c, 25 | double d, bool permute_vertices = true); 26 | // Iterator operations 27 | reference operator*() const; 28 | pointer operator->() const; 29 | rmat_iterator& operator++(); 30 | rmat_iterator operator++(int); 31 | bool operator==(const rmat_iterator& other) const; 32 | bool operator!=(const rmat_iterator& other) const; 33 | }; 34 | 35 | This class template implements a generator for R-MAT graphs [CZF04]_, 36 | suitable for initializing an adjacency_list or other graph structure 37 | with iterator-based initialization. An R-MAT graph has a scale-free 38 | distribution w.r.t. vertex degree and is implemented using 39 | Recursive-MATrix partitioning. 40 | 41 | Where Defined 42 | ------------- 43 | <``boost/graph/rmat_graph_generator.hpp``> 44 | 45 | Constructors 46 | ------------ 47 | 48 | :: 49 | 50 | rmat_iterator(); 51 | 52 | Constructs a past-the-end iterator. 53 | 54 | :: 55 | 56 | rmat_iterator(RandomGenerator& gen, vertices_size_type n, 57 | edges_size_type m, double a, double b, double c, 58 | double d, bool permute_vertices = true); 59 | 60 | Constructs an R-MAT generator iterator that creates a graph with ``n`` 61 | vertices and ``m`` edges. ``a``, ``b``, ``c``, and ``d`` represent 62 | the probability that a generated edge is placed of each of the 4 63 | quadrants of the partitioned adjacency matrix. Probabilities are 64 | drawn from the random number generator gen. Vertex indices are 65 | permuted to eliminate locality when ``permute_vertices`` is true. 66 | 67 | Example 68 | ------- 69 | 70 | :: 71 | 72 | #include 73 | #include 74 | #include 75 | 76 | typedef boost::adjacency_list<> Graph; 77 | typedef boost::rmat_iterator RMATGen; 78 | 79 | int main() 80 | { 81 | boost::minstd_rand gen; 82 | // Create graph with 100 nodes and 400 edges 83 | Graph g(RMATGen(gen, 100, 400, 0.57, 0.19, 0.19, 0.05), RMATGen(), 100); 84 | return 0; 85 | } 86 | 87 | 88 | Bibliography 89 | ------------ 90 | 91 | .. [CZF04] D Chakrabarti, Y Zhan, and C Faloutsos. R-MAT: A Recursive 92 | Model for Graph Mining. In Proceedings of 4th International Conference 93 | on Data Mining, pages 442--446, 2004. 94 | 95 | ----------------------------------------------------------------------------- 96 | 97 | Copyright (C) 2009 The Trustees of Indiana University. 98 | 99 | Authors: Nick Edmonds and Andrew Lumsdaine 100 | 101 | .. |Logo| image:: pbgl-logo.png 102 | :align: middle 103 | :alt: Parallel BGL 104 | :target: http://www.osl.iu.edu/research/pbgl 105 | -------------------------------------------------------------------------------- /doc/scalable_rmat_generator.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2009 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | =================================== 7 | |Logo| Scalable R-MAT generator 8 | =================================== 9 | 10 | :: 11 | 12 | template 14 | class scalable_rmat_iterator 15 | { 16 | public: 17 | typedef std::input_iterator_tag iterator_category; 18 | typedef std::pair value_type; 19 | typedef const value_type& reference; 20 | typedef const value_type* pointer; 21 | typedef void difference_type; 22 | 23 | scalable_rmat_iterator(); 24 | scalable_rmat_iterator(ProcessGroup pg, Distribution distrib, 25 | RandomGenerator& gen, vertices_size_type n, 26 | edges_size_type m, double a, double b, double c, 27 | double d, bool permute_vertices = true); 28 | 29 | // Iterator operations 30 | reference operator*() const; 31 | pointer operator->() const; 32 | scalable_rmat_iterator& operator++(); 33 | scalable_rmat_iterator operator++(int); 34 | bool operator==(const scalable_rmat_iterator& other) const; 35 | bool operator!=(const scalable_rmat_iterator& other) const; 36 | }; 37 | 38 | This class template implements a generator for R-MAT graphs [CZF04]_, 39 | suitable for initializing an adjacency_list or other graph structure 40 | with iterator-based initialization. An R-MAT graph has a scale-free 41 | distribution w.r.t. vertex degree and is implemented using 42 | Recursive-MATrix partitioning. 43 | 44 | Where Defined 45 | ------------- 46 | <``boost/graph/rmat_graph_generator.hpp``> 47 | 48 | Constructors 49 | ------------ 50 | 51 | :: 52 | 53 | scalable_rmat_iterator(); 54 | 55 | Constructs a past-the-end iterator. 56 | 57 | :: 58 | 59 | scalable_rmat_iterator(ProcessGroup pg, Distribution distrib, 60 | RandomGenerator& gen, vertices_size_type n, 61 | edges_size_type m, double a, double b, double c, 62 | double d, bool permute_vertices = true); 63 | 64 | Constructs an R-MAT generator iterator that creates a graph with ``n`` 65 | vertices and ``m`` edges. Inside the ``scalable_rmat_iterator`` 66 | processes communicate using ``pg`` to generate their local edges as 67 | defined by ``distrib``. ``a``, ``b``, ``c``, and ``d`` represent the 68 | probability that a generated edge is placed of each of the 4 quadrants 69 | of the partitioned adjacency matrix. Probabilities are drawn from the 70 | random number generator ``gen``. Vertex indices are permuted to 71 | eliminate locality when ``permute_vertices`` is true. 72 | 73 | Example 74 | ------- 75 | 76 | :: 77 | 78 | #include 79 | #include 80 | #include 81 | #include 82 | 83 | using boost::graph::distributed::mpi_process_group; 84 | 85 | typedef compressed_sparse_row_graph > Graph; 87 | typedef boost::scalable_rmat_iterator RMATGen; 88 | 89 | int main() 90 | { 91 | boost::minstd_rand gen; 92 | mpi_process_group pg; 93 | 94 | int N = 100; 95 | 96 | boost::parallel::variant_distribution distrib 97 | = boost::parallel::block(pg, N); 98 | 99 | // Create graph with 100 nodes and 400 edges 100 | Graph g(RMATGen(pg, distrib, gen, N, 400, 0.57, 0.19, 0.19, 0.05), 101 | RMATGen(), N, pg, distrib); 102 | return 0; 103 | } 104 | 105 | Bibliography 106 | ------------ 107 | 108 | .. [CZF04] D Chakrabarti, Y Zhan, and C Faloutsos. R-MAT: A Recursive 109 | Model for Graph Mining. In Proceedings of 4th International Conference 110 | on Data Mining, pages 442--446, 2004. 111 | 112 | ----------------------------------------------------------------------------- 113 | 114 | Copyright (C) 2009 The Trustees of Indiana University. 115 | 116 | Authors: Nick Edmonds, Brian Barrett, and Andrew Lumsdaine 117 | 118 | .. |Logo| image:: pbgl-logo.png 119 | :align: middle 120 | :alt: Parallel BGL 121 | :target: http://www.osl.iu.edu/research/pbgl 122 | 123 | .. _Sequential connected components: http://www.boost.org/libs/graph/doc/connected_components.html 124 | -------------------------------------------------------------------------------- /doc/simple_trigger.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | ============================ 7 | |Logo| Simple Triggers 8 | ============================ 9 | 10 | .. contents:: 11 | 12 | Introduction 13 | ------------ 14 | 15 | Triggers in the `process group`_ interface are used to asynchronously 16 | receive and process messages destined for distributed data 17 | structures. The trigger interface is relatively versatile, permitting 18 | one to attach any function object to handle requests. The 19 | ``simple_trigger`` function simplifies a common case for triggers: 20 | attaching a trigger that invokes a specific member function of the 21 | distributed data structure. 22 | 23 | Where Defined 24 | ------------- 25 | 26 | Header ```` 27 | 28 | Reference 29 | --------- 30 | 31 | :: 32 | 33 | template 34 | void 35 | simple_trigger(ProcessGroup& pg, int tag, Class* self, 36 | void (Class::*pmf)(int source, int tag, const T& data, 37 | trigger_receive_context context)) 38 | 39 | template 40 | void 41 | simple_trigger(ProcessGroup& pg, int tag, Class* self, 42 | Result (Class::*pmf)(int source, int tag, const T& data, 43 | trigger_receive_context context)) 44 | 45 | The ``simple_trigger`` function registers a trigger that invokes the 46 | given member function (``pmf``) on the object ``self`` whenever a 47 | message is received. If the member function has a return value, then 48 | the trigger has a reply, and can only be used via out-of-band sends 49 | that expect a reply. Otherwise, the member function returns ``void``, 50 | and the function is registered as a normal trigger. 51 | 52 | 53 | ----------------------------------------------------------------------------- 54 | 55 | Copyright (C) 2007 Douglas Gregor 56 | 57 | Copyright (C) 2007 Matthias Troyer 58 | 59 | .. |Logo| image:: pbgl-logo.png 60 | :align: middle 61 | :alt: Parallel BGL 62 | :target: http://www.osl.iu.edu/research/pbgl 63 | 64 | .. _process group: process_group.html 65 | -------------------------------------------------------------------------------- /doc/sorted_rmat_generator.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2009 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | =================================== 7 | |Logo| Sorted R-MAT generator 8 | =================================== 9 | 10 | :: 11 | 12 | template 14 | class sorted_rmat_iterator 15 | { 16 | public: 17 | typedef std::input_iterator_tag iterator_category; 18 | typedef std::pair value_type; 19 | typedef const value_type& reference; 20 | typedef const value_type* pointer; 21 | typedef void difference_type; 22 | 23 | sorted_rmat_iterator(); 24 | sorted_rmat_iterator(RandomGenerator& gen, vertices_size_type n, 25 | edges_size_type m, double a, double b, double c, 26 | double d, bool permute_vertices = true); 27 | // Iterator operations 28 | reference operator*() const; 29 | pointer operator->() const; 30 | sorted_rmat_iterator& operator++(); 31 | sorted_rmat_iterator operator++(int); 32 | bool operator==(const sorted_rmat_iterator& other) const; 33 | bool operator!=(const sorted_rmat_iterator& other) const; 34 | }; 35 | 36 | This class template implements a generator for R-MAT graphs [CZF04]_, 37 | suitable for initializing an adjacency_list or other graph structure 38 | with iterator-based initialization. An R-MAT graph has a scale-free 39 | distribution w.r.t. vertex degree and is implemented using 40 | Recursive-MATrix partitioning. The output of this generator is sorted 41 | for use with `compressed sparse row graph`_. 42 | 43 | Where Defined 44 | ------------- 45 | <``boost/graph/rmat_graph_generator.hpp``> 46 | 47 | Constructors 48 | ------------ 49 | 50 | :: 51 | 52 | sorted_rmat_iterator(); 53 | 54 | Constructs a past-the-end iterator. 55 | 56 | :: 57 | 58 | 59 | sorted_rmat_iterator(RandomGenerator& gen, vertices_size_type n, 60 | edges_size_type m, double a, double b, double c, 61 | double d, bool permute_vertices = true, 62 | EdgePredicate ep = keep_all_edges()); 63 | 64 | Constructs an R-MAT generator iterator that creates a graph with ``n`` 65 | vertices and ``m`` edges. ``a``, ``b``, ``c``, and ``d`` represent 66 | the probability that a generated edge is placed of each of the 4 67 | quadrants of the partitioned adjacency matrix. Probabilities are 68 | drawn from the random number generator ``gen``. Vertex indices are 69 | permuted to eliminate locality when ``permute_vertices`` is true. 70 | ``ep`` allows the user to specify which edges are retained, this is 71 | useful in the case where the user wishes to refrain from storing 72 | remote edges locally during generation to reduce memory consumption. 73 | 74 | Example 75 | ------- 76 | 77 | :: 78 | 79 | #include 80 | #include 81 | #include 82 | 83 | typedef boost::compressed_sparse_row_graph<> Graph; 84 | typedef boost::sorted_rmat_iterator 85 | RMATGen; 86 | 87 | int main() 88 | { 89 | boost::minstd_rand gen; 90 | // Create graph with 100 nodes and 400 edges 91 | Graph g(RMATGen(gen, 100, 400, 0.57, 0.19, 0.19, 0.05), 92 | RMATGen(), 100); 93 | return 0; 94 | } 95 | 96 | Bibliography 97 | ------------ 98 | 99 | .. [CZF04] D Chakrabarti, Y Zhan, and C Faloutsos. R-MAT: A Recursive 100 | Model for Graph Mining. In Proceedings of 4th International Conference 101 | on Data Mining, pages 442--446, 2004. 102 | 103 | ----------------------------------------------------------------------------- 104 | 105 | Copyright (C) 2009 The Trustees of Indiana University. 106 | 107 | Authors: Nick Edmonds and Andrew Lumsdaine 108 | 109 | .. |Logo| image:: pbgl-logo.png 110 | :align: middle 111 | :alt: Parallel BGL 112 | :target: http://www.osl.iu.edu/research/pbgl 113 | 114 | .. _compressed sparse row graph: http://www.boost.org/libs/graph/doc/compressed_sparse_row.html 115 | -------------------------------------------------------------------------------- /doc/ssca_generator.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2009 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | =========================== 7 | |Logo| SSCA Generator 8 | =========================== 9 | 10 | Generator from the Scalable Synthetic Compact Application #2 Graph Analysis benchmark. 11 | 12 | 13 | ----------------------------------------------------------------------------- 14 | 15 | Copyright (C) 2009 The Trustees of Indiana University. 16 | 17 | Authors: Nick Edmonds and Andrew Lumsdaine 18 | 19 | .. |Logo| image:: pbgl-logo.png 20 | :align: middle 21 | :alt: Parallel BGL 22 | :target: http://www.osl.iu.edu/research/pbgl 23 | -------------------------------------------------------------------------------- /doc/st_connected.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2009 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | =========================== 7 | |Logo| s-t Connectivity 8 | =========================== 9 | 10 | :: 11 | 12 | namespace graph { namespace distributed { 13 | template 14 | inline bool 15 | st_connected(const DistributedGraph& g, 16 | typename graph_traits::vertex_descriptor s, 17 | typename graph_traits::vertex_descriptor t, 18 | ColorMap color) 19 | 20 | template 21 | inline bool 22 | st_connected(const DistributedGraph& g, 23 | typename graph_traits::vertex_descriptor s, 24 | typename graph_traits::vertex_descriptor t) 25 | 26 | template 27 | bool 28 | st_connected(const DistributedGraph& g, 29 | typename graph_traits::vertex_descriptor s, 30 | typename graph_traits::vertex_descriptor t, 31 | ColorMap color, OwnerMap owner) 32 | } } 33 | 34 | The ``st_connected()`` function determines whether there exists a path 35 | from ``s`` to ``t`` in a graph ``g``. If a path exists the function 36 | returns ``true``, otherwise it returns ``false``. 37 | 38 | This algorithm is currently *level-synchronized*, meaning that all 39 | vertices in a given level of the search tree will be processed 40 | (potentially in parallel) before any vertices from a successive level 41 | in the tree are processed. This is not necessary for the correctness 42 | of the algorithm but rather is an implementation detail. This 43 | algorithm could be rewritten fully-asynchronously using triggers which 44 | would remove the level-synchronized behavior. 45 | 46 | .. contents:: 47 | 48 | Where Defined 49 | ------------- 50 | <``boost/graph/distributed/st_connected.hpp``> 51 | 52 | Parameters 53 | ---------- 54 | 55 | IN: ``const DistributedGraph& g`` 56 | The graph type must be a model of `Distributed Graph`_. The graph 57 | type must also model the `Incidence Graph`_. 58 | 59 | IN: ``vertex_descriptor s`` 60 | 61 | IN: ``vertex_descriptor t`` 62 | 63 | UTIL/OUT: ``color_map(ColorMap color)`` 64 | The color map must be a `Distributed Property Map`_ with the same 65 | process group as the graph ``g`` whose colors must monotonically 66 | darken (white -> gray/green -> black). The default value is a 67 | distributed ``two_bit_color_map``. 68 | 69 | IN: ``OwnerMap owner`` 70 | The owner map must map from vertices to the process that owns them 71 | as described in the `GlobalDescriptor`_ concept. 72 | 73 | OUT: ``bool`` 74 | The algorithm returns ``true`` if a path from ``s`` to ``t`` is 75 | found, and false otherwise. 76 | 77 | Complexity 78 | ---------- 79 | 80 | This algorithm performs *O(V + E)* work in *d/2 + 1* BSP supersteps, 81 | where *d* is the shortest distance from ``s`` to ``t``. Over all 82 | supersteps, *O(E)* messages of constant size will be transmitted. 83 | 84 | Algorithm Description 85 | --------------------- 86 | 87 | The algorithm consists of two simultaneous breadth-first traversals 88 | from ``s`` and ``t`` respectively. The algorithm utilizes a single 89 | queue for both traversals with the traversal from ``s`` being denoted 90 | by a ``gray`` entry in the color map and the traversal from ``t`` 91 | being denoted by a ``green`` entry. The traversal method is similar 92 | to breadth-first search except that no visitor event points are 93 | called. When any process detects a collision in the two traversals 94 | (by attempting to set a ``gray`` vertex to ``green`` or vice-versa), 95 | it signals all processes to terminate on the next superstep and all 96 | processes return ``true``. If the queues on all processes are empty 97 | and no collision is detected then all processes terminate and return 98 | ``false``. 99 | 100 | ----------------------------------------------------------------------------- 101 | 102 | Copyright (C) 2009 The Trustees of Indiana University. 103 | 104 | Authors: Nick Edmonds and Andrew Lumsdaine 105 | 106 | .. |Logo| image:: pbgl-logo.png 107 | :align: middle 108 | :alt: Parallel BGL 109 | :target: http://www.osl.iu.edu/research/pbgl 110 | 111 | .. _Distributed Graph: DistributedGraph.html 112 | .. _Incidence Graph: http://www.boost.org/libs/graph/doc/IncidenceGraph.html 113 | .. _Distributed Property Map: distributed_property_map.html 114 | .. _GlobalDescriptor: GlobalDescriptor.html -------------------------------------------------------------------------------- /doc/unique_rmat_generator.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2004-2009 The Trustees of Indiana University. 2 | Use, modification and distribution is subject to the Boost Software 3 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 4 | http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | =================================== 7 | |Logo| Unique R-MAT generator 8 | =================================== 9 | 10 | :: 11 | 12 | template 13 | class unique_rmat_iterator 14 | { 15 | public: 16 | typedef std::input_iterator_tag iterator_category; 17 | typedef std::pair value_type; 18 | typedef const value_type& reference; 19 | typedef const value_type* pointer; 20 | typedef void difference_type; 21 | 22 | unique_rmat_iterator(); 23 | unique_rmat_iterator(RandomGenerator& gen, vertices_size_type n, 24 | edges_size_type m, double a, double b, double c, 25 | double d, bool permute_vertices = true); 26 | // Iterator operations 27 | reference operator*() const; 28 | pointer operator->() const; 29 | unique_rmat_iterator& operator++(); 30 | unique_rmat_iterator operator++(int); 31 | bool operator==(const unique_rmat_iterator& other) const; 32 | bool operator!=(const unique_rmat_iterator& other) const; 33 | }; 34 | 35 | This class template implements a generator for R-MAT graphs [CZF04]_, 36 | suitable for initializing an adjacency_list or other graph structure 37 | with iterator-based initialization. An R-MAT graph has a scale-free 38 | distribution w.r.t. vertex degree and is implemented using 39 | Recursive-MATrix partitioning. The edge list produced by this iterator 40 | is guaranteed not to contain parallel edges. 41 | 42 | Where Defined 43 | ------------- 44 | <``boost/graph/rmat_graph_generator.hpp``> 45 | 46 | Constructors 47 | ------------ 48 | 49 | :: 50 | 51 | unique_rmat_iterator(); 52 | 53 | Constructs a past-the-end iterator. 54 | 55 | :: 56 | 57 | unique_rmat_iterator(RandomGenerator& gen, vertices_size_type n, 58 | edges_size_type m, double a, double b, double c, 59 | double d, bool permute_vertices = true, 60 | EdgePredicate ep = keep_all_edges()); 61 | 62 | Constructs an R-MAT generator iterator that creates a graph with ``n`` 63 | vertices and ``m`` edges. ``a``, ``b``, ``c``, and ``d`` represent 64 | the probability that a generated edge is placed of each of the 4 65 | quadrants of the partitioned adjacency matrix. Probabilities are 66 | drawn from the random number generator ``gen``. Vertex indices are 67 | permuted to eliminate locality when ``permute_vertices`` is true. 68 | ``ep`` allows the user to specify which edges are retained, this is 69 | useful in the case where the user wishes to refrain from storing 70 | remote edges locally during generation to reduce memory consumption. 71 | 72 | Example 73 | ------- 74 | 75 | :: 76 | 77 | #include 78 | #include 79 | #include 80 | 81 | typedef boost::adjacency_list<> Graph; 82 | typedef boost::unique_rmat_iterator RMATGen; 83 | 84 | int main() 85 | { 86 | boost::minstd_rand gen; 87 | // Create graph with 100 nodes and 400 edges 88 | Graph g(RMATGen(gen, 100, 400, 0.57, 0.19, 0.19, 0.05,), 89 | RMATGen(), 100); 90 | return 0; 91 | } 92 | 93 | 94 | Bibliography 95 | ------------ 96 | 97 | .. [CZF04] D Chakrabarti, Y Zhan, and C Faloutsos. R-MAT: A Recursive 98 | Model for Graph Mining. In Proceedings of 4th International Conference 99 | on Data Mining, pages 442--446, 2004. 100 | 101 | ----------------------------------------------------------------------------- 102 | 103 | Copyright (C) 2009 The Trustees of Indiana University. 104 | 105 | Authors: Nick Edmonds and Andrew Lumsdaine 106 | 107 | .. |Logo| image:: pbgl-logo.png 108 | :align: middle 109 | :alt: Parallel BGL 110 | :target: http://www.osl.iu.edu/research/pbgl 111 | -------------------------------------------------------------------------------- /doc/vertex_coloring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boostorg/graph_parallel/787bdffb7594bccd887dc662f4113e2c7c24cf18/doc/vertex_coloring.png -------------------------------------------------------------------------------- /example/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Copyright 2009 Vladimir Prus. 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. 4 | # (See accompanying file LICENSE_1_0.txt or copy at 5 | # http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | 8 | using python ; 9 | 10 | project : requirements /boost/graph_parallel//boost_graph_parallel 11 | /boost/system//boost_system 12 | /boost/mpi//boost_mpi 13 | /python//python 14 | ; 15 | 16 | exe breadth_first_search : breadth_first_search.cpp ; 17 | exe dijkstra_shortest_paths : dijkstra_shortest_paths.cpp ; 18 | -------------------------------------------------------------------------------- /example/breadth_first_search.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | // Example usage of breadth_first_search algorithm 11 | 12 | // Enable PBGL interfaces to BGL algorithms 13 | #include 14 | 15 | // Communicate via MPI 16 | #include 17 | 18 | // Breadth-first search algorithm 19 | #include 20 | 21 | // Distributed adjacency list 22 | #include 23 | 24 | // METIS Input 25 | #include 26 | 27 | // Graphviz Output 28 | #include 29 | 30 | // For choose_min_reducer 31 | #include 32 | 33 | // Standard Library includes 34 | #include 35 | #include 36 | 37 | #ifdef BOOST_NO_EXCEPTIONS 38 | void 39 | boost::throw_exception(std::exception const& ex) 40 | { 41 | std::cout << ex.what() << std::endl; 42 | abort(); 43 | } 44 | #endif 45 | 46 | using namespace boost; 47 | using boost::graph::distributed::mpi_process_group; 48 | 49 | /* An undirected graph with distance values stored on the vertices. */ 50 | typedef adjacency_list, undirectedS, 51 | /*Vertex properties=*/property > 52 | Graph; 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | boost::mpi::environment env(argc,argv); 57 | 58 | // Parse command-line options 59 | const char* filename = "weighted_graph.gr"; 60 | if (argc > 1) filename = argv[1]; 61 | 62 | // Open the METIS input file 63 | std::ifstream in(filename); 64 | graph::metis_reader reader(in); 65 | 66 | // Load the graph using the default distribution 67 | Graph g(reader.begin(), reader.end(), 68 | reader.num_vertices()); 69 | 70 | // Get vertex 0 in the graph 71 | graph_traits::vertex_descriptor start = vertex(0, g); 72 | 73 | // Compute BFS levels from vertex 0 74 | property_map::type distance = 75 | get(vertex_distance, g); 76 | 77 | // Initialize distances to infinity and set reduction operation to 'min' 78 | BGL_FORALL_VERTICES(v, g, Graph) { 79 | put(distance, v, (std::numeric_limits::max)()); 80 | } 81 | distance.set_reduce(boost::graph::distributed::choose_min_reducer()); 82 | 83 | put(distance, start, 0); 84 | breadth_first_search 85 | (g, start, 86 | visitor(make_bfs_visitor(record_distances(distance, on_tree_edge())))); 87 | 88 | // Output a Graphviz DOT file 89 | std::string outfile; 90 | 91 | if (argc > 2) 92 | outfile = argv[2]; 93 | else { 94 | outfile = filename; 95 | size_t i = outfile.rfind('.'); 96 | if (i != std::string::npos) 97 | outfile.erase(outfile.begin() + i, outfile.end()); 98 | outfile += "-bfs.dot"; 99 | } 100 | 101 | if (process_id(process_group(g)) == 0) { 102 | std::cout << "Writing GraphViz output to " << outfile << "... "; 103 | std::cout.flush(); 104 | } 105 | write_graphviz(outfile, g, 106 | make_label_writer(distance)); 107 | if (process_id(process_group(g)) == 0) 108 | std::cout << "Done." << std::endl; 109 | 110 | return 0; 111 | } 112 | -------------------------------------------------------------------------------- /example/dijkstra_shortest_paths.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2004-2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | // Example usage of dijkstra_shortest_paths algorithm 11 | 12 | // Enable PBGL interfaces to BGL algorithms 13 | #include 14 | 15 | // Communication via MPI 16 | #include 17 | 18 | // Dijkstra's single-source shortest paths algorithm 19 | #include 20 | 21 | // Distributed adjacency list 22 | #include 23 | 24 | // METIS Input 25 | #include 26 | 27 | // Graphviz Output 28 | #include 29 | 30 | // Standard Library includes 31 | #include 32 | #include 33 | 34 | #ifdef BOOST_NO_EXCEPTIONS 35 | void 36 | boost::throw_exception(std::exception const& ex) 37 | { 38 | std::cout << ex.what() << std::endl; 39 | abort(); 40 | } 41 | #endif 42 | 43 | using namespace boost; 44 | using boost::graph::distributed::mpi_process_group; 45 | 46 | /* An undirected, weighted graph with distance values stored on the 47 | vertices. */ 48 | typedef adjacency_list, undirectedS, 49 | /*Vertex properties=*/property, 50 | /*Edge properties=*/property > 51 | Graph; 52 | 53 | int main(int argc, char* argv[]) 54 | { 55 | boost::mpi::environment env(argc,argv); 56 | 57 | // Parse command-line options 58 | const char* filename = "weighted_graph.gr"; 59 | if (argc > 1) filename = argv[1]; 60 | 61 | // Open the METIS input file 62 | std::ifstream in(filename); 63 | graph::metis_reader reader(in); 64 | 65 | // Load the graph using the default distribution 66 | Graph g(reader.begin(), reader.end(), reader.weight_begin(), 67 | reader.num_vertices()); 68 | 69 | // Get vertex 0 in the graph 70 | graph_traits::vertex_descriptor start = vertex(0, g); 71 | 72 | // Compute shortest paths from vertex 0 73 | dijkstra_shortest_paths(g, start, 74 | distance_map(get(vertex_distance, g))); 75 | 76 | // Output a Graphviz DOT file 77 | std::string outfile = filename; 78 | if (argc > 2) 79 | outfile = argv[2]; 80 | else { 81 | size_t i = outfile.rfind('.'); 82 | if (i != std::string::npos) 83 | outfile.erase(outfile.begin() + i, outfile.end()); 84 | outfile += "-dijkstra.dot"; 85 | } 86 | 87 | if (process_id(process_group(g)) == 0) { 88 | std::cout << "Writing GraphViz output to " << outfile << "... "; 89 | std::cout.flush(); 90 | } 91 | write_graphviz(outfile, g, 92 | make_label_writer(get(vertex_distance, g)), 93 | make_label_writer(get(edge_weight, g))); 94 | if (process_id(process_group(g)) == 0) 95 | std::cout << "Done." << std::endl; 96 | 97 | return 0; 98 | } 99 | -------------------------------------------------------------------------------- /include/boost/graph/accounting.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2005 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | #ifndef BOOST_GRAPH_ACCOUNTING_HPP 10 | #define BOOST_GRAPH_ACCOUNTING_HPP 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace boost { namespace graph { namespace accounting { 19 | 20 | typedef double time_type; 21 | 22 | inline time_type get_time() 23 | { 24 | return MPI_Wtime(); 25 | } 26 | 27 | inline std::string print_time(time_type t) 28 | { 29 | std::ostringstream out; 30 | out << std::setiosflags(std::ios::fixed) << std::setprecision(2) << t; 31 | return out.str(); 32 | } 33 | 34 | } } } // end namespace boost::graph::accounting 35 | 36 | #endif // BOOST_GRAPH_ACCOUNTING_HPP 37 | -------------------------------------------------------------------------------- /include/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2004-2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | #ifndef BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP 10 | #define BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP 11 | 12 | #ifndef BOOST_GRAPH_USE_MPI 13 | #error "Parallel BGL files should not be included unless has been included" 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | namespace boost { namespace graph { namespace distributed { namespace detail { 20 | 21 | /********************************************************************** 22 | * Dijkstra queue message data * 23 | **********************************************************************/ 24 | template 25 | class dijkstra_msg_value 26 | { 27 | typedef typename property_traits::value_type distance_type; 28 | typedef typename property_traits::value_type 29 | predecessor_type; 30 | 31 | public: 32 | typedef std::pair type; 33 | 34 | static type create(distance_type dist, predecessor_type pred) 35 | { return std::make_pair(dist, pred); } 36 | }; 37 | 38 | template 39 | class dijkstra_msg_value 40 | { 41 | typedef typename property_traits::key_type vertex_descriptor; 42 | public: 43 | typedef typename property_traits::value_type type; 44 | 45 | static type create(type dist, vertex_descriptor) { return dist; } 46 | }; 47 | /**********************************************************************/ 48 | 49 | } } } } // end namespace boost::graph::distributed::detail 50 | 51 | #endif // BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP 52 | -------------------------------------------------------------------------------- /include/boost/graph/distributed/detail/filtered_queue.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2004-2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | #ifndef BOOST_FILTERED_QUEUE_HPP 10 | #define BOOST_FILTERED_QUEUE_HPP 11 | 12 | #ifndef BOOST_GRAPH_USE_MPI 13 | #error "Parallel BGL files should not be included unless has been included" 14 | #endif 15 | 16 | #include 17 | 18 | namespace boost { 19 | 20 | /** Queue adaptor that filters elements pushed into the queue 21 | * according to some predicate. 22 | */ 23 | template 24 | class filtered_queue 25 | { 26 | public: 27 | typedef Buffer buffer_type; 28 | typedef Predicate predicate_type; 29 | typedef typename Buffer::value_type value_type; 30 | typedef typename Buffer::size_type size_type; 31 | 32 | /** 33 | * Constructs a new filtered queue with an initial buffer and a 34 | * predicate. 35 | * 36 | * @param buffer the initial buffer 37 | * @param pred the predicate 38 | */ 39 | explicit 40 | filtered_queue(const buffer_type& buffer = buffer_type(), 41 | const predicate_type& pred = predicate_type()) 42 | : buffer(buffer), pred(pred) {} 43 | 44 | /** Push a value into the queue. 45 | * 46 | * If the predicate returns @c true for @p x, pushes @p x into the 47 | * buffer. 48 | */ 49 | void push(const value_type& x) { if (pred(x)) buffer.push(x); } 50 | 51 | /** Pop the front element off the buffer. 52 | * 53 | * @pre @c !empty() 54 | */ 55 | void pop() { buffer.pop(); } 56 | 57 | /** Retrieve the front (top) element in the buffer. 58 | * 59 | * @pre @c !empty() 60 | */ 61 | value_type& top() { return buffer.top(); } 62 | 63 | /** 64 | * \overload 65 | */ 66 | const value_type& top() const { return buffer.top(); } 67 | 68 | /** Determine the number of elements in the buffer. */ 69 | size_type size() const { return buffer.size(); } 70 | 71 | /** Determine if the buffer is empty. */ 72 | bool empty() const { return buffer.empty(); } 73 | 74 | /** Get a reference to the underlying buffer. */ 75 | buffer_type& base() { return buffer; } 76 | const buffer_type& base() const { return buffer; } 77 | 78 | /** Swap the contents of this with @p other. */ 79 | void swap(filtered_queue& other) 80 | { 81 | using std::swap; 82 | swap(buffer, other.buffer); 83 | swap(pred, other.pred); 84 | } 85 | 86 | private: 87 | buffer_type buffer; 88 | predicate_type pred; 89 | }; 90 | 91 | /** Create a filtered queue. */ 92 | template 93 | inline filtered_queue 94 | make_filtered_queue(const Buffer& buffer, const Predicate& pred) 95 | { return filtered_queue(buffer, pred); } 96 | 97 | /** Swap a filtered_queue. */ 98 | template 99 | inline void 100 | swap(filtered_queue& x, 101 | filtered_queue& y) 102 | { 103 | x.swap(y); 104 | } 105 | 106 | } // end namespace boost 107 | 108 | #endif // BOOST_FILTERED_QUEUE_HPP 109 | -------------------------------------------------------------------------------- /include/boost/graph/distributed/detail/tag_allocator.hpp: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2007 Douglas Gregor 4 | 5 | // Use, modification and distribution is subject to the Boost Software 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | #ifndef BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP 9 | #define BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP 10 | 11 | #ifndef BOOST_GRAPH_USE_MPI 12 | #error "Parallel BGL files should not be included unless has been included" 13 | #endif 14 | 15 | #include 16 | 17 | namespace boost { namespace graph { namespace distributed { namespace detail { 18 | 19 | /** 20 | * \brief The tag allocator allows clients to request unique tags that 21 | * can be used for one-time communications. 22 | * 23 | * The tag allocator hands out tag values from a predefined maximum 24 | * (given in the constructor) moving downward. Tags are provided one 25 | * at a time via a @c token. When the @c token goes out of scope, the 26 | * tag is returned and may be reallocated. These tags should be used, 27 | * for example, for one-time communication of values. 28 | */ 29 | class tag_allocator { 30 | public: 31 | class token; 32 | friend class token; 33 | 34 | /** 35 | * Construct a new tag allocator that provides unique tags starting 36 | * with the value @p top_tag and moving lower, as necessary. 37 | */ 38 | explicit tag_allocator(int top_tag) : bottom(top_tag) { } 39 | 40 | /** 41 | * Retrieve a new tag. The token itself holds onto the tag, which 42 | * will be released when the token is destroyed. 43 | */ 44 | token get_tag(); 45 | 46 | private: 47 | int bottom; 48 | std::vector freed; 49 | }; 50 | 51 | /** 52 | * A token used to represent an allocated tag. 53 | */ 54 | class tag_allocator::token { 55 | public: 56 | /// Transfer ownership of the tag from @p other. 57 | token(const token& other); 58 | 59 | /// De-allocate the tag, if this token still owns it. 60 | ~token(); 61 | 62 | /// Retrieve the tag allocated for this task. 63 | operator int() const { return tag_; } 64 | 65 | private: 66 | /// Create a token with a specific tag from the given tag_allocator 67 | token(tag_allocator* allocator, int tag) 68 | : allocator(allocator), tag_(tag) { } 69 | 70 | /// Undefined: tokens are not copy-assignable 71 | token& operator=(const token&); 72 | 73 | /// The allocator from which this tag was allocated. 74 | tag_allocator* allocator; 75 | 76 | /// The stored tag flag. If -1, this token does not own the tag. 77 | mutable int tag_; 78 | 79 | friend class tag_allocator; 80 | }; 81 | 82 | } } } } // end namespace boost::graph::distributed::detail 83 | 84 | #endif // BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP 85 | -------------------------------------------------------------------------------- /include/boost/graph/distributed/filtered_graph.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Nick Edmonds 8 | // Douglas Gregor 9 | // Andrew Lumsdaine 10 | #ifndef BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP 11 | #define BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP 12 | 13 | #ifndef BOOST_GRAPH_USE_MPI 14 | #error "Parallel BGL files should not be included unless has been included" 15 | #endif 16 | 17 | #include 18 | #include 19 | 20 | namespace boost { 21 | namespace graph { 22 | namespace parallel { 23 | /// Retrieve the process group from a filtered graph 24 | template 25 | struct process_group_type > 26 | : process_group_type { }; 27 | 28 | template 29 | struct process_group_type > 30 | : process_group_type { }; 31 | } 32 | 33 | } 34 | 35 | /// Retrieve the process group from a filtered graph 36 | template 37 | inline typename graph::parallel::process_group_type::type 38 | process_group(filtered_graph const& g) { 39 | return process_group(g.m_g); 40 | } 41 | 42 | /// Forward vertex() to vertex() of the base graph 43 | template 44 | typename graph_traits::vertex_descriptor 45 | vertex(typename graph_traits::vertices_size_type i, 46 | filtered_graph const& g) 47 | { return vertex(i, g.m_g); } 48 | 49 | } 50 | 51 | #endif // BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP 52 | -------------------------------------------------------------------------------- /include/boost/graph/distributed/one_bit_color_map.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2010 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Jeremiah Willcock 9 | // Andrew Lumsdaine 10 | 11 | // Distributed version of the one-bit color map 12 | #ifndef BOOST_DISTRIBUTED_ONE_BIT_COLOR_MAP_HPP 13 | #define BOOST_DISTRIBUTED_ONE_BIT_COLOR_MAP_HPP 14 | 15 | #ifndef BOOST_GRAPH_USE_MPI 16 | #error "Parallel BGL files should not be included unless has been included" 17 | #endif 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace boost { 24 | 25 | template 26 | class one_bit_color_map > 27 | : public parallel::distributed_property_map > 29 | { 30 | typedef one_bit_color_map local_map; 31 | 32 | typedef parallel::distributed_property_map 34 | inherited; 35 | 36 | typedef local_property_map 37 | index_map_type; 38 | 39 | public: 40 | one_bit_color_map(std::size_t inital_size, 41 | const index_map_type& index = index_map_type()) 42 | : inherited(index.process_group(), index.global(), 43 | local_map(inital_size, index.base())) { } 44 | 45 | inherited& base() { return *this; } 46 | const inherited& base() const { return *this; } 47 | }; 48 | 49 | template 50 | inline one_bit_color_type 51 | get(one_bit_color_map > 52 | const& pm, 53 | typename property_traits::key_type key) 54 | { 55 | return get(pm.base(), key); 56 | } 57 | 58 | template 59 | inline void 60 | put(one_bit_color_map > 61 | const& pm, 62 | typename property_traits::key_type key, 63 | one_bit_color_type value) 64 | { 65 | put(pm.base(), key, value); 66 | } 67 | 68 | template 69 | class one_bit_color_map > 71 | : public parallel::distributed_property_map< 72 | ProcessGroup, GlobalMap, one_bit_color_map > 73 | { 74 | typedef one_bit_color_map local_map; 75 | 76 | typedef parallel::distributed_property_map 77 | inherited; 78 | 79 | typedef parallel::distributed_property_map 81 | index_map_type; 82 | 83 | public: 84 | one_bit_color_map(std::size_t inital_size, 85 | const index_map_type& index = index_map_type()) 86 | : inherited(index.process_group(), index.global(), 87 | local_map(inital_size, index.base())) { } 88 | 89 | inherited& base() { return *this; } 90 | const inherited& base() const { return *this; } 91 | }; 92 | 93 | template 94 | inline one_bit_color_type 95 | get(one_bit_color_map< 96 | parallel::distributed_property_map< 97 | ProcessGroup, GlobalMap, one_bit_color_map > > const& pm, 98 | typename property_traits::key_type key) 99 | { 100 | return get(pm.base(), key); 101 | } 102 | 103 | template 104 | inline void 105 | put(one_bit_color_map< 106 | parallel::distributed_property_map< 107 | ProcessGroup, GlobalMap, one_bit_color_map > > const& pm, 108 | typename property_traits::key_type key, 109 | one_bit_color_type value) 110 | { 111 | put(pm.base(), key, value); 112 | } 113 | 114 | } // end namespace boost 115 | 116 | #endif // BOOST_DISTRIBUTED_ONE_BIT_COLOR_MAP_HPP 117 | -------------------------------------------------------------------------------- /include/boost/graph/distributed/reverse_graph.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2005-2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Nick Edmonds 8 | // Andrew Lumsdaine 9 | #ifndef BOOST_GRAPH_DISTRIBUTED_REVERSE_GRAPH_HPP 10 | #define BOOST_GRAPH_DISTRIBUTED_REVERSE_GRAPH_HPP 11 | 12 | #ifndef BOOST_GRAPH_USE_MPI 13 | #error "Parallel BGL files should not be included unless has been included" 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | namespace boost { 20 | namespace graph { 21 | namespace parallel { 22 | /// Retrieve the process group from a reverse graph 23 | template 24 | struct process_group_type > 25 | : process_group_type { }; 26 | } 27 | 28 | } 29 | 30 | /// Retrieve the process group from a reverse graph 31 | template 32 | inline typename graph::parallel::process_group_type::type 33 | process_group(reverse_graph const& g) { 34 | return process_group(g.m_g); 35 | } 36 | } // namespace boost 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /include/boost/graph/distributed/selector.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | #ifndef BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP 10 | #define BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP 11 | 12 | #ifndef BOOST_GRAPH_USE_MPI 13 | #error "Parallel BGL files should not be included unless has been included" 14 | #endif 15 | 16 | #include 17 | 18 | namespace boost { 19 | 20 | /* The default local selector for a distributedS selector. */ 21 | struct defaultS {}; 22 | 23 | /** 24 | * Selector that specifies that the graph should be distributed 25 | * among different processes organized based on the given process 26 | * group. 27 | */ 28 | template 30 | struct distributedS 31 | { 32 | typedef ProcessGroup process_group_type; 33 | typedef LocalS local_selector; 34 | typedef DistributionS distribution; 35 | }; 36 | 37 | namespace detail { 38 | template 39 | struct is_distributed_selector >: mpl::true_ {}; 40 | } 41 | 42 | } 43 | 44 | #endif // BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP 45 | -------------------------------------------------------------------------------- /include/boost/graph/distributed/shuffled_distribution.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2007. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef BOOST_SHUFFLED_DISTRIBUTION_070923_HPP 6 | #define BOOST_SHUFFLED_DISTRIBUTION_070923_HPP 7 | 8 | #ifndef BOOST_GRAPH_USE_MPI 9 | #error "Parallel BGL files should not be included unless has been included" 10 | #endif 11 | 12 | # include 13 | # include 14 | # include 15 | 16 | namespace boost { namespace graph { namespace distributed { 17 | 18 | template 19 | struct shuffled_distribution : BaseDistribution 20 | { 21 | typedef std::size_t size_type; 22 | 23 | template 24 | shuffled_distribution(ProcessGroup const& pg, BaseDistribution const& base) 25 | : BaseDistribution(base) 26 | , n(num_processes(pg)) 27 | , mapping_(make_counting_iterator(size_type(0)), make_counting_iterator(n)) 28 | , reverse_mapping(mapping_) 29 | {} 30 | 31 | std::vector const& mapping() const 32 | { 33 | return mapping_; 34 | } 35 | 36 | template 37 | void assign_mapping(InputIterator first, InputIterator last) 38 | { 39 | mapping_.assign(first, last); 40 | BOOST_ASSERT(mapping_.size() == n); 41 | reverse_mapping.resize(mapping_.size()); 42 | 43 | for (std::vector::iterator i(mapping_.begin()); 44 | i != mapping_.end(); ++i) 45 | { 46 | reverse_mapping[*i] = i - mapping_.begin(); 47 | } 48 | } 49 | 50 | BaseDistribution& base() 51 | { 52 | return *this; 53 | } 54 | 55 | BaseDistribution const& base() const 56 | { 57 | return *this; 58 | } 59 | 60 | template 61 | size_type block_size(ProcessID id, size_type n) const 62 | { 63 | return base().block_size(reverse_mapping[id], n); 64 | } 65 | 66 | template 67 | size_type operator()(T const& value) const 68 | { 69 | return mapping_[base()(value)]; 70 | } 71 | 72 | template 73 | size_type start(ProcessID id) const 74 | { 75 | return base().start(reverse_mapping[id]); 76 | } 77 | 78 | size_type local(size_type i) const 79 | { 80 | return base().local(i); 81 | } 82 | 83 | size_type global(size_type i) const 84 | { 85 | return base().global(i); 86 | } 87 | 88 | template 89 | size_type global(ProcessID id, size_type n) const 90 | { 91 | return base().global(reverse_mapping[id], n); 92 | } 93 | 94 | template 95 | void serialize(Archive& ar, unsigned long /*version*/) 96 | { 97 | ar & serialization::make_nvp("base", base()); 98 | } 99 | 100 | void clear() 101 | { 102 | base().clear(); 103 | } 104 | 105 | private: 106 | size_type n; 107 | std::vector mapping_; 108 | std::vector reverse_mapping; 109 | }; 110 | 111 | }}} // namespace boost::graph::distributed 112 | 113 | #endif // BOOST_SHUFFLED_DISTRIBUTION_070923_HPP 114 | 115 | -------------------------------------------------------------------------------- /include/boost/graph/distributed/two_bit_color_map.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Jeremiah Willcock 9 | // Andrew Lumsdaine 10 | 11 | // Distributed version of the two-bit color map 12 | #ifndef BOOST_DISTRIBUTED_TWO_BIT_COLOR_MAP_HPP 13 | #define BOOST_DISTRIBUTED_TWO_BIT_COLOR_MAP_HPP 14 | 15 | #ifndef BOOST_GRAPH_USE_MPI 16 | #error "Parallel BGL files should not be included unless has been included" 17 | #endif 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace boost { 24 | 25 | template 26 | class two_bit_color_map > 27 | : public parallel::distributed_property_map > 29 | { 30 | typedef two_bit_color_map local_map; 31 | 32 | typedef parallel::distributed_property_map 34 | inherited; 35 | 36 | typedef local_property_map 37 | index_map_type; 38 | 39 | public: 40 | two_bit_color_map(std::size_t inital_size, 41 | const index_map_type& index = index_map_type()) 42 | : inherited(index.process_group(), index.global(), 43 | local_map(inital_size, index.base())) { } 44 | 45 | inherited& base() { return *this; } 46 | const inherited& base() const { return *this; } 47 | }; 48 | 49 | template 50 | inline two_bit_color_type 51 | get(two_bit_color_map > 52 | const& pm, 53 | typename property_traits::key_type key) 54 | { 55 | return get(pm.base(), key); 56 | } 57 | 58 | template 59 | inline void 60 | put(two_bit_color_map > 61 | const& pm, 62 | typename property_traits::key_type key, 63 | two_bit_color_type value) 64 | { 65 | put(pm.base(), key, value); 66 | } 67 | 68 | template 69 | class two_bit_color_map > 71 | : public parallel::distributed_property_map< 72 | ProcessGroup, GlobalMap, two_bit_color_map > 73 | { 74 | typedef two_bit_color_map local_map; 75 | 76 | typedef parallel::distributed_property_map 77 | inherited; 78 | 79 | typedef parallel::distributed_property_map 81 | index_map_type; 82 | 83 | public: 84 | two_bit_color_map(std::size_t inital_size, 85 | const index_map_type& index = index_map_type()) 86 | : inherited(index.process_group(), index.global(), 87 | local_map(inital_size, index.base())) { } 88 | 89 | inherited& base() { return *this; } 90 | const inherited& base() const { return *this; } 91 | }; 92 | 93 | template 94 | inline two_bit_color_type 95 | get(two_bit_color_map< 96 | parallel::distributed_property_map< 97 | ProcessGroup, GlobalMap, two_bit_color_map > > const& pm, 98 | typename property_traits::key_type key) 99 | { 100 | return get(pm.base(), key); 101 | } 102 | 103 | template 104 | inline void 105 | put(two_bit_color_map< 106 | parallel::distributed_property_map< 107 | ProcessGroup, GlobalMap, two_bit_color_map > > const& pm, 108 | typename property_traits::key_type key, 109 | two_bit_color_type value) 110 | { 111 | put(pm.base(), key, value); 112 | } 113 | 114 | } // end namespace boost 115 | 116 | #endif // BOOST_DISTRIBUTED_TWO_BIT_COLOR_MAP_HPP 117 | -------------------------------------------------------------------------------- /include/boost/graph/distributed/unsafe_serialize.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | // File moved 11 | #include 12 | -------------------------------------------------------------------------------- /include/boost/graph/parallel/algorithm.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2004 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | #ifndef BOOST_PARALLEL_ALGORITHM_HPP 10 | #define BOOST_PARALLEL_ALGORITHM_HPP 11 | 12 | #ifndef BOOST_GRAPH_USE_MPI 13 | #error "Parallel BGL files should not be included unless has been included" 14 | #endif 15 | 16 | #include 17 | #include // for BOOST_STATIC_CONSTANT 18 | #include 19 | 20 | namespace boost { namespace parallel { 21 | template 22 | struct is_commutative 23 | { 24 | BOOST_STATIC_CONSTANT(bool, value = false); 25 | }; 26 | 27 | template 28 | struct minimum 29 | { 30 | typedef T first_argument_type; 31 | typedef T second_argument_type; 32 | typedef T result_type; 33 | const T& operator()(const T& x, const T& y) const { return x < y? x : y; } 34 | }; 35 | 36 | template 37 | struct maximum 38 | { 39 | typedef T first_argument_type; 40 | typedef T second_argument_type; 41 | typedef T result_type; 42 | const T& operator()(const T& x, const T& y) const { return x < y? y : x; } 43 | }; 44 | 45 | template 46 | struct sum 47 | { 48 | typedef T first_argument_type; 49 | typedef T second_argument_type; 50 | typedef T result_type; 51 | const T operator()(const T& x, const T& y) const { return x + y; } 52 | }; 53 | 54 | template 56 | OutputIterator 57 | reduce(ProcessGroup pg, typename ProcessGroup::process_id_type root, 58 | InputIterator first, InputIterator last, OutputIterator out, 59 | BinaryOperation bin_op); 60 | 61 | template 62 | inline T 63 | all_reduce(ProcessGroup pg, const T& value, BinaryOperation bin_op) 64 | { 65 | T result; 66 | all_reduce(pg, 67 | const_cast(&value), const_cast(&value+1), 68 | &result, bin_op); 69 | return result; 70 | } 71 | 72 | template 73 | inline T 74 | scan(ProcessGroup pg, const T& value, BinaryOperation bin_op) 75 | { 76 | T result; 77 | scan(pg, 78 | const_cast(&value), const_cast(&value+1), 79 | &result, bin_op); 80 | return result; 81 | } 82 | 83 | 84 | template 85 | void 86 | all_gather(ProcessGroup pg, InputIterator first, InputIterator last, 87 | std::vector& out); 88 | } } // end namespace boost::parallel 89 | 90 | #include 91 | 92 | #endif // BOOST_PARALLEL_ALGORITHM_HPP 93 | -------------------------------------------------------------------------------- /include/boost/graph/parallel/basic_reduce.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2005 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | // File moved 11 | #include 12 | -------------------------------------------------------------------------------- /include/boost/graph/parallel/container_traits.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2004-2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | // 11 | // This file contains traits that describe 12 | // 13 | #ifndef BOOST_GRAPH_PARALLEL_CONTAINER_TRAITS_HPP 14 | #define BOOST_GRAPH_PARALLEL_CONTAINER_TRAITS_HPP 15 | 16 | #ifndef BOOST_GRAPH_USE_MPI 17 | #error "Parallel BGL files should not be included unless has been included" 18 | #endif 19 | 20 | namespace boost { namespace graph { namespace parallel { 21 | 22 | template 23 | struct process_group_type 24 | { 25 | typedef typename T::process_group_type type; 26 | }; 27 | 28 | template 29 | inline typename process_group_type::type 30 | process_group(const T& x) 31 | { return x.process_group(); } 32 | 33 | // Helper function that algorithms should use to get the process group 34 | // out of a container. 35 | template 36 | inline typename process_group_type::type 37 | process_group_adl(const Container& container) 38 | { 39 | return process_group(container); 40 | } 41 | 42 | 43 | } } } // end namespace boost::graph::parallel 44 | 45 | #endif // BOOST_GRAPH_PARALLEL_CONTAINER_TRAITS_HPP 46 | -------------------------------------------------------------------------------- /include/boost/graph/parallel/detail/inplace_all_to_all.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2005 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | #ifndef BOOST_GRAPH_PARALLEL_INPLACE_ALL_TO_ALL_HPP 11 | #define BOOST_GRAPH_PARALLEL_INPLACE_ALL_TO_ALL_HPP 12 | 13 | #ifndef BOOST_GRAPH_USE_MPI 14 | #error "Parallel BGL files should not be included unless has been included" 15 | #endif 16 | 17 | // 18 | // Implements the inplace all-to-all communication algorithm. 19 | // 20 | #include 21 | #include 22 | 23 | namespace boost { namespace parallel { 24 | 25 | template 26 | // where {LinearProcessGroup, MessagingProcessGroup} 27 | void 28 | inplace_all_to_all(ProcessGroup pg, 29 | const std::vector >& outgoing, 30 | std::vector >& incoming) 31 | { 32 | typedef typename std::vector::size_type size_type; 33 | 34 | typedef typename ProcessGroup::process_size_type process_size_type; 35 | typedef typename ProcessGroup::process_id_type process_id_type; 36 | 37 | process_size_type p = num_processes(pg); 38 | 39 | // Make sure there are no straggling messages 40 | synchronize(pg); 41 | 42 | // Send along the count (always) and the data (if count > 0) 43 | for (process_id_type dest = 0; dest < p; ++dest) { 44 | if (dest != process_id(pg)) { 45 | send(pg, dest, 0, outgoing[dest].size()); 46 | if (!outgoing[dest].empty()) 47 | send(pg, dest, 1, &outgoing[dest].front(), outgoing[dest].size()); 48 | } 49 | } 50 | 51 | // Make sure all of the data gets transferred 52 | synchronize(pg); 53 | 54 | // Receive the sizes and data 55 | for (process_id_type source = 0; source < p; ++source) { 56 | if (source != process_id(pg)) { 57 | size_type size; 58 | receive(pg, source, 0, size); 59 | incoming[source].resize(size); 60 | if (size > 0) 61 | receive(pg, source, 1, &incoming[source].front(), size); 62 | } else if (&incoming != &outgoing) { 63 | incoming[source] = outgoing[source]; 64 | } 65 | } 66 | } 67 | 68 | template 69 | // where {LinearProcessGroup, MessagingProcessGroup} 70 | void 71 | inplace_all_to_all(ProcessGroup pg, std::vector >& data) 72 | { 73 | inplace_all_to_all(pg, data, data); 74 | } 75 | 76 | } } // end namespace boost::parallel 77 | 78 | #endif // BOOST_GRAPH_PARALLEL_INPLACE_ALL_TO_ALL_HPP 79 | -------------------------------------------------------------------------------- /include/boost/graph/parallel/detail/untracked_pair.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Matthias Troyer 2 | // 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // 6 | // This file contains helper data structures for use in transmitting 7 | // properties. The basic idea is to optimize away any storage for the 8 | // properties when no properties are specified. 9 | 10 | // File moved 11 | #include 12 | -------------------------------------------------------------------------------- /include/boost/graph/parallel/process_group.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2004 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | // File moved 11 | #include 12 | -------------------------------------------------------------------------------- /include/boost/graph/parallel/properties.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2004 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | #ifndef BOOST_GRAPH_PARALLEL_PROPERTIES_HPP 11 | #define BOOST_GRAPH_PARALLEL_PROPERTIES_HPP 12 | 13 | #ifndef BOOST_GRAPH_USE_MPI 14 | #error "Parallel BGL files should not be included unless has been included" 15 | #endif 16 | 17 | #include 18 | #include 19 | 20 | namespace boost { 21 | /*************************************************************************** 22 | * Property map reduction operations 23 | ***************************************************************************/ 24 | /** 25 | * Metafunction that produces a reduction operation for the given 26 | * property. The default behavior merely forwards to @ref 27 | * basic_reduce, but it is expected that this class template will be 28 | * specified for important properties. 29 | */ 30 | template 31 | struct property_reduce 32 | { 33 | template 34 | class apply : public parallel::basic_reduce {}; 35 | }; 36 | 37 | /** 38 | * Reduction of vertex colors can only darken, not lighten, the 39 | * color. Black cannot turn black, grey can only turn black, and 40 | * white can be changed to either color. The default color is white. 41 | */ 42 | template<> 43 | struct property_reduce 44 | { 45 | template 46 | class apply 47 | { 48 | typedef color_traits traits; 49 | 50 | public: 51 | BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); 52 | 53 | template 54 | Color operator()(const Key&) const { return traits::white(); } 55 | 56 | template 57 | Color operator()(const Key&, Color local, Color remote) const { 58 | if (local == traits::white()) return remote; 59 | else if (remote == traits::black()) return remote; 60 | else return local; 61 | } 62 | }; 63 | }; 64 | 65 | /** 66 | * Reduction of a distance always takes the shorter distance. The 67 | * default distance value is the maximum value for the data type. 68 | */ 69 | template<> 70 | struct property_reduce 71 | { 72 | template 73 | class apply 74 | { 75 | public: 76 | BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); 77 | 78 | template 79 | T operator()(const Key&) const { return (std::numeric_limits::max)(); } 80 | 81 | template 82 | T operator()(const Key&, T x, T y) const { return x < y? x : y; } 83 | }; 84 | }; 85 | 86 | template<> 87 | struct property_reduce 88 | { 89 | template 90 | class apply 91 | { 92 | public: 93 | BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); 94 | 95 | template 96 | T operator()(Key key) const { return key; } 97 | template 98 | T operator()(Key key, T, T y) const { return y; } 99 | }; 100 | }; 101 | 102 | template 103 | inline void set_property_map_role(Property p, PropertyMap pm) 104 | { 105 | typedef typename property_traits::value_type value_type; 106 | typedef property_reduce property_red; 107 | typedef typename property_red::template apply reduce; 108 | 109 | pm.set_reduce(reduce()); 110 | } 111 | 112 | } // end namespace boost 113 | #endif // BOOST_GRAPH_PARALLEL_PROPERTIES_HPP 114 | -------------------------------------------------------------------------------- /include/boost/graph/parallel/simple_trigger.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Douglas Gregor 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // This file contains a simplification of the "trigger" method for 8 | // process groups. The simple trigger handles the common case where 9 | // the handler associated with a trigger is a member function bound to 10 | // a particular pointer. 11 | 12 | // File moved 13 | #include 14 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | Automatic redirection failed, please go to 14 | doc/html/index.html. 15 |
16 |

Distributed under the Boost Software License, Version 1.0. (See accompanying 17 | file LICENSE_1_0.txt or copy 18 | at www.boost.org/LICENSE_1_0.txt)

19 | 20 | 21 | -------------------------------------------------------------------------------- /meta/libraries.json: -------------------------------------------------------------------------------- 1 | { 2 | "key": "graph_parallel", 3 | "name": "GraphParallel", 4 | "authors": [ 5 | "Jeremy Siek, Doug Gregor, and a University of Notre Dame team." 6 | ], 7 | "description": "The PBGL graph interface and graph components are generic, in the same sense as the Standard Template Library (STL).", 8 | "category": [ 9 | "Algorithms", 10 | "Containers", 11 | "Iterators" 12 | ], 13 | "maintainers": [ 14 | "K. Noel Belcourt " 15 | ], 16 | "cxxstd": "03" 17 | } 18 | -------------------------------------------------------------------------------- /src/tag_allocator.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Douglas Gregor 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | #include 7 | #include 8 | 9 | namespace boost { namespace graph { namespace distributed { namespace detail { 10 | 11 | tag_allocator::token tag_allocator::get_tag() 12 | { 13 | int tag; 14 | 15 | if (!freed.empty()) { 16 | // Grab the tag at the top of the stack. 17 | tag = freed.back(); 18 | freed.pop_back(); 19 | } else 20 | // Grab the bottom tag and move the bottom down 21 | tag = bottom--; 22 | 23 | return token(this, tag); 24 | } 25 | 26 | tag_allocator::token::token(const token& other) 27 | : allocator(other.allocator), tag_(other.tag_) 28 | { 29 | // other no longer owns this tag 30 | other.tag_ = -1; 31 | } 32 | 33 | tag_allocator::token::~token() 34 | { 35 | if (tag_ != -1) { 36 | if (tag_ == allocator->bottom + 1) 37 | // This is the bottommost tag: just bump up the bottom 38 | ++allocator->bottom; 39 | else 40 | // This tag isn't the bottom, so push it only the freed stack 41 | allocator->freed.push_back(tag_); 42 | } 43 | } 44 | 45 | } } } } // end namespace boost::graph::distributed::detail 46 | -------------------------------------------------------------------------------- /test/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # 2 | # (C) Copyright 2005, 2006 Trustees of Indiana University 3 | # (C) Copyright 2005 Douglas Gregor 4 | # 5 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 6 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) 7 | 8 | using python ; 9 | 10 | project /boost/graph_parallel/test 11 | : requirements 12 | /boost/graph_parallel//boost_graph_parallel 13 | /boost/system//boost_system 14 | /python//python 15 | ; 16 | 17 | import mpi : mpi-test ; 18 | 19 | if [ mpi.configured ] 20 | { 21 | test-suite graph_parallel 22 | : 23 | [ mpi-test distributed_property_map_test : : : 2 ] 24 | [ mpi-test distributed_queue_test : : : 2 ] 25 | [ mpi-test process_group_serialization : : : 2 ] 26 | [ mpi-test adjlist_build_test : : : 2 ] 27 | [ mpi-test adjlist_redist_test : : : 2 ] 28 | [ mpi-test adjlist_remove_test : : : 2 ] 29 | [ mpi-test distributed_adjacency_list_test : : : 2 ] 30 | [ mpi-test distributed_connected_components_test : : : 2 ] 31 | [ mpi-test distributed_page_rank_test : : : 2 ] 32 | [ mpi-test distributed_csr_test : : : 2 ] 33 | [ mpi-test distributed_dfs_test : : : 2 ] 34 | [ mpi-test distributed_graph_coloring_test : : : 2 ] 35 | [ mpi-test distributed_mst_test : : : 2 ] 36 | [ mpi-test distributed_strong_components_test : : : 2 ] 37 | [ mpi-test hohberg_biconnected_components_test : : : 2 ] 38 | [ mpi-test mesh_generator_test : : "1000 1000 1 0" : 2 ] 39 | [ mpi-test named_vertices_seq : : : 1 ] 40 | [ mpi-test distributed_shortest_paths_test : : : 2 ] 41 | [ mpi-test distributed_csr_algorithm_test : : : 1 ] 42 | [ mpi-test distributed_betweenness_centrality_test : : : 2 ] 43 | [ mpi-test distributed_dimacs_reader : : : 2 ] 44 | [ mpi-test distributed_rmat_cc_ps : : : 2 ] 45 | [ mpi-test distributed_rmat_cc : : : 2 ] 46 | [ mpi-test distributed_rmat_pagerank : : : 2 ] 47 | [ mpi-test distributed_st_connected_test : : : 2 ] 48 | ; 49 | } 50 | 51 | build-project ../example ; 52 | -------------------------------------------------------------------------------- /test/adjlist_remove_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2004 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #ifdef BOOST_NO_EXCEPTIONS 21 | void 22 | boost::throw_exception(std::exception const& ex) 23 | { 24 | std::cout << ex.what() << std::endl; 25 | abort(); 26 | } 27 | #endif 28 | 29 | using namespace boost; 30 | using boost::graph::distributed::mpi_process_group; 31 | 32 | void test_bidirectional_graph() 33 | { 34 | typedef adjacency_list, 35 | bidirectionalS> Graph; 36 | typedef graph_traits::vertex_descriptor Vertex; 37 | 38 | typedef std::pair E; 39 | E edges[3] = { E(0,3), E(1,4), E(2,5) }; 40 | 41 | Graph g(&edges[0], &edges[0] + 3, 6); 42 | assert(num_processes(g.process_group()) == 2); 43 | 44 | if (process_id(g.process_group()) == 0) 45 | std::cerr << "Testing bidirectional graph edge removal..."; 46 | synchronize(g.process_group()); 47 | 48 | graph_traits::vertex_iterator vi = vertices(g).first; 49 | Vertex u = *vi++; 50 | Vertex v = *vi++; 51 | Vertex w = *vi++; 52 | BOOST_TEST(vi == vertices(g).second); 53 | 54 | BOOST_TEST((process_id(g.process_group()) == 0 && out_degree(u, g) == 1) 55 | || (process_id(g.process_group()) == 1 && in_degree(u, g) == 1)); 56 | 57 | BOOST_TEST((process_id(g.process_group()) == 0 && out_degree(v, g) == 1) 58 | || (process_id(g.process_group()) == 1 && in_degree(v, g) == 1)); 59 | 60 | BOOST_TEST((process_id(g.process_group()) == 0 && out_degree(w, g) == 1) 61 | || (process_id(g.process_group()) == 1 && in_degree(w, g) == 1)); 62 | 63 | // Remove edges 64 | if (process_id(g.process_group()) == 0) { 65 | remove_edge(*out_edges(u, g).first, g); 66 | remove_edge(*out_edges(w, g).first, g); 67 | } else { 68 | remove_edge(*in_edges(v, g).first, g); 69 | remove_edge(*in_edges(w, g).first, g); 70 | } 71 | 72 | synchronize(g); 73 | 74 | BOOST_TEST(num_edges(g) == 0); 75 | BOOST_TEST(out_degree(u, g) == 0); 76 | BOOST_TEST(out_degree(v, g) == 0); 77 | BOOST_TEST(out_degree(w, g) == 0); 78 | BOOST_TEST(in_degree(u, g) == 0); 79 | BOOST_TEST(in_degree(v, g) == 0); 80 | BOOST_TEST(in_degree(w, g) == 0); 81 | 82 | if (process_id(g.process_group()) == 0) std::cerr << "OK.\n"; 83 | } 84 | 85 | void test_undirected_graph() 86 | { 87 | typedef adjacency_list, 88 | undirectedS> Graph; 89 | typedef graph_traits::vertex_descriptor Vertex; 90 | typedef graph_traits::edge_descriptor Edge; 91 | 92 | typedef std::pair E; 93 | E the_edges[3] = { E(0,3), E(1,4), E(2,5) }; 94 | 95 | Graph g(&the_edges[0], &the_edges[0] + 3, 6); 96 | assert(num_processes(g.process_group()) == 2); 97 | 98 | if (process_id(g.process_group()) == 0) 99 | std::cerr << "Testing undirected graph edge removal..."; 100 | synchronize(g.process_group()); 101 | 102 | graph_traits::vertex_iterator vi = vertices(g).first; 103 | Vertex u = *vi++; 104 | Vertex v = *vi++; 105 | Vertex w = *vi++; 106 | BOOST_TEST(vi == vertices(g).second); 107 | BOOST_TEST(degree(u, g) == 1); 108 | BOOST_TEST(degree(v, g) == 1); 109 | BOOST_TEST(degree(w, g) == 1); 110 | 111 | // Remove edges 112 | if (process_id(g.process_group()) == 0) { 113 | BOOST_TEST(num_edges(g) == 3); 114 | remove_edge(*out_edges(u, g).first, g); 115 | remove_edge(*out_edges(w, g).first, g); 116 | } else { 117 | BOOST_TEST(num_edges(g) == 0); 118 | remove_edge(*in_edges(v, g).first, g); 119 | remove_edge(*in_edges(w, g).first, g); 120 | } 121 | 122 | synchronize(g); 123 | 124 | if (num_edges(g) > 0) { 125 | Edge e = *edges(g).first; 126 | std::cerr << "#" << process_id(g.process_group()) << ": extra edge! (" 127 | << local(source(e, g)) << "@" << owner(source(e, g)) 128 | << ", " 129 | << local(target(e, g)) << "@" << owner(target(e, g)) 130 | << ")\n"; 131 | } 132 | 133 | BOOST_TEST(num_edges(g) == 0); 134 | BOOST_TEST(degree(u, g) == 0); 135 | BOOST_TEST(degree(v, g) == 0); 136 | BOOST_TEST(degree(w, g) == 0); 137 | if (process_id(g.process_group()) == 0) std::cerr << "OK.\n"; 138 | } 139 | 140 | int main(int argc, char** argv) 141 | { 142 | boost::mpi::environment env(argc, argv); 143 | test_bidirectional_graph(); 144 | test_undirected_graph(); 145 | return boost::report_errors(); 146 | } 147 | -------------------------------------------------------------------------------- /test/distributed_csr_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | // A test of the distributed compressed sparse row graph type 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef BOOST_NO_EXCEPTIONS 26 | void 27 | boost::throw_exception(std::exception const& ex) 28 | { 29 | std::cout << ex.what() << std::endl; 30 | abort(); 31 | } 32 | #endif 33 | 34 | using namespace boost; 35 | using boost::graph::distributed::mpi_process_group; 36 | 37 | void concept_checks() 38 | { 39 | typedef compressed_sparse_row_graph > 41 | Digraph; 42 | typedef graph_traits::vertex_descriptor vertex_descriptor; 43 | typedef graph_traits::edge_descriptor edge_descriptor; 44 | 45 | function_requires< GraphConcept >(); 46 | function_requires< IncidenceGraphConcept >(); 47 | function_requires< AdjacencyGraphConcept >(); 48 | 49 | function_requires< DistributedVertexListGraphConcept >(); 50 | function_requires< DistributedEdgeListGraphConcept >(); 51 | 52 | function_requires< 53 | ReadablePropertyGraphConcept 54 | >(); 55 | function_requires< 56 | ReadablePropertyGraphConcept 57 | >(); 58 | function_requires< 59 | ReadablePropertyGraphConcept 60 | >(); 61 | function_requires< 62 | ReadablePropertyGraphConcept 63 | >(); 64 | 65 | function_requires< 66 | ReadablePropertyGraphConcept 67 | >(); 68 | 69 | // DPG TBD: edge_owner, edge_local property maps 70 | 71 | function_requires< 72 | ReadablePropertyGraphConcept 73 | >(); 74 | 75 | // Check default construction 76 | Digraph g; 77 | } 78 | 79 | int main(int argc, char* argv[]) 80 | { 81 | mpi::environment env(argc, argv); 82 | 83 | concept_checks(); 84 | 85 | typedef compressed_sparse_row_graph > 87 | Digraph; 88 | 89 | // Build an Erdos-Renyi graph to test with 90 | typedef sorted_erdos_renyi_iterator ERIter; 91 | 92 | int n = 40; 93 | double prob = 0.1; 94 | 95 | minstd_rand gen; 96 | Digraph g(ERIter(gen, n, prob), ERIter(), n); 97 | 98 | breadth_first_search(g, vertex(0, g), visitor(bfs_visitor<>())); 99 | 100 | std::ofstream out("dcsr.dot"); 101 | write_graphviz(out, g); 102 | return boost::report_errors(); 103 | } 104 | -------------------------------------------------------------------------------- /test/distributed_dimacs_reader.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Brian Barrett 8 | // Nick Edmonds 9 | // Andrew Lumsdaine 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifdef BOOST_NO_EXCEPTIONS 27 | void 28 | boost::throw_exception(std::exception const& ex) 29 | { 30 | std::cout << ex.what() << std::endl; 31 | abort(); 32 | } 33 | #endif 34 | 35 | using namespace boost; 36 | using namespace boost::graph; 37 | using boost::graph::distributed::mpi_process_group; 38 | 39 | typedef double time_type; 40 | 41 | inline time_type get_time() 42 | { 43 | return MPI_Wtime(); 44 | } 45 | 46 | std::string print_time(time_type t) 47 | { 48 | std::ostringstream out; 49 | out << std::setiosflags(std::ios::fixed) << std::setprecision(2) << t; 50 | return out.str(); 51 | } 52 | 53 | void 54 | test_dimacs_reader(const char *filename) 55 | { 56 | mpi_process_group pg; 57 | 58 | typedef adjacency_list, 60 | undirectedS> Graph; 61 | 62 | std::ifstream file(filename); 63 | dimacs_basic_reader reader = dimacs_basic_reader(file, false); 64 | dimacs_basic_reader end; 65 | boost::parallel::variant_distribution distrib = 66 | boost::parallel::block(pg, reader.n_vertices()); 67 | 68 | Graph g(dimacs_edge_iterator(reader), 69 | dimacs_edge_iterator(end), 70 | reader.n_vertices(), pg, distrib);; 71 | 72 | // write_graphviz("reader.dot", g); 73 | } 74 | 75 | int 76 | main(int argc, char* argv[]) 77 | { 78 | mpi::environment env(argc, argv); 79 | 80 | if (argc == 2) { 81 | test_dimacs_reader(argv[1]); 82 | } 83 | 84 | return boost::report_errors(); 85 | } 86 | -------------------------------------------------------------------------------- /test/distributed_graph_coloring_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2005, 2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | #define PBGL_ACCOUNTING 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifdef BOOST_NO_EXCEPTIONS 27 | void 28 | boost::throw_exception(std::exception const& ex) 29 | { 30 | std::cout << ex.what() << std::endl; 31 | abort(); 32 | } 33 | #endif 34 | 35 | using namespace boost; 36 | using boost::graph::distributed::mpi_process_group; 37 | 38 | void 39 | test_distributed_graph_coloring(int n, double p, int s, 40 | int seed, bool emit_dot_file) 41 | { 42 | typedef adjacency_list, 44 | undirectedS> Graph; 45 | 46 | typedef property_map::type vertex_index_map; 47 | 48 | // Build a random number generator 49 | minstd_rand gen; 50 | gen.seed(seed); 51 | 52 | // Build a random graph 53 | Graph g(erdos_renyi_iterator(gen, n, p), 54 | erdos_renyi_iterator(), 55 | n); 56 | 57 | // Set up color map 58 | std::vector colors_vec(num_vertices(g)); 59 | iterator_property_map color(&colors_vec[0], 60 | get(vertex_index, g)); 61 | 62 | // Run the graph coloring algorithm 63 | graph::boman_et_al_graph_coloring(g, color, s); 64 | 65 | if (process_id(g.process_group()) == 0) { 66 | graph::distributed::boman_et_al_graph_coloring_stats.print(std::cout); 67 | } 68 | 69 | if ( emit_dot_file ) { 70 | if ( process_id(g.process_group()) == 0 ) { 71 | for (int i = 0; i < n; ++i) 72 | get(color, vertex(i, g)); 73 | synchronize(color); 74 | } else { 75 | synchronize(color); 76 | } 77 | 78 | write_graphviz("coloring.dot", g, paint_by_number(color)); 79 | } 80 | } 81 | 82 | int main(int argc, char* argv[]) 83 | { 84 | mpi::environment env(argc, argv); 85 | 86 | int n = 1000; 87 | double p = 0.01; 88 | int s = 100; 89 | int seed = 1; 90 | bool emit_dot_file = false; 91 | 92 | if (argc > 1) n = lexical_cast(argv[1]); 93 | if (argc > 2) p = lexical_cast(argv[2]); 94 | if (argc > 3) s = lexical_cast(argv[3]); 95 | if (argc > 4) seed = lexical_cast(argv[4]); 96 | if (argc > 5) emit_dot_file = lexical_cast(argv[5]); 97 | 98 | test_distributed_graph_coloring(n, p, s, seed, emit_dot_file); 99 | 100 | return boost::report_errors(); 101 | } 102 | -------------------------------------------------------------------------------- /test/distributed_page_rank_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2004 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #ifdef BOOST_NO_EXCEPTIONS 23 | void 24 | boost::throw_exception(std::exception const& ex) 25 | { 26 | std::cout << ex.what() << std::endl; 27 | abort(); 28 | } 29 | #endif 30 | 31 | using namespace boost; 32 | using boost::graph::distributed::mpi_process_group; 33 | 34 | bool close_to(double x, double y) 35 | { 36 | double diff = x - y; 37 | if (diff < 0) diff = -diff; 38 | double base = (y == 0? x : y); 39 | if (base != 0) return diff / base < 0.01; 40 | else return true; 41 | } 42 | 43 | // Make convenient labels for the vertices 44 | enum vertex_id_t { A, B, C, D, N }; 45 | 46 | void test_distributed_page_rank(int iterations) 47 | { 48 | using namespace boost::graph; 49 | 50 | // create a typedef for the Graph type 51 | typedef adjacency_list, 53 | bidirectionalS 54 | > Graph; 55 | typedef graph_traits::vertex_descriptor vertex_descriptor; 56 | 57 | // writing out the edges in the graph 58 | typedef std::pair Edge; 59 | Edge edge_array[] = 60 | { Edge(A,B), Edge(A,C), Edge(B,C), Edge(C,A), Edge(D,C) }; 61 | const int num_edges = sizeof(edge_array)/sizeof(edge_array[0]); 62 | 63 | // declare a graph object 64 | Graph g(edge_array, edge_array + num_edges, N); 65 | 66 | std::vector ranks(num_vertices(g)); 67 | 68 | page_rank(g, 69 | make_iterator_property_map(ranks.begin(), 70 | get(boost::vertex_index, g)), 71 | n_iterations(iterations), 0.85, N); 72 | 73 | double local_sum = 0.0; 74 | for(unsigned int i = 0; i < num_vertices(g); ++i) { 75 | std::cout << (char)('A' + g.distribution().global(i)) << " = " 76 | << ranks[i] << std::endl; 77 | local_sum += ranks[i]; 78 | } 79 | double sum=0.; 80 | boost::mpi::reduce(communicator(g.process_group()), 81 | local_sum, sum, std::plus(), 0); 82 | if (process_id(g.process_group()) == 0) { 83 | std::cout << "Sum = " << sum << "\n\n"; 84 | BOOST_TEST(close_to(sum, 4)); // 1 when alpha=0 85 | } 86 | 87 | // double expected_ranks0[N] = {0.400009, 0.199993, 0.399998, 0.0}; 88 | double expected_ranks[N] = {1.49011, 0.783296, 1.5766, 0.15}; 89 | for (int i = 0; i < N; ++i) { 90 | vertex_descriptor v = vertex(i, g); 91 | if (v != Graph::null_vertex() 92 | && owner(v) == process_id(g.process_group())) { 93 | BOOST_TEST(close_to(ranks[local(v)], expected_ranks[i])); 94 | } 95 | } 96 | } 97 | 98 | int main(int argc, char* argv[]) 99 | { 100 | mpi::environment env(argc, argv); 101 | 102 | int iterations = 50; 103 | if (argc > 1) { 104 | iterations = atoi(argv[1]); 105 | } 106 | 107 | test_distributed_page_rank(iterations); 108 | 109 | return boost::report_errors(); 110 | } 111 | -------------------------------------------------------------------------------- /test/distributed_queue_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2004-2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #ifdef BOOST_NO_EXCEPTIONS 23 | void 24 | boost::throw_exception(std::exception const& ex) 25 | { 26 | std::cout << ex.what() << std::endl; 27 | abort(); 28 | } 29 | #endif 30 | 31 | using boost::graph::distributed::mpi_process_group; 32 | 33 | struct global_value 34 | { 35 | global_value(int p = -1, std::size_t l = 0) : processor(p), value(l) {} 36 | 37 | int processor; 38 | std::size_t value; 39 | 40 | template 41 | void serialize(Archiver& ar, const unsigned int /*version*/) 42 | { 43 | ar & processor & value; 44 | } 45 | }; 46 | 47 | namespace boost { namespace mpi { 48 | template<> struct is_mpi_datatype : mpl::true_ { }; 49 | } } // end namespace boost::mpi 50 | 51 | BOOST_IS_BITWISE_SERIALIZABLE(global_value) 52 | BOOST_CLASS_IMPLEMENTATION(global_value,object_serializable) 53 | BOOST_CLASS_TRACKING(global_value,track_never) 54 | 55 | inline bool operator==(const global_value& x, const global_value& y) 56 | { return x.processor == y.processor && x.value == y.value; } 57 | 58 | struct global_value_owner_map 59 | { 60 | typedef int value_type; 61 | typedef value_type reference; 62 | typedef global_value key_type; 63 | typedef boost::readable_property_map_tag category; 64 | }; 65 | 66 | int get(global_value_owner_map, global_value k) 67 | { 68 | return k.processor; 69 | } 70 | 71 | void test_distributed_queue() 72 | { 73 | mpi_process_group process_group; 74 | 75 | typedef boost::queue local_queue_type; 76 | 77 | typedef boost::graph::distributed::distributed_queue dist_queue_type; 80 | 81 | dist_queue_type Q(process_group, global_value_owner_map()); 82 | 83 | mpi_process_group::process_id_type id = process_id(process_group), 84 | n = num_processes(process_group); 85 | global_value v(0, 0); 86 | 87 | if (id == 0) { 88 | std::cerr << "Should print level of each processor in a binary tree:\n"; 89 | } 90 | synchronize(process_group); 91 | 92 | if (id == n-1) Q.push(v); 93 | while (!Q.empty()) { 94 | v = Q.top(); Q.pop(); 95 | 96 | std::cerr << "#" << id << ": level = " << v.value << std::endl; 97 | 98 | int level_begin = 1; 99 | for (std::size_t i = 0; i < v.value; ++i) level_begin *= 2; 100 | int level_end = level_begin * 2; 101 | BOOST_TEST(level_begin <= (id + 1)); 102 | BOOST_TEST((id + 1) <= level_end); 103 | 104 | ++v.value; 105 | v.processor = v.processor * 2 + 1; 106 | if (v.processor < n) Q.push(v); 107 | ++v.processor; 108 | if (v.processor < n) Q.push(v); 109 | } 110 | } 111 | 112 | int main(int argc, char** argv) 113 | { 114 | boost::mpi::environment env(argc, argv); 115 | test_distributed_queue(); 116 | return boost::report_errors(); 117 | } 118 | -------------------------------------------------------------------------------- /test/distributed_rmat_cc.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Brian Barrett 8 | // Nick Edmonds 9 | // Andrew Lumsdaine 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef BOOST_NO_EXCEPTIONS 30 | void 31 | boost::throw_exception(std::exception const& ex) 32 | { 33 | std::cout << ex.what() << std::endl; 34 | abort(); 35 | } 36 | #endif 37 | 38 | using namespace boost; 39 | using boost::graph::distributed::mpi_process_group; 40 | 41 | typedef double time_type; 42 | 43 | inline time_type get_time() 44 | { 45 | return MPI_Wtime(); 46 | } 47 | 48 | std::string print_time(time_type t) 49 | { 50 | std::ostringstream out; 51 | out << std::setiosflags(std::ios::fixed) << std::setprecision(2) << t; 52 | return out.str(); 53 | } 54 | 55 | void 56 | test_filtered_rmat_cc(int n, int m, double a, double b, double c, double d) 57 | { 58 | mpi_process_group pg; 59 | mpi_process_group::process_id_type id = process_id(pg); 60 | 61 | if (id == 0) printf("INFO: Params: n=%d, m=%d, a=%f, b=%f, c=%f, d=%f.\n", 62 | n, m, a, b, c, d); 63 | 64 | parallel::variant_distribution distrib 65 | = parallel::block(pg, n); 66 | 67 | typedef adjacency_list, 69 | undirectedS> Graph; 70 | 71 | typedef keep_local_edges, 72 | mpi_process_group::process_id_type> 73 | EdgeFilter; 74 | 75 | typedef unique_rmat_iterator 76 | RMATIter; 77 | 78 | if (id == 0) printf("INFO: Generating graph.\n"); 79 | 80 | rand48 gen; 81 | Graph g(RMATIter(gen, n, m, a, b, c, d, true, EdgeFilter(distrib, id)), 82 | RMATIter(), n, pg, distrib); 83 | 84 | synchronize(g); 85 | 86 | if (id == 0) printf("INFO: Starting connected components.\n"); 87 | 88 | std::vector local_components_vec(num_vertices(g)); 89 | typedef iterator_property_map::iterator, property_map::type> ComponentMap; 90 | ComponentMap component(local_components_vec.begin(), get(vertex_index, g)); 91 | 92 | time_type start = get_time(); 93 | int num_components = connected_components(g, component); 94 | time_type end = get_time(); 95 | 96 | if (process_id(g.process_group()) == 0) { 97 | std::cout << "INFO: Test Complete. components found = " << num_components 98 | << ", time = " << print_time(end - start) << "s." << std::endl; 99 | printf("RESULT: %d %d %d %f %f %f %f %f\n", 100 | num_processes(pg), n, m, a, b, c, d, end - start); 101 | } 102 | 103 | } 104 | 105 | int 106 | main(int argc, char* argv[]) 107 | { 108 | mpi::environment env(argc, argv); 109 | 110 | if (argc < 7) 111 | test_filtered_rmat_cc(40, 200, 0.58, 0.19, 0.19, 0.04); 112 | else 113 | test_filtered_rmat_cc(atoi(argv[1]), atoi(argv[2]), 114 | atof(argv[3]), atof(argv[4]), 115 | atof(argv[5]), atof(argv[6])); 116 | 117 | return 0; 118 | } 119 | -------------------------------------------------------------------------------- /test/distributed_rmat_cc_ps.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Brian Barrett 8 | // Nick Edmonds 9 | // Andrew Lumsdaine 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef BOOST_NO_EXCEPTIONS 30 | void 31 | boost::throw_exception(std::exception const& ex) 32 | { 33 | std::cout << ex.what() << std::endl; 34 | abort(); 35 | } 36 | #endif 37 | 38 | using namespace boost; 39 | using boost::graph::distributed::mpi_process_group; 40 | 41 | typedef double time_type; 42 | 43 | inline time_type get_time() 44 | { 45 | return MPI_Wtime(); 46 | } 47 | 48 | std::string print_time(time_type t) 49 | { 50 | std::ostringstream out; 51 | out << std::setiosflags(std::ios::fixed) << std::setprecision(2) << t; 52 | return out.str(); 53 | } 54 | 55 | void 56 | test_filtered_rmat_cc(int n, int m, double a, double b, double c, double d) 57 | { 58 | mpi_process_group pg; 59 | std::size_t id = process_id(pg); 60 | 61 | if (id == 0) printf("INFO: Params: n=%d, m=%d, a=%f, b=%f, c=%f, d=%f.\n", 62 | n, m, a, b, c, d); 63 | 64 | typedef parallel::variant_distribution Distribution; 65 | Distribution distrib = parallel::block(pg, n); 66 | 67 | typedef adjacency_list, 69 | undirectedS> Graph; 70 | 71 | typedef scalable_rmat_iterator 72 | RMATIter; 73 | 74 | if (id == 0) printf("INFO: Generating graph.\n"); 75 | 76 | rand48 gen; 77 | time_type gen_start = get_time(); 78 | Graph g(RMATIter(pg, distrib, gen, n, m, a, b, c, d, true), 79 | RMATIter(), n, pg, distrib); 80 | time_type gen_end = get_time(); 81 | std::cout << "INFO: Graph Gen time: " << print_time(gen_end - gen_start) << std::endl; 82 | 83 | synchronize(g); 84 | 85 | if (id == 0) printf("INFO: Starting connected components.\n"); 86 | 87 | std::vector local_components_vec(num_vertices(g)); 88 | typedef iterator_property_map::iterator, property_map::type> ComponentMap; 89 | ComponentMap component(local_components_vec.begin(), get(vertex_index, g)); 90 | 91 | time_type start = get_time(); 92 | int num_components = connected_components_ps(g, component); 93 | time_type end = get_time(); 94 | 95 | if (process_id(g.process_group()) == 0) { 96 | std::cout << "INFO: Test Complete. components found = " << num_components 97 | << ", time = " << print_time(end - start) << "s." << std::endl; 98 | printf("RESULT: %d %d %d %f %f %f %f %f\n", 99 | num_processes(pg), n, m, a, b, c, d, end - start); 100 | } 101 | 102 | } 103 | 104 | int 105 | main(int argc, char* argv[]) 106 | { 107 | mpi::environment env(argc, argv); 108 | 109 | if (argc < 7) 110 | test_filtered_rmat_cc(40, 200, 0.58, 0.19, 0.19, 0.04); 111 | else 112 | test_filtered_rmat_cc(atoi(argv[1]), atoi(argv[2]), 113 | atof(argv[3]), atof(argv[4]), 114 | atof(argv[5]), atof(argv[6])); 115 | 116 | return 0; 117 | } 118 | -------------------------------------------------------------------------------- /test/distributed_rmat_pagerank.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Brian Barrett 8 | // Nick Edmonds 9 | // Andrew Lumsdaine 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef BOOST_NO_EXCEPTIONS 30 | void 31 | boost::throw_exception(std::exception const& ex) 32 | { 33 | std::cout << ex.what() << std::endl; 34 | abort(); 35 | } 36 | #endif 37 | 38 | using namespace boost; 39 | using boost::graph::distributed::mpi_process_group; 40 | 41 | typedef double time_type; 42 | 43 | inline time_type get_time() 44 | { 45 | return MPI_Wtime(); 46 | } 47 | 48 | std::string print_time(time_type t) 49 | { 50 | std::ostringstream out; 51 | out << std::setiosflags(std::ios::fixed) << std::setprecision(2) << t; 52 | return out.str(); 53 | } 54 | 55 | void 56 | test_filtered_rmat_pagerank(int n, int m, double a, double b, double c, double d, int iters) 57 | { 58 | mpi_process_group pg; 59 | std::size_t id = process_id(pg); 60 | 61 | if (id == 0) printf("INFO: Params: n=%d, m=%d, a=%f, b=%f, c=%f, d=%f, iters=%d.\n", 62 | n, m, a, b, c, d, iters); 63 | 64 | typedef parallel::variant_distribution Distribution; 65 | Distribution distrib = parallel::block(pg, n); 66 | 67 | typedef adjacency_list, 69 | bidirectionalS> Graph; 70 | 71 | typedef scalable_rmat_iterator 72 | RMATIter; 73 | 74 | if (id == 0) printf("INFO: Generating graph.\n"); 75 | 76 | rand48 gen; 77 | Graph g(RMATIter(pg, distrib, gen, n, m, a, b, c, d, true), 78 | RMATIter(), n, pg, distrib); 79 | 80 | synchronize(g); 81 | 82 | if (id == 0) printf("INFO: Starting PageRank.\n"); 83 | 84 | std::vector ranks(num_vertices(g)); 85 | 86 | time_type start = get_time(); 87 | page_rank(g, make_iterator_property_map(ranks.begin(), get(boost::vertex_index, g)), 88 | graph::n_iterations(iters), 0.85, n); 89 | time_type end = get_time(); 90 | 91 | if (process_id(g.process_group()) == 0) { 92 | std::cout << "INFO: Test Complete. time = " << 93 | print_time(end - start) << "s." << std::endl; 94 | printf("RESULT: %d %d %d %f %f %f %f %f\n", 95 | num_processes(pg), n, m, a, b, c, d, end - start); 96 | } 97 | 98 | } 99 | 100 | int 101 | main(int argc, char* argv[]) 102 | { 103 | mpi::environment env(argc, argv); 104 | 105 | if (argc < 8) 106 | test_filtered_rmat_pagerank(40, 200, 0.58, 0.19, 0.19, 0.04, 10); 107 | else 108 | test_filtered_rmat_pagerank(atoi(argv[1]), atoi(argv[2]), atof(argv[3]), 109 | atof(argv[4]), atof(argv[5]), atof(argv[6]), 110 | atoi(argv[7])); 111 | 112 | return 0; 113 | } 114 | -------------------------------------------------------------------------------- /test/distributed_st_connected_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2004-2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Nick Edmonds 8 | // Andrew Lumsdaine 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifdef BOOST_NO_EXCEPTIONS 27 | void 28 | boost::throw_exception(std::exception const& ex) 29 | { 30 | std::cout << ex.what() << std::endl; 31 | abort(); 32 | } 33 | #endif 34 | 35 | using namespace boost; 36 | using boost::graph::distributed::mpi_process_group; 37 | 38 | // Set up the vertex names 39 | enum vertex_id_t { u, v, w, x, y, z, N }; 40 | char vertex_names[] = { 'u', 'v', 'w', 'x', 'y', 'z' }; 41 | 42 | void 43 | test_distributed_st_connected() { 44 | 45 | typedef adjacency_list, 47 | undirectedS, 48 | // Vertex properties 49 | property > 50 | Graph; 51 | 52 | // Specify the edges in the graph 53 | { 54 | typedef std::pair E; 55 | E edge_array[] = { E(u, u), E(u, v), E(u, w), E(v, w), E(x, y), 56 | E(x, z), E(z, y), E(z, z) }; 57 | Graph g(edge_array, edge_array + sizeof(edge_array) / sizeof(E), N); 58 | 59 | bool connected = st_connected(g, vertex(u, g), vertex(z, g), 60 | get(vertex_color, g), get(vertex_owner, g)); 61 | 62 | assert(!connected); 63 | } 64 | 65 | { 66 | typedef std::pair E; 67 | E edge_array[] = { E(u, v), E(u, w), E(u, x), E(x, v), E(y, x), 68 | E(v, y), E(w, y), E(w, z), E(z, z) }; 69 | Graph g(edge_array, edge_array + sizeof(edge_array) / sizeof(E), N); 70 | 71 | bool connected = st_connected(g, vertex(u, g), vertex(z, g), 72 | get(vertex_color, g), get(vertex_owner, g)); 73 | 74 | assert(connected); 75 | } 76 | 77 | 78 | } 79 | 80 | int main(int argc, char* argv[]) 81 | { 82 | mpi::environment env(argc, argv); 83 | test_distributed_st_connected(); 84 | return boost::report_errors(); 85 | } 86 | -------------------------------------------------------------------------------- /test/mesh_generator_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2004-2008 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef BOOST_NO_EXCEPTIONS 26 | void 27 | boost::throw_exception(std::exception const& ex) 28 | { 29 | std::cout << ex.what() << std::endl; 30 | abort(); 31 | } 32 | #endif 33 | 34 | using namespace boost; 35 | using boost::graph::distributed::mpi_process_group; 36 | 37 | /**************************************************************************** 38 | * Timing 39 | ****************************************************************************/ 40 | typedef double time_type; 41 | 42 | inline time_type get_time() 43 | { 44 | return MPI_Wtime(); 45 | } 46 | 47 | std::string print_time(time_type t) 48 | { 49 | std::ostringstream out; 50 | out << std::setiosflags(std::ios::fixed) << std::setprecision(2) << t; 51 | return out.str(); 52 | } 53 | 54 | /**************************************************************************** 55 | * Edge weight generator iterator * 56 | ****************************************************************************/ 57 | template 58 | class generator_iterator 59 | { 60 | public: 61 | typedef std::input_iterator_tag iterator_category; 62 | typedef typename F::result_type value_type; 63 | typedef const value_type& reference; 64 | typedef const value_type* pointer; 65 | typedef void difference_type; 66 | 67 | explicit generator_iterator(const F& f = F()) : f(f) { value = this->f(); } 68 | 69 | reference operator*() const { return value; } 70 | pointer operator->() const { return &value; } 71 | 72 | generator_iterator& operator++() 73 | { 74 | value = f(); 75 | return *this; 76 | } 77 | 78 | generator_iterator operator++(int) 79 | { 80 | generator_iterator temp(*this); 81 | ++(*this); 82 | return temp; 83 | } 84 | 85 | bool operator==(const generator_iterator& other) const 86 | { return f == other.f; } 87 | 88 | bool operator!=(const generator_iterator& other) const 89 | { return !(*this == other); } 90 | 91 | private: 92 | F f; 93 | value_type value; 94 | }; 95 | 96 | template 97 | inline generator_iterator make_generator_iterator(const F& f) 98 | { return generator_iterator(f); } 99 | 100 | int main(int argc, char* argv[]) 101 | { 102 | mpi::environment env(argc, argv); 103 | 104 | if (argc < 5) { 105 | std::cerr << "Usage: mesh_generator_test \n"; 106 | exit(-1); 107 | } 108 | 109 | int x(atoi(argv[1])), y(atoi(argv[2])); 110 | bool toroidal(argv[3] == std::string("true")); 111 | bool emit_dot_file(argv[4] == std::string("true")); 112 | 113 | typedef adjacency_list, 115 | undirectedS> Graph; 116 | 117 | Graph g(mesh_iterator(x, y, toroidal), 118 | mesh_iterator(), 119 | x*y); 120 | 121 | synchronize(g); 122 | 123 | BGL_FORALL_VERTICES(v, g, Graph) 124 | if (toroidal) 125 | assert(out_degree(v, g) == 4); 126 | else 127 | assert(out_degree(v, g) >= 2 && out_degree(v, g) <= 4); 128 | 129 | if ( emit_dot_file ) 130 | write_graphviz("mesh.dot", g); 131 | 132 | return boost::report_errors(); 133 | } 134 | -------------------------------------------------------------------------------- /test/named_vertices_hash_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007-2008 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #ifdef BOOST_NO_EXCEPTIONS 19 | void 20 | boost::throw_exception(std::exception const& ex) 21 | { 22 | std::cout << ex.what() << std::endl; 23 | abort(); 24 | } 25 | #endif 26 | 27 | using namespace boost; 28 | using boost::graph::distributed::mpi_process_group; 29 | 30 | /// City structure to be attached to each vertex 31 | struct City { 32 | City() {} 33 | 34 | City(const std::string& name, int population = -1) 35 | : name(name), population(population) { } 36 | 37 | template 38 | void serialize(Archiver& ar, const unsigned int /*version*/) 39 | { 40 | ar & name & population; 41 | } 42 | 43 | std::string name; 44 | int population; 45 | }; 46 | 47 | /// Our distribution function 48 | template 49 | struct named_vertices_hashed_distribution 50 | { 51 | template 52 | named_vertices_hashed_distribution(const ProcessGroup& pg, 53 | std::size_t /*num_vertices*/ = 0) 54 | : n(num_processes(pg)) { } 55 | 56 | int operator()(const T& value) const 57 | { 58 | return hasher(value) % n; 59 | } 60 | 61 | std::size_t n; 62 | boost::hash hasher; 63 | }; 64 | 65 | typedef named_vertices_hashed_distribution hasher_type; 66 | 67 | namespace boost { namespace graph { 68 | 69 | /// Use the City name as a key for indexing cities in a graph 70 | template<> 71 | struct internal_vertex_name 72 | { 73 | typedef multi_index::member type; 74 | }; 75 | 76 | /// Allow the graph to build cities given only their names (filling in 77 | /// the defaults for fields). 78 | template<> 79 | struct internal_vertex_constructor 80 | { 81 | typedef vertex_from_name type; 82 | }; 83 | 84 | // namespace distributed 85 | // { 86 | // /// Use the City name as the source for the distribution hasher 87 | // /// 88 | // /// This is currently needed in addition to the specification of this 89 | // /// hasher functor as the 3rd template parameter to the distributedS 90 | // /// template. 91 | // template<> 92 | // struct internal_vertex_name_distribution 93 | // { 94 | // typedef named_vertices_hashed_distribution type; 95 | // }; 96 | // } 97 | 98 | } } // end namespace boost::graph 99 | 100 | /// Our road map, where each of the vertices are cities 101 | typedef boost::adjacency_list, 103 | bidirectionalS, City> RoadMap; 104 | typedef graph_traits::vertex_descriptor Vertex; 105 | 106 | int main(int argc, char** argv) 107 | { 108 | boost::mpi::environment env(argc, argv); 109 | 110 | mpi_process_group pg; 111 | RoadMap map; // (pg, hasher_type(pg)); 112 | 113 | int rank = process_id(pg); 114 | bool i_am_root = rank == 0; 115 | 116 | /// Create vertices for Bloomington, Indianapolis, Chicago. Everyone will 117 | /// try to do this, but only one of each vertex will be added. 118 | Vertex bloomington = add_vertex(City("Bloomington", 69291), map); 119 | Vertex chicago = add_vertex(City("Chicago", 9500000), map); 120 | Vertex indianapolis = add_vertex(City("Indianapolis", 791926), map); 121 | 122 | BGL_FORALL_VERTICES(city, map, RoadMap) 123 | std::cout << rank << ": " << map[city].name << ", population " 124 | << map[city].population << std::endl; 125 | 126 | BOOST_TEST(*find_vertex("Bloomington", map) == bloomington); 127 | BOOST_TEST(*find_vertex("Indianapolis", map) == indianapolis); 128 | BOOST_TEST(*find_vertex("Chicago", map) == chicago); 129 | 130 | if (i_am_root) { 131 | add_edge(bloomington, "Indianapolis", map); 132 | add_edge("Indianapolis", chicago, map); 133 | add_edge("Indianapolis", "Cincinnati", map); 134 | } 135 | 136 | synchronize(map); 137 | 138 | { 139 | property_map::type 140 | city_name = get(&City::name, map); 141 | 142 | BGL_FORALL_EDGES(road, map, RoadMap) 143 | std::cout << rank << ": " << get(city_name, source(road, map)) << " -> " 144 | << get(city_name, target(road, map)) << std::endl; 145 | 146 | synchronize(map); 147 | } 148 | 149 | // Make sure the vertex for "Cincinnati" was created implicitly 150 | Vertex cincinnati = *find_vertex("Cincinnati", map); 151 | if (get(get(vertex_owner, map), cincinnati) 152 | == process_id(map.process_group())) 153 | BOOST_TEST(map[cincinnati].population == -1); 154 | 155 | synchronize(map); 156 | 157 | return boost::report_errors(); 158 | } 159 | -------------------------------------------------------------------------------- /test/named_vertices_seq.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007-2008 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #ifdef BOOST_NO_EXCEPTIONS 17 | void 18 | boost::throw_exception(std::exception const& ex) 19 | { 20 | std::cout << ex.what() << std::endl; 21 | abort(); 22 | } 23 | #endif 24 | 25 | using namespace boost; 26 | 27 | /// City structure to be attached to each vertex 28 | struct City { 29 | City() {} 30 | 31 | City(const std::string& name, int population = -1) 32 | : name(name), population(population) { } 33 | 34 | std::string name; 35 | int population; 36 | }; 37 | 38 | namespace boost { namespace graph { 39 | 40 | /// Use the City name as a key for indexing cities in a graph 41 | template<> 42 | struct internal_vertex_name 43 | { 44 | typedef multi_index::member type; 45 | }; 46 | 47 | /// Allow the graph to build cities given only their names (filling in 48 | /// the defaults for fields). 49 | template<> 50 | struct internal_vertex_constructor 51 | { 52 | typedef vertex_from_name type; 53 | }; 54 | 55 | } } // end namespace boost::graph 56 | 57 | /// Our road map, where each of the vertices are cities 58 | typedef adjacency_list RoadMap; 59 | typedef graph_traits::vertex_descriptor Vertex; 60 | 61 | int main(int argc, char* argv[]) 62 | { 63 | RoadMap map; 64 | 65 | /// Create vertices for Bloomington, Indianapolis, Chicago 66 | Vertex bloomington = add_vertex(City("Bloomington", 69291), map); 67 | Vertex indianapolis = add_vertex(City("Indianapolis", 791926), map); 68 | Vertex chicago = add_vertex(City("Chicago", 9500000), map); 69 | 70 | BOOST_TEST(add_vertex(City("Bloomington", 69291), map) == bloomington); 71 | 72 | BGL_FORALL_VERTICES(city, map, RoadMap) 73 | std::cout << map[city].name << ", population " << map[city].population 74 | << std::endl; 75 | 76 | BOOST_TEST(*find_vertex("Bloomington", map) == bloomington); 77 | BOOST_TEST(*find_vertex("Indianapolis", map) == indianapolis); 78 | BOOST_TEST(*find_vertex("Chicago", map) == chicago); 79 | 80 | add_edge(bloomington, "Indianapolis", map); 81 | add_edge("Indianapolis", chicago, map); 82 | add_edge("Indianapolis", "Cincinnati", map); 83 | 84 | BGL_FORALL_EDGES(road, map, RoadMap) 85 | std::cout << map[source(road, map)].name << " -> " 86 | << map[target(road, map)].name << std::endl; 87 | 88 | BOOST_TEST(map[*find_vertex("Cincinnati", map)].population == -1); 89 | 90 | return boost::report_errors(); 91 | } 92 | -------------------------------------------------------------------------------- /test/named_vertices_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #ifdef BOOST_NO_EXCEPTIONS 18 | void 19 | boost::throw_exception(std::exception const& ex) 20 | { 21 | std::cout << ex.what() << std::endl; 22 | abort(); 23 | } 24 | #endif 25 | 26 | using namespace boost; 27 | using boost::graph::distributed::mpi_process_group; 28 | 29 | /// City structure to be attached to each vertex 30 | struct City { 31 | City() {} 32 | 33 | City(const std::string& name, int population = -1) 34 | : name(name), population(population) { } 35 | 36 | template 37 | void serialize(Archiver& ar, const unsigned int /*version*/) 38 | { 39 | ar & name & population; 40 | } 41 | 42 | std::string name; 43 | int population; 44 | }; 45 | 46 | namespace boost { namespace graph { 47 | 48 | /// Use the City name as a key for indexing cities in a graph 49 | template<> 50 | struct internal_vertex_name 51 | { 52 | typedef multi_index::member type; 53 | }; 54 | 55 | /// Allow the graph to build cities given only their names (filling in 56 | /// the defaults for fields). 57 | template<> 58 | struct internal_vertex_constructor 59 | { 60 | typedef vertex_from_name type; 61 | }; 62 | 63 | } } // end namespace boost::graph 64 | 65 | /// Our road map, where each of the vertices are cities 66 | typedef boost::adjacency_list, 67 | bidirectionalS, City> RoadMap; 68 | typedef graph_traits::vertex_descriptor Vertex; 69 | 70 | int main(int argc, char** argv) 71 | { 72 | boost::mpi::environment env(argc, argv); 73 | 74 | RoadMap map; 75 | 76 | int rank = process_id(mpi_process_group()); 77 | bool i_am_root = rank == 0; 78 | 79 | /// Create vertices for Bloomington, Indianapolis, Chicago. Everyone will 80 | /// try to do this, but only one of each vertex will be added. 81 | Vertex bloomington = add_vertex(City("Bloomington", 69291), map); 82 | Vertex chicago = add_vertex(City("Chicago", 9500000), map); 83 | Vertex indianapolis = add_vertex(City("Indianapolis", 791926), map); 84 | 85 | BGL_FORALL_VERTICES(city, map, RoadMap) 86 | std::cout << rank << ": " << map[city].name << ", population " 87 | << map[city].population << std::endl; 88 | 89 | BOOST_TEST(*find_vertex("Bloomington", map) == bloomington); 90 | BOOST_TEST(*find_vertex("Indianapolis", map) == indianapolis); 91 | BOOST_TEST(*find_vertex("Chicago", map) == chicago); 92 | 93 | if (i_am_root) { 94 | add_edge(bloomington, "Indianapolis", map); 95 | add_edge("Indianapolis", chicago, map); 96 | add_edge("Indianapolis", "Cincinnati", map); 97 | } 98 | 99 | synchronize(map); 100 | 101 | { 102 | property_map::type 103 | city_name = get(&City::name, map); 104 | 105 | BGL_FORALL_EDGES(road, map, RoadMap) 106 | std::cout << rank << ": " << get(city_name, source(road, map)) << " -> " 107 | << get(city_name, target(road, map)) << std::endl; 108 | 109 | synchronize(map); 110 | } 111 | 112 | // Make sure the vertex for "Cincinnati" was created implicitly 113 | Vertex cincinnati = *find_vertex("Cincinnati", map); 114 | if (get(vertex_owner, map, cincinnati) 115 | == process_id(map.process_group())) 116 | BOOST_TEST(map[cincinnati].population == -1); 117 | 118 | synchronize(map); 119 | 120 | return boost::report_errors(); 121 | } 122 | -------------------------------------------------------------------------------- /test/process_group_serialization.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 The Trustees of Indiana University. 2 | 3 | // Use, modification and distribution is subject to the Boost Software 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 | // http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | // Authors: Douglas Gregor 8 | // Andrew Lumsdaine 9 | 10 | // FIXME: Including because of a missing header in the serialization library. 11 | // Patch sent to list... 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #ifdef BOOST_NO_EXCEPTIONS 22 | void 23 | boost::throw_exception(std::exception const& ex) 24 | { 25 | std::cout << ex.what() << std::endl; 26 | abort(); 27 | } 28 | #endif 29 | 30 | using boost::graph::distributed::mpi_process_group; 31 | 32 | int main(int argc, char** argv) 33 | { 34 | boost::mpi::environment env(argc, argv); 35 | 36 | mpi_process_group pg; 37 | 38 | int seventeen = 17; 39 | std::list seventeens(17, 17); 40 | 41 | if (process_id(pg) == 0) { 42 | send(pg, 1, 0, seventeen); 43 | send(pg, 1, 1, seventeens); 44 | } 45 | synchronize(pg); 46 | 47 | if (process_id(pg) == 1) { 48 | int value; 49 | receive(pg, 0, 0, value); 50 | BOOST_TEST(seventeen == value); 51 | 52 | std::list values; 53 | receive(pg, 0, 1, values); 54 | BOOST_TEST(seventeens == values); 55 | } 56 | 57 | return boost::report_errors(); 58 | } 59 | --------------------------------------------------------------------------------