Compare commits

..

2 Commits

Author SHA1 Message Date
Jeremy W. Murphy 54a94911e6 Merge pull request #417 from boostorg/develop
Merge September 2024 to early February 2025
2025-02-15 20:07:27 +11:00
Jeremy W. Murphy 198616d896 Merge pull request #377 from boostorg/develop
Merge a few years worth of changes
2024-05-20 16:12:26 +10:00
43 changed files with 313 additions and 801 deletions
-1
View File
@@ -5,7 +5,6 @@ AlignEscapedNewlinesLeft: true
AlwaysBreakAfterDefinitionReturnType: None
BreakBeforeBraces: Allman
BreakConstructorInitializersBeforeComma: false
BreakTemplateDeclarations: Yes
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 0
+15
View File
@@ -14,6 +14,12 @@ windowsglobalimage="cppalliance/dronevs2019"
def main(ctx):
return [
linux_cxx("g++-5 14", "g++-5", packages="g++-5", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-5', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("g++-5 1z", "g++-5", packages="g++-5", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-5', 'CXXSTD': '1z', }, globalenv=globalenv),
linux_cxx("g++-6 14", "g++-6", packages="g++-6", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-6', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("g++-6 1z", "g++-6", packages="g++-6", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-6', 'CXXSTD': '1z', }, globalenv=globalenv),
linux_cxx("g++-7 14", "g++-7", packages="g++-7", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-7', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("g++-7 17", "g++-7", packages="g++-7", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-7', 'CXXSTD': '17', }, globalenv=globalenv),
@@ -27,15 +33,23 @@ def main(ctx):
linux_cxx("g++-10 14", "g++-10", packages="g++-10", image="cppalliance/droneubuntu2004:1", buildtype="boost", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-10', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("g++-10 17", "g++-10", packages="g++-10", image="cppalliance/droneubuntu2004:1", buildtype="boost", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-10', 'CXXSTD': '17', }, globalenv=globalenv),
linux_cxx("g++-10 20", "g++-10", packages="g++-10", image="cppalliance/droneubuntu2004:1", buildtype="boost", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-10', 'CXXSTD': '20', }, globalenv=globalenv),
linux_cxx("clang++-4.0 14", "clang++-4.0", packages="clang-4.0", llvm_os="xenial", llvm_ver="4.0", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-4.0', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("clang++-5.0 14", "clang++-5.0", packages="clang-5.0", llvm_os="xenial", llvm_ver="5.0", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-5.0', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("clang++-6.0 14", "clang++-6.0", packages="clang-6.0", llvm_os="xenial", llvm_ver="6.0", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-6.0', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("clang++-7 14", "clang++-7", packages="clang-7", llvm_os="xenial", llvm_ver="7", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-7', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("clang++-7 17", "clang++-7", packages="clang-7", llvm_os="xenial", llvm_ver="7", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-7', 'CXXSTD': '17', }, globalenv=globalenv),
linux_cxx("clang++-8 14", "clang++-8", packages="clang-8", llvm_os="xenial", llvm_ver="8", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-8', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("clang++-8 17", "clang++-8", packages="clang-8", llvm_os="xenial", llvm_ver="8", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-8', 'CXXSTD': '17', }, globalenv=globalenv),
linux_cxx("clang++-8 2a", "clang++-8", packages="clang-8", llvm_os="xenial", llvm_ver="8", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-8', 'CXXSTD': '2a', }, globalenv=globalenv),
linux_cxx("clang++-9 14", "clang++-9", packages="clang-9", llvm_os="xenial", llvm_ver="9", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-9', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("clang++-9 17", "clang++-9", packages="clang-9", llvm_os="xenial", llvm_ver="9", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-9', 'CXXSTD': '17', }, globalenv=globalenv),
linux_cxx("clang++-9 2a", "clang++-9", packages="clang-9", llvm_os="xenial", llvm_ver="9", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-9', 'CXXSTD': '2a', }, globalenv=globalenv),
linux_cxx("clang++-10 14", "clang++-10", packages="clang-10", llvm_os="xenial", llvm_ver="10", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-10', 'CXXSTD': '14', }, globalenv=globalenv),
linux_cxx("clang++-10 17", "clang++-10", packages="clang-10", llvm_os="xenial", llvm_ver="10", buildtype="boost", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-10', 'CXXSTD': '17', }, globalenv=globalenv),
@@ -43,6 +57,7 @@ def main(ctx):
osx_cxx("XCode-11.7 14", "clang++", packages="", buildtype="boost", xcode_version="11.7", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '14', }, globalenv=globalenv),
osx_cxx("XCode-11.7 17", "clang++", packages="", buildtype="boost", xcode_version="11.7", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '17', }, globalenv=globalenv),
osx_cxx("XCode-11.7 2a", "clang++", packages="", buildtype="boost", xcode_version="11.7", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '2a', }, globalenv=globalenv),
]
# from https://github.com/boostorg/boost-ci
+64 -19
View File
@@ -7,15 +7,16 @@
name: CI
on: [ push, pull_request ]
jobs:
ubuntu:
runs-on: ubuntu-24.04
ubuntu-focal:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
compiler: [ gcc-14, clang-19 ]
cxxstd: [ 14, 17, 20, 23 ]
# Removed g++-10 because of an ICE; meant to be fixed in 10.2?
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94938
compiler: [ g++-9, clang++-10 ]
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
@@ -23,12 +24,12 @@ jobs:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
commit-filter-separator: ';'
fail-fast: true
- name: Set ENV
run: |
echo ${{ matrix.compiler }} | awk '/^gcc/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV
echo ${{ matrix.compiler }} | awk '/^gcc/ { gsub(/gcc/,"CXX=g++"); print; } /^clang/ { gsub(/clang/,"CXX=clang++"); print; }' >> $GITHUB_ENV
- name: Set TOOLSET
run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV
- name: Add repository
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
- name: Install packages
run: sudo apt install ${{ matrix.compiler }}
run: sudo apt install g++-9 clang-10
- name: Checkout main boost
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
- name: Update tools/boostdep
@@ -47,13 +48,13 @@ jobs:
run: ./b2 headers
working-directory: ../boost-root
- name: Generate user config
run: 'echo "using $TOOLSET : : $CXX ;" > ~/user-config.jam'
run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} ;" > ~/user-config.jam'
working-directory: ../boost-root
- name: Config info
run: ../../../b2 print_config_info toolset=$TOOLSET cxxstd=${{ matrix.cxxstd }}
run: ../../../b2 print_config_info toolset=$TOOLSET cxxstd=14,17,2a
working-directory: ../boost-root/libs/config/test
- name: Test
run: ../../../b2 toolset=$TOOLSET cxxstd=${{ matrix.cxxstd }}
run: ../../../b2 toolset=$TOOLSET cxxstd=14,17,2a
working-directory: ../boost-root/libs/graph/test
macos:
runs-on: macos-latest
@@ -61,9 +62,8 @@ jobs:
fail-fast: false
matrix:
toolset: [ clang ]
cxxstd: [ 14, 17, 20 ]
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
@@ -89,10 +89,51 @@ jobs:
run: ./b2 headers
working-directory: ../boost-root
- name: Config info
run: ../../../b2 print_config_info toolset=${{ matrix.toolset }} cxxstd=${{ matrix.cxxstd }}
run: ../../../b2 print_config_info toolset=${{ matrix.toolset }} cxxstd=14,17,2a
working-directory: ../boost-root/libs/config/test
- name: Test
run: ../../../b2 toolset=${{ matrix.toolset }} cxxstd=${{ matrix.cxxstd }} define=CI_SUPPRESS_KNOWN_ISSUES
run: ../../../b2 toolset=${{ matrix.toolset }} cxxstd=14,17,2a define=CI_SUPPRESS_KNOWN_ISSUES
working-directory: ../boost-root/libs/graph/test
windows_msvc_14_2:
runs-on: windows-2019
defaults:
run:
shell: cmd
strategy:
fail-fast: false
matrix:
toolset: [ msvc-14.2 ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX]'
commit-filter-separator: ';'
fail-fast: true
- name: Checkout main boost
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
- name: Update tools/boostdep
run: git submodule update --init tools/boostdep
working-directory: ../boost-root
- name: Copy files
run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\graph
working-directory: ../boost-root
- name: Install deps
run: python tools/boostdep/depinst/depinst.py graph
working-directory: ../boost-root
- name: Bootstrap
run: bootstrap
working-directory: ../boost-root
- name: Generate headers
run: b2 headers
working-directory: ../boost-root
- name: Config info
run: ..\..\..\b2 print_config_info cxxstd=14,17,20 address-model=64 toolset=msvc-14.2
working-directory: ../boost-root/libs/config/test
- name: Test
run: ..\..\..\b2 --hash address-model=64 cxxstd=14,17,20 toolset=msvc-14.2
working-directory: ../boost-root/libs/graph/test
windows_msvc_14_3:
runs-on: windows-2022
@@ -141,8 +182,10 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: ubuntu-24.04
- os: macos-13
- os: macos-14
- os: macos-15
@@ -188,8 +231,10 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: ubuntu-24.04
- os: macos-13
- os: macos-14
- os: macos-15
@@ -245,8 +290,8 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
- os: windows-2025
runs-on: ${{matrix.os}}
@@ -294,8 +339,8 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
- os: windows-2025
runs-on: ${{matrix.os}}
+2 -1
View File
@@ -2,7 +2,7 @@
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.8...3.16)
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_graph VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
@@ -22,6 +22,7 @@ target_link_libraries(boost_graph
Boost::array
Boost::assert
Boost::bimap
Boost::bind
Boost::concept_check
Boost::config
Boost::container_hash
-62
View File
@@ -1,62 +0,0 @@
# Copyright René Ferdinand Rivera Morell 2024
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.2 ;
constant boost_dependencies :
/boost/algorithm//boost_algorithm
/boost/any//boost_any
/boost/array//boost_array
/boost/assert//boost_assert
/boost/bimap//boost_bimap
/boost/bind//boost_bind
/boost/concept_check//boost_concept_check
/boost/config//boost_config
/boost/container_hash//boost_container_hash
/boost/conversion//boost_conversion
/boost/core//boost_core
/boost/detail//boost_detail
/boost/foreach//boost_foreach
/boost/function//boost_function
/boost/geometry//boost_geometry
/boost/integer//boost_integer
/boost/iterator//boost_iterator
/boost/lexical_cast//boost_lexical_cast
/boost/math//boost_math_tr1
/boost/move//boost_move
/boost/mpl//boost_mpl
/boost/multi_index//boost_multi_index
/boost/optional//boost_optional
/boost/parameter//boost_parameter
/boost/preprocessor//boost_preprocessor
/boost/property_map//boost_property_map
/boost/property_tree//boost_property_tree
/boost/random//boost_random
/boost/range//boost_range
/boost/serialization//boost_serialization
/boost/smart_ptr//boost_smart_ptr
/boost/spirit//boost_spirit
/boost/static_assert//boost_static_assert
/boost/throw_exception//boost_throw_exception
/boost/tti//boost_tti
/boost/tuple//boost_tuple
/boost/type_traits//boost_type_traits
/boost/typeof//boost_typeof
/boost/unordered//boost_unordered
/boost/utility//boost_utility
/boost/xpressive//boost_xpressive ;
project /boost/graph
;
explicit
[ alias boost_graph : build//boost_graph ]
[ alias all : boost_graph example test ]
;
call-if : boost-library graph
: install boost_graph
;
+4 -8
View File
@@ -6,15 +6,9 @@
import mpi ;
constant boost_dependencies_private :
/boost/regex//boost_regex
;
project
: common-requirements <include>../include <library>$(boost_dependencies)
: requirements <include>../src <library>$(boost_dependencies_private)
project boost/graph
: requirements <include>../src
: source-location ../src
: usage-requirements <define>BOOST_GRAPH_NO_LIB=1
;
lib boost_graph
@@ -30,3 +24,5 @@ lib boost_graph
:
:
;
boost-install boost_graph ;
+1 -1
View File
@@ -69,7 +69,7 @@
<p>
Defined in
<a href="../../../boost/graph/grid_graph.hpp"><tt>boost/graph/grid_graph.hpp</tt></a>
with all functions in the <tt>boost</tt> namespace. A simple examples of creating and iterating over a grid_graph is available here <a href="../../../libs/graph/example/grid_graph_example.cpp"><tt>libs/graph/example/grid_graph_example.cpp</tt></a>. An example of adding properties to a grid_graph is also available <a href="../../../libs/graph/example/grid_graph_properties.cpp"><tt>libs/graph/example/grid_graph_properties.cpp</tt></a>
with all functions in the <tt>boost</tt> namespace. A simple examples of creating and iterating over a grid_graph is available here <a href="../../../libs/graph/example/grid_graph_example.cpp"><tt>libs/graph/example/grid_graph_example.cpp</tt></a>. An example of adding properties to a grid_graph is also available <a href="../../../libs/graph/example/grid_graph_example.cpp"><tt>libs/graph/example/grid_graph_properties.cpp</tt></a>
</p>
<h4>Template Parameters</h4>
+1 -6
View File
@@ -329,11 +329,6 @@ If <tt>vis</tt> is an object of a type modelling the ResourceConstrainedShortest
<table border>
<tr>
<td>
<tt>vis.on_enter_loop(const Queue&amp; queue, const Graph&amp; g )</tt>
</td>
</tr>
<tr>
<td>
<tt>vis.on_label_popped( const Label&amp; l, const Graph&amp; g )</tt>
</td>
</tr>
@@ -358,7 +353,7 @@ If <tt>vis</tt> is an object of a type modelling the ResourceConstrainedShortest
</td>
</tr>
</table>
Note that <i>on_enter_loop</i> returns a boolean that signals whether the main loop should continue (see the <i>default_r_c_shortest_paths_visitor</i> in the <a href="../../../boost/graph/r_c_shortest_paths.hpp"><tt>source code</tt></a> for inspiration). See the <a href="#Label">description of the Label concept</a> for the interface of a Label. See the <a href="#FunctionsDescription">algorithm description</a> for information on when these functions are called.
See the <a href="#Label">description of the Label concept</a> for the interface of a Label. See the <a href="#FunctionsDescription">algorithm description</a> for information on when these functions are called.
<p>
<a name="FunctionsDescription"><h3>Functions Description</h3></a>
+7 -12
View File
@@ -3,17 +3,12 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.0.1 ;
import-search /boost/config/checks ;
import config : requires ;
import ../../config/checks/config : requires ;
import modules ;
import path ;
path-constant TEST_DIR : . ;
project : requirements <library>/boost/graph//boost_graph ;
run accum-compile-times.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat $(TEST_DIR)/target-compile-costs.dat ;
exe actor_clustering : actor_clustering.cpp ;
run adj_list_ra_edgelist.cpp ;
@@ -80,15 +75,15 @@ run filtered_graph.cpp ;
run filtered_graph_edge_range.cpp ;
run filtered_vec_as_graph.cpp ;
run filtered-copy-example.cpp ;
exe fr_layout : fr_layout.cpp /boost/timer//boost_timer : [ requires cxx11_noexcept cxx11_rvalue_references sfinae_expr cxx11_auto_declarations cxx11_lambdas cxx11_unified_initialization_syntax cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_hdr_chrono cxx11_thread_local cxx11_constexpr cxx11_nullptr cxx11_numeric_limits cxx11_decltype cxx11_hdr_array cxx11_hdr_atomic cxx11_hdr_type_traits cxx11_allocator cxx11_explicit_conversion_operators ] ;
exe fr_layout : fr_layout.cpp : [ requires cxx11_noexcept cxx11_rvalue_references sfinae_expr cxx11_auto_declarations cxx11_lambdas cxx11_unified_initialization_syntax cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_hdr_chrono cxx11_thread_local cxx11_constexpr cxx11_nullptr cxx11_numeric_limits cxx11_decltype cxx11_hdr_array cxx11_hdr_atomic cxx11_hdr_type_traits cxx11_allocator cxx11_explicit_conversion_operators ] ;
run gerdemann.cpp ;
run graph.cpp ;
run graph_as_tree.cpp ;
run graph_property.cpp ;
run graph-assoc-types.cpp ;
run graph-property-iter-eg.cpp ;
run graph-thingie.cpp /boost/graph//boost_graph ;
run graphviz.cpp /boost/graph//boost_graph : $(TEST_DIR)/graphviz_example.dot ;
run graph-thingie.cpp ../build//boost_graph ;
run graphviz.cpp ../build//boost_graph : $(TEST_DIR)/graphviz_example.dot ;
run grid_graph_example.cpp ;
run grid_graph_properties.cpp ;
exe hawick_circuits : hawick_circuits.cpp ;
@@ -119,7 +114,7 @@ exe mean_geodesic : mean_geodesic.cpp ;
exe minimum_degree_ordering : minimum_degree_ordering.cpp ;
run modify_graph.cpp ;
run neighbor_bfs.cpp ;
run ospf-example.cpp /boost/graph//boost_graph : $(TEST_DIR)/figs/ospf-graph.dot $(TEST_DIR)/figs/ospf-sptree.dot $(TEST_DIR)/routing-table.dat ;
run ospf-example.cpp ../build//boost_graph : $(TEST_DIR)/figs/ospf-graph.dot $(TEST_DIR)/figs/ospf-sptree.dot $(TEST_DIR)/routing-table.dat ;
run parallel-compile-time.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat $(TEST_DIR)/target-compile-costs.dat ;
run planar_face_traversal.cpp ;
run prim-example.cpp ;
@@ -134,7 +129,7 @@ run put-get-helper-eg.cpp ;
run quick_tour.cpp ;
run quick-tour.cpp ;
run r_c_shortest_paths_example.cpp ;
run read_graphviz.cpp /boost/graph//boost_graph ;
run read_graphviz.cpp ../build//boost_graph ;
exe read_write_dimacs : read_write_dimacs-eg.cpp ;
run remove_edge_if_bidir.cpp ;
run remove_edge_if_dir.cpp ;
@@ -213,7 +208,7 @@ explicit girth ;
#run edge-connectivity.cpp ;
#
# These compile, but still use the old graphviz interface and die and runtime:
# run strong_components.cpp /boost/graph//boost_graph ;
# run strong_components.cpp ../build//boost_graph ;
#
+4 -3
View File
@@ -25,18 +25,19 @@ int main()
H,
n_vertices
};
const int n_edges = 11;
typedef std::pair< int, int > Edge;
// The list of connections between routers stored in an array.
Edge edges[] = { Edge(A, B), Edge(A, C), Edge(B, D), Edge(B, E),
Edge(C, E), Edge(C, F), Edge(D, H), Edge(D, E), Edge(E, H), Edge(F, G),
Edge edges[] = { Edge(A, B), Edge(A, C), Edge(B, D), Edge(B, E), Edge(C, E),
Edge(C, F), Edge(D, H), Edge(D, E), Edge(E, H), Edge(F, G),
Edge(G, H) };
// Specify the graph type and declare a graph object
typedef edge_list< Edge*, Edge, std::ptrdiff_t,
std::random_access_iterator_tag >
Graph;
Graph g(std::begin(edges), std::end(edges));
Graph g(edges, edges + n_edges);
// The transmission delay values for each edge.
float delay[] = { 5.0, 1.0, 1.3, 3.0, 10.0, 2.0, 6.3, 0.4, 1.3, 1.2, 0.5 };
+8 -8
View File
@@ -57,8 +57,8 @@ int main(int, char*[])
Pair(6, 7) }; // g-h
Graph G(10);
for (auto const& edge : edges)
add_edge(edge.first, edge.second, G);
for (int i = 0; i < 14; ++i)
add_edge(edges[i].first, edges[i].second, G);
graph_traits< Graph >::vertex_iterator ui, ui_end;
@@ -79,8 +79,8 @@ int main(int, char*[])
get(vertex_degree, G));
cout << "Reverse Cuthill-McKee ordering starting at: " << s << endl;
cout << " ";
for (auto const& vertex : inv_perm)
cout << index_map[vertex] << " ";
for (auto i = inv_perm.begin(); i != inv_perm.end(); ++i)
cout << index_map[*i] << " ";
cout << endl;
for (size_type c = 0; c != inv_perm.size(); ++c)
@@ -98,8 +98,8 @@ int main(int, char*[])
get(vertex_degree, G));
cout << "Reverse Cuthill-McKee ordering starting at: " << s << endl;
cout << " ";
for (auto const& vertex : inv_perm)
cout << index_map[vertex] << " ";
for (auto i = inv_perm.begin(); i != inv_perm.end(); ++i)
cout << index_map[*i] << " ";
cout << endl;
for (size_type c = 0; c != inv_perm.size(); ++c)
@@ -118,8 +118,8 @@ int main(int, char*[])
cout << "Reverse Cuthill-McKee ordering:" << endl;
cout << " ";
for (auto const& vertex : inv_perm)
cout << index_map[vertex] << " ";
for (auto i = inv_perm.begin(); i != inv_perm.end(); ++i)
cout << index_map[*i] << " ";
cout << endl;
for (size_type c = 0; c != inv_perm.size(); ++c)
+7 -7
View File
@@ -136,13 +136,13 @@ typename graph_traits< VertexListGraph >::degree_size_type edge_connectivity(
}
std::vector< bool > in_S_star(num_vertices(g), false);
for (auto const& vertex : S_star.begin())
in_S_star[vertex] = true;
for (auto si = S_star.begin(); si != S_star.end(); ++si)
in_S_star[*si] = true;
degree_size_type c = 0;
for (auto const& vertex : S_star.begin())
for (auto si = S_star.begin(); si != S_star.end(); ++si)
{
typename graph_traits< VertexListGraph >::out_edge_iterator ei, ei_end;
for (boost::tie(ei, ei_end) = out_edges(vertex, g); ei != ei_end; ++ei)
for (boost::tie(ei, ei_end) = out_edges(*si, g); ei != ei_end; ++ei)
if (!in_S_star[target(*ei, g)])
{
*disconnecting_set++ = *ei;
@@ -170,9 +170,9 @@ int main()
auto attr_map = get(vertex_attribute, g);
std::cout << "The disconnecting set is {";
for (auto const& edge : disconnecting_set)
std::cout << "(" << attr_map[source(edge, g)]["label"] << ","
<< attr_map[target(edge, g)]["label"] << ") ";
for (auto i = disconnecting_set.begin(); i != disconnecting_set.end(); ++i)
std::cout << "(" << attr_map[source(*i, g)]["label"] << ","
<< attr_map[target(*i, g)]["label"] << ") ";
std::cout << "}." << std::endl;
return EXIT_SUCCESS;
}
+9 -6
View File
@@ -45,15 +45,18 @@ int main()
B,
C,
D,
E
E,
N
};
const char* name = "ABCDE";
typedef std::vector< std::list< int > > Graph;
Graph g = { { B, C }, // A
{}, // B
{ D, E }, // C
{ E }, // D
{ C } }; // E
Graph g(N);
g[A].push_back(B);
g[A].push_back(C);
g[C].push_back(D);
g[C].push_back(E);
g[D].push_back(E);
g[E].push_back(C);
constant_target filter(E);
filtered_graph< Graph, constant_target > fg(g, filter);
+10 -10
View File
@@ -778,13 +778,13 @@ int writeHB_mat_double(const char* filename, int M, int N,
if ( Ptrfmt == NULL ) Ptrfmt = "(8I10)";
ParseIfmt(Ptrfmt,&Ptrperline,&Ptrwidth);
snprintf(pformat, sizeof(pformat), "%%%dd", Ptrwidth);
sprintf(pformat,"%%%dd",Ptrwidth);
ptrcrd = (N+1)/Ptrperline;
if ( (N+1)%Ptrperline != 0) ptrcrd++;
if ( Indfmt == NULL ) Indfmt = Ptrfmt;
ParseIfmt(Indfmt,&Indperline,&Indwidth);
snprintf(iformat, sizeof(iformat), "%%%dd", Indwidth);
sprintf(iformat,"%%%dd",Indwidth);
indcrd = nz/Indperline;
if ( nz%Indperline != 0) indcrd++;
@@ -793,9 +793,9 @@ int writeHB_mat_double(const char* filename, int M, int N,
ParseRfmt(Valfmt,&Valperline,&Valwidth,&Valprec,&Valflag);
if (Valflag == 'D') *strchr(Valfmt,'D') = 'E';
if (Valflag == 'F')
snprintf(vformat, sizeof(vformat), "%% %d.%df", Valwidth, Valprec);
sprintf(vformat,"%% %d.%df",Valwidth,Valprec);
else
snprintf(vformat, sizeof(vformat), "%% %d.%dE", Valwidth, Valprec);
sprintf(vformat,"%% %d.%dE",Valwidth,Valprec);
valcrd = nvalentries/Valperline;
if ( nvalentries%Valperline != 0) valcrd++;
} else valcrd = 0;
@@ -804,9 +804,9 @@ int writeHB_mat_double(const char* filename, int M, int N,
if ( Rhsfmt == NULL ) Rhsfmt = Valfmt;
ParseRfmt(Rhsfmt,&Rhsperline,&Rhswidth,&Rhsprec, &Rhsflag);
if (Rhsflag == 'F')
snprintf(rformat, sizeof(rformat), "%% %d.%df", Rhswidth, Rhsprec);
sprintf(rformat,"%% %d.%df",Rhswidth,Rhsprec);
else
snprintf(rformat, sizeof(rformat), "%% %d.%dE", Rhswidth, Rhsprec);
sprintf(rformat,"%% %d.%dE",Rhswidth,Rhsprec);
if (Rhsflag == 'D') *strchr(Rhsfmt,'D') = 'E';
rhscrd = nrhsentries/Rhsperline;
if ( nrhsentries%Rhsperline != 0) rhscrd++;
@@ -1361,16 +1361,16 @@ int writeHB_mat_char(const char* filename, int M, int N,
if ( Ptrfmt == NULL ) Ptrfmt = "(8I10)";
ParseIfmt(Ptrfmt,&Ptrperline,&Ptrwidth);
snprintf(pformat, sizeof(pformat), "%%%dd", Ptrwidth);
sprintf(pformat,"%%%dd",Ptrwidth);
if ( Indfmt == NULL ) Indfmt = Ptrfmt;
ParseIfmt(Indfmt,&Indperline,&Indwidth);
snprintf(iformat, sizeof(iformat), "%%%dd", Indwidth);
sprintf(iformat,"%%%dd",Indwidth);
if ( Type[0] != 'P' ) { /* Skip if pattern only */
if ( Valfmt == NULL ) Valfmt = "(4E20.13)";
ParseRfmt(Valfmt,&Valperline,&Valwidth,&Valprec,&Valflag);
snprintf(vformat, sizeof(vformat), "%%%ds", Valwidth);
sprintf(vformat,"%%%ds",Valwidth);
}
ptrcrd = (N+1)/Ptrperline;
@@ -1385,7 +1385,7 @@ int writeHB_mat_char(const char* filename, int M, int N,
if ( Nrhs > 0 ) {
if ( Rhsfmt == NULL ) Rhsfmt = Valfmt;
ParseRfmt(Rhsfmt,&Rhsperline,&Rhswidth,&Rhsprec, &Rhsflag);
snprintf(rformat, sizeof(rformat), "%%%ds", Rhswidth);
sprintf(rformat,"%%%ds",Rhswidth);
rhscrd = nrhsentries/Rhsperline;
if ( nrhsentries%Rhsperline != 0) rhscrd++;
if ( Rhstype[1] == 'G' ) rhscrd+=rhscrd;
+4 -4
View File
@@ -98,8 +98,8 @@ int main(int, char*[])
get(vertex_degree, G), get(vertex_index, G));
cout << "King ordering starting at: " << s << endl;
cout << " ";
for (auto const& vertex : inv_perm)
cout << index_map[vertex] << " ";
for (auto i = inv_perm.begin(); i != inv_perm.end(); ++i)
cout << index_map[*i] << " ";
cout << endl;
for (size_type c = 0; c != inv_perm.size(); ++c)
@@ -118,8 +118,8 @@ int main(int, char*[])
cout << "King ordering:" << endl;
cout << " ";
for (auto const& vertex : inv_perm)
cout << index_map[vertex] << " ";
for (auto i = inv_perm.begin(); i != inv_perm.end(); ++i)
cout << index_map[*i] << " ";
cout << endl;
for (size_type c = 0; c != inv_perm.size(); ++c)
+4 -4
View File
@@ -46,14 +46,14 @@ int main()
auto weight = get(edge_weight, g);
int total_weight = 0;
for (auto const& edge : mst)
total_weight += get(weight, edge);
for (size_type e = 0; e < mst.size(); ++e)
total_weight += get(weight, mst[e]);
std::cout << "total weight: " << total_weight << std::endl;
typedef graph_traits< Graph >::vertex_descriptor Vertex;
for (auto const& edge : mst)
for (size_type i = 0; i < mst.size(); ++i)
{
auto u = source(edge, g), v = target(edge, g);
auto u = source(mst[i], g), v = target(mst[i], g);
edge_attr_map[edge(u, v, g_dot).first]["color"] = "black";
}
std::ofstream out("figs/telephone-mst-kruskal.dot");
+11 -10
View File
@@ -25,14 +25,15 @@ int main()
const int n_vertices = 18;
std::vector< std::string > ascii_graph
= { " 0 1---2 3 ",
" \\ / \\ / ",
" 4---5 6---7 ",
" | | | | ",
" 8---9 10---11 ",
" / \\ / \\ ",
" 12 13 14---15 16 17 " };
std::vector< std::string > ascii_graph;
ascii_graph.push_back(" 0 1---2 3 ");
ascii_graph.push_back(" \\ / \\ / ");
ascii_graph.push_back(" 4---5 6---7 ");
ascii_graph.push_back(" | | | | ");
ascii_graph.push_back(" 8---9 10---11 ");
ascii_graph.push_back(" / \\ / \\ ");
ascii_graph.push_back(" 12 13 14---15 16 17 ");
// It has a perfect matching of size 8. There are two isolated
// vertices that we'll use later...
@@ -74,8 +75,8 @@ int main()
std::cout << "In the following graph:" << std::endl << std::endl;
for (auto const& str : ascii_graph)
std::cout << str << std::endl;
for (auto itr = ascii_graph.begin(); itr != ascii_graph.end(); ++itr)
std::cout << *itr << std::endl;
std::cout << std::endl
<< "Found a matching of size " << matching_size(g, &mate[0])
+4 -4
View File
@@ -52,8 +52,8 @@ int main(int, char*[])
const char name[] = "abcdef";
const int num_nodes = 6;
const auto edges = { E(0, 2), E(1, 1), E(1, 3), E(1, 4), E(2, 1), E(2, 3),
E(3, 4), E(4, 0), E(4, 1) };
E edges[] = { E(0, 2), E(1, 1), E(1, 3), E(1, 4), E(2, 1), E(2, 3), E(3, 4),
E(4, 0), E(4, 1) };
int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1 };
const int n_edges = sizeof(edges) / sizeof(E);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
@@ -68,8 +68,8 @@ int main(int, char*[])
weightmap[e] = weights[j];
}
#else
Graph G(std::begin(edges), std::end(edges), weights, num_nodes);
auto = get(edge_weight, G);
Graph G(edges, edges + n_edges, weights, num_nodes);
auto weightmap = get(edge_weight, G);
#endif
std::vector< Vertex > p(num_vertices(G));
+2 -2
View File
@@ -18,7 +18,7 @@ int main()
Graph;
typedef std::pair< int, int > E;
const int num_nodes = 5;
const auto edges
E edges[]
= { E(0, 2), E(1, 3), E(1, 4), E(2, 1), E(2, 3), E(3, 4), E(4, 0) };
int weights[] = { 1, 1, 2, 7, 3, 1, 1 };
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
@@ -32,7 +32,7 @@ int main()
weightmap[e] = weights[j];
}
#else
Graph g(std::begin(edges), std::end(edges), weights, num_nodes);
Graph g(edges, edges + sizeof(edges) / sizeof(E), weights, num_nodes);
#endif
std::vector< graph_traits< Graph >::vertex_descriptor > p(num_vertices(g));
+9 -2
View File
@@ -41,10 +41,17 @@ typedef adjacency_list< vecS, vecS, directedS > Graph;
int main()
{
typedef std::pair< std::size_t, std::size_t > Edge;
const auto edges = { Edge(0, 3), Edge(0, 2), Edge(0, 3), Edge(1, 3),
Edge edges[6] = { Edge(0, 3), Edge(0, 2), Edge(0, 3), Edge(1, 3),
Edge(2, 0), Edge(3, 2) };
Graph g(std::begin(edges), std::end(edges), 4);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
// VC++ can't handle iterator constructor
Graph g(4);
for (std::size_t j = 0; j < 6; ++j)
add_edge(edges[j].first, edges[j].second, g);
#else
Graph g(edges, edges + 6, 4);
#endif
std::cout << "original graph:" << std::endl;
print_graph(g, get(vertex_index, g));
+1 -1
View File
@@ -45,7 +45,7 @@ int main()
// construct the graph object. 8 is the number of vertices, which are
// numbered from 0 through 7, and 16 is the number of edges.
undirected_graph g(std::begin(edges), std::end(edges), ws, 8, 16);
undirected_graph g(edges, edges + 16, ws, 8, 16);
// define a property map, `parities`, that will store a boolean value for
// each vertex. Vertices that have the same parity after
+12 -4
View File
@@ -19,17 +19,25 @@ int main()
= { "pick up kids from school", "buy groceries (and snacks)",
"get cash at ATM", "drop off kids at soccer practice",
"cook dinner", "pick up kids from soccer", "eat dinner" };
const int n_tasks = sizeof(tasks) / sizeof(char*);
std::vector< std::list< int > > g
= { { 3 }, { 3, 4 }, { 1 }, { 5 }, { 6 }, { 6 }, {} };
std::vector< std::list< int > > g(n_tasks);
g[0].push_back(3);
g[1].push_back(3);
g[1].push_back(4);
g[2].push_back(1);
g[3].push_back(5);
g[4].push_back(6);
g[5].push_back(6);
std::deque< int > topo_order;
topological_sort(g, std::front_inserter(topo_order),
vertex_index_map(identity_property_map()));
for (auto const& vertex : topo_order)
std::cout << tasks[vertex] << std::endl;
int n = 1;
for (auto i = topo_order.begin(); i != topo_order.end(); ++i, ++n)
std::cout << tasks[*i] << std::endl;
return EXIT_SUCCESS;
}
+3 -2
View File
@@ -35,8 +35,9 @@ int main()
topological_sort(g, std::front_inserter(topo_order),
vertex_index_map(identity_property_map()));
for (auto const& vertex : topo_order)
std::cout << tasks[vertex] << std::endl;
int n = 1;
for (auto i = topo_order.begin(); i != topo_order.end(); ++i, ++n)
std::cout << tasks[*i] << std::endl;
return EXIT_SUCCESS;
}
+9 -3
View File
@@ -43,10 +43,16 @@ int main(int, char*[])
Graph;
typedef boost::graph_traits< Graph >::vertex_descriptor Vertex;
const auto edges = { Pair(0, 1), Pair(2, 4), Pair(2, 5), Pair(0, 3),
Pair edges[6] = { Pair(0, 1), Pair(2, 4), Pair(2, 5), Pair(0, 3),
Pair(1, 4), Pair(4, 3) };
Graph G(std::begin(edges), std::end(edges), 6 /* vertices count */);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
// VC++ can't handle the iterator constructor
Graph G(6);
for (std::size_t j = 0; j < 6; ++j)
add_edge(edges[j].first, edges[j].second, G);
#else
Graph G(edges, edges + 6, 6);
#endif
auto id = get(vertex_index, G);
+15 -8
View File
@@ -36,15 +36,22 @@ typedef boost::graph_traits< Graph >::edge_iterator edge_iterator;
int main(int argc, char** argv)
{
Graph iG, vG;
vector< edge_descriptor > iG_o = { boost::add_edge(0, 1, iG).first,
boost::add_edge(0, 2, iG).first, boost::add_edge(0, 3, iG).first,
boost::add_edge(0, 4, iG).first, boost::add_edge(1, 2, iG).first,
boost::add_edge(3, 4, iG).first };
vector< edge_descriptor > iG_o;
vector< edge_descriptor > vG_o;
vector< edge_descriptor > vG_o = { boost::add_edge(1, 2, vG).first,
boost::add_edge(2, 0, vG).first, boost::add_edge(2, 3, vG).first,
boost::add_edge(4, 3, vG).first, boost::add_edge(0, 3, vG).first,
boost::add_edge(0, 4, vG).first };
iG_o.push_back(boost::add_edge(0, 1, iG).first);
iG_o.push_back(boost::add_edge(0, 2, iG).first);
iG_o.push_back(boost::add_edge(0, 3, iG).first);
iG_o.push_back(boost::add_edge(0, 4, iG).first);
iG_o.push_back(boost::add_edge(1, 2, iG).first);
iG_o.push_back(boost::add_edge(3, 4, iG).first);
vG_o.push_back(boost::add_edge(1, 2, vG).first);
vG_o.push_back(boost::add_edge(2, 0, vG).first);
vG_o.push_back(boost::add_edge(2, 3, vG).first);
vG_o.push_back(boost::add_edge(4, 3, vG).first);
vG_o.push_back(boost::add_edge(0, 3, vG).first);
vG_o.push_back(boost::add_edge(0, 4, vG).first);
vector< bool > inL(iG_o.size(), false);
+13 -9
View File
@@ -27,18 +27,22 @@ int main()
v,
w,
x,
y
y,
N
};
char name[] = "rstuvwxy";
typedef std::vector< std::list< int > > Graph;
Graph g = { { v }, // r
{ r, r, w }, // s
{ x }, // t
{ t }, // u
{}, // v
{ t, x }, // w
{ y }, // x
{ u } }; // y
Graph g(N);
g[r].push_back(v);
g[s].push_back(r);
g[s].push_back(r);
g[s].push_back(w);
g[t].push_back(x);
g[u].push_back(t);
g[w].push_back(t);
g[w].push_back(x);
g[x].push_back(y);
g[y].push_back(u);
boost::print_graph(g, name);
return 0;
}
+9 -3
View File
@@ -71,9 +71,15 @@ int main(int, char*[])
typedef adjacency_list<> Graph;
typedef std::pair< int, int > E;
const auto edges = { E(0, 2), E(1, 1), E(1, 3), E(2, 1), E(2, 3), E(3, 1),
E(3, 4), E(4, 0), E(4, 1) };
Graph G(std::begin(edges), std::end(edges), 5);
E edges[] = { E(0, 2), E(1, 1), E(1, 3), E(2, 1), E(2, 3), E(3, 1), E(3, 4),
E(4, 0), E(4, 1) };
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
Graph G(5);
for (std::size_t j = 0; j < sizeof(edges) / sizeof(E); ++j)
add_edge(edges[j].first, edges[j].second, G);
#else
Graph G(edges, edges + sizeof(edges) / sizeof(E), 5);
#endif
typedef boost::graph_traits< Graph >::vertices_size_type size_type;
+1 -23
View File
@@ -433,8 +433,7 @@ struct adj_matrix_traversal_tag : public virtual adjacency_matrix_tag,
public virtual vertex_list_graph_tag,
public virtual incidence_graph_tag,
public virtual adjacency_graph_tag,
public virtual edge_list_graph_tag,
public virtual bidirectional_graph_tag
public virtual edge_list_graph_tag
{
};
@@ -827,27 +826,6 @@ typename adjacency_matrix< D, VP, EP, GP, A >::degree_size_type in_degree(
return n;
}
// O(N)
template < typename VP, typename EP, typename GP, typename A >
typename adjacency_matrix< directedS, VP, EP, GP, A >::degree_size_type
degree(
typename adjacency_matrix< directedS, VP, EP, GP, A >::vertex_descriptor u,
const adjacency_matrix< directedS, VP, EP, GP, A >& g)
{
return in_degree(u, g) + out_degree(u, g);
}
// O(N)
template < typename VP, typename EP, typename GP, typename A >
typename adjacency_matrix< undirectedS, VP, EP, GP, A >::degree_size_type
degree(
typename adjacency_matrix< undirectedS, VP, EP, GP, A >::vertex_descriptor
u,
const adjacency_matrix< undirectedS, VP, EP, GP, A >& g)
{
return out_degree(u, g);
}
//=========================================================================
// Functions required by the AdjacencyGraph concept
+21 -40
View File
@@ -62,21 +62,6 @@ namespace detail
Tag >(timeMap, v, t);
}
// Auxiliary structure of different kinds of predecessors are used to
// calculate the semidominators: ancestor, semidominator, and the ancestor
// with the lowest semidominator (`best`). Placing these predecessors in a
// structure let us organize a "vector of structs" what improves cache
// efficiency.
template < class Graph >
struct vertex_triple
{
using Vertex = typename graph_traits< Graph >::vertex_descriptor;
Vertex semi { graph_traits< Graph >::null_vertex() };
Vertex ancestor { graph_traits< Graph >::null_vertex() };
Vertex best { graph_traits< Graph >::null_vertex() };
};
template < class Graph, class IndexMap, class TimeMap, class PredMap,
class DomTreePredMap >
class dominator_visitor
@@ -95,9 +80,13 @@ namespace detail
*/
dominator_visitor(const Graph& g, const Vertex& entry,
const IndexMap& indexMap, DomTreePredMap domTreePredMap)
: pred_(num_vertices(g))
, predMap_(make_iterator_property_map(pred_.begin(), indexMap))
, samedom_(num_vertices(g), graph_traits< Graph >::null_vertex())
: semi_(num_vertices(g))
, ancestor_(num_vertices(g), graph_traits< Graph >::null_vertex())
, samedom_(ancestor_)
, best_(semi_)
, semiMap_(make_iterator_property_map(semi_.begin(), indexMap))
, ancestorMap_(make_iterator_property_map(ancestor_.begin(), indexMap))
, bestMap_(make_iterator_property_map(best_.begin(), indexMap))
, buckets_(num_vertices(g))
, bucketMap_(make_iterator_property_map(buckets_.begin(), indexMap))
, entry_(entry)
@@ -143,18 +132,18 @@ namespace detail
if (get(dfnumMap, v) <= get(dfnumMap, n))
s2 = v;
else
s2 = get(predMap_, ancestor_with_lowest_semi_(v, dfnumMap))
.semi;
s2 = get(semiMap_, ancestor_with_lowest_semi_(v, dfnumMap));
if (get(dfnumMap, s2) < get(dfnumMap, s))
s = s2;
}
auto& pred_of_n = get(predMap_, n);
pred_of_n = {s, p, n};
put(semiMap_, n, s);
// 2. Calculation of n's dominator is deferred until
// the path from s to n has been linked into the forest
get(bucketMap_, s).push_back(n);
get(ancestorMap_, n) = p;
get(bestMap_, n) = n;
// 3. Now that the path from p to v has been linked into
// the spanning forest, these lines calculate the dominator of v,
@@ -172,7 +161,7 @@ namespace detail
{
const Vertex v(*buckItr);
const Vertex y(ancestor_with_lowest_semi_(v, dfnumMap));
if (get(predMap_, y).semi == get(predMap_, v).semi)
if (get(semiMap_, y) == get(semiMap_, v))
put(domTreePredMap_, v, p);
else
put(samedomMap, v, y);
@@ -188,32 +177,24 @@ namespace detail
const Vertex ancestor_with_lowest_semi_(
const Vertex& v, const TimeMap& dfnumMap)
{
const Vertex a(get(predMap_, v).ancestor);
const auto& pred_of_a = get(predMap_, a);
const Vertex a(get(ancestorMap_, v));
auto& pred_of_v = get(predMap_, v);
if (pred_of_a.ancestor != graph_traits< Graph >::null_vertex())
if (get(ancestorMap_, a) != graph_traits< Graph >::null_vertex())
{
const Vertex b(ancestor_with_lowest_semi_(a, dfnumMap));
const auto& pred_of_b = get(predMap_, b);
pred_of_v.ancestor = pred_of_a.ancestor;
put(ancestorMap_, v, get(ancestorMap_, a));
if (get(dfnumMap, pred_of_b.semi)
< get(dfnumMap, get(predMap_, pred_of_v.best).semi))
pred_of_v.best = b;
if (get(dfnumMap, get(semiMap_, b))
< get(dfnumMap, get(semiMap_, get(bestMap_, v))))
put(bestMap_, v, b);
}
return pred_of_v.best;
return get(bestMap_, v);
}
std::vector< vertex_triple< Graph > > pred_;
iterator_property_map< typename std::vector< vertex_triple< Graph > >::iterator,
IndexMap >
predMap_;
std::vector< Vertex > samedom_;
std::vector< Vertex > semi_, ancestor_, samedom_, best_;
PredMap semiMap_, ancestorMap_, bestMap_;
std::vector< std::vector< Vertex > > buckets_;
iterator_property_map<
+12 -8
View File
@@ -13,6 +13,7 @@
#include <functional>
#include <limits>
#include <boost/bind/bind.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
@@ -240,10 +241,14 @@ namespace detail
typename graph_traits< Graph >::out_edge_iterator oei, oeie;
for (boost::tie(vi, vie) = vertices(m_g); vi != vie; ++vi)
{
using namespace boost::placeholders;
boost::tie(oei, oeie) = out_edges(*vi, m_g);
auto mei = boost::first_max_element(oei, oeie,
[this](const auto& first, const auto& second)
{ return m_cmp(m_ew1m[first], m_ew1m[second]); });
typename graph_traits< Graph >::out_edge_iterator mei
= boost::first_max_element(oei, oeie,
boost::bind(m_cmp,
boost::bind(&EdgeWeight1::operator[], m_ew1m, _1),
boost::bind(&EdgeWeight1::operator[], m_ew1m, _2)));
if (mei == oeie)
{
if (m_sink == graph_traits< Graph >().null_vertex())
@@ -351,17 +356,16 @@ namespace detail
*/
float_t policy_mcr()
{
using namespace boost::placeholders;
std::fill(m_col_bfs.begin(), m_col_bfs.end(), my_white);
color_map_t vcm_ = color_map_t(m_col_bfs.begin(), m_vim);
typename graph_traits< Graph >::vertex_iterator uv_itr, vie;
boost::tie(uv_itr, vie) = vertices(m_g);
float_t mcr = m_bound;
while ((uv_itr = std::find_if(uv_itr, vie,
[this, &vcm_](const auto& uv)
{
return std::equal_to< my_color_type >()(
my_white, vcm_[uv]);
}))
boost::bind(std::equal_to< my_color_type >(), my_white,
boost::bind(&color_map_t::operator[], vcm_, _1))))
!= vie)
/// While there are undiscovered vertices
{
+1 -1
View File
@@ -91,7 +91,7 @@ namespace detail
assert(x_multiplicity_iter != multiplicity->end());
auto y_multiplicity_iter = multiplicity->find(invariant1(y));
assert(y_multiplicity_iter != multiplicity->end());
return x_multiplicity_iter->second < y_multiplicity_iter->second;
return *x_multiplicity_iter < *y_multiplicity_iter;
}
Invariant1 invariant1;
const InvariantCountMap* multiplicity;
+4 -1
View File
@@ -15,6 +15,7 @@
#include <vector>
#include <algorithm>
#include <boost/config.hpp>
#include <boost/bind/bind.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/graph/detail/sparse_ordering.hpp>
#include <boost/graph/graph_utility.hpp>
@@ -48,6 +49,8 @@ namespace detail
template < typename Vertex, typename Graph >
void finish_vertex(Vertex, Graph& g)
{
using namespace boost::placeholders;
typename graph_traits< Graph >::out_edge_iterator ei, ei_end;
Vertex v, w;
@@ -58,7 +61,7 @@ namespace detail
reverse_iterator rbegin = Qptr->rbegin();
// heap the vertices already there
std::make_heap(rbegin, rend, [this](const auto& first, const auto& second) { return comp(second, first); });
std::make_heap(rbegin, rend, boost::bind< bool >(comp, _2, _1));
unsigned i = 0;
+7 -6
View File
@@ -11,8 +11,9 @@
#include <vector>
#include <algorithm> // for std::min and std::max
#include <functional> //for std::less
#include <functional>
#include <boost/config.hpp>
#include <boost/bind/bind.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/topological_sort.hpp>
#include <boost/graph/graph_concepts.hpp>
@@ -129,16 +130,16 @@ void transitive_closure(const Graph& g, GraphTC& tc,
std::vector< std::vector< cg_vertex > > CG_vec(num_vertices(CG));
for (size_type i = 0; i < num_vertices(CG); ++i)
{
using namespace boost::placeholders;
typedef typename boost::graph_traits< CG_t >::adjacency_iterator
cg_adj_iter;
std::pair< cg_adj_iter, cg_adj_iter > pr = adjacent_vertices(i, CG);
CG_vec[i].assign(pr.first, pr.second);
std::sort(CG_vec[i].begin(), CG_vec[i].end(),
[&topo_number](const auto& cg_0, const auto& cg_1)
{
return std::less< cg_vertex >()(
topo_number[cg_0], topo_number[cg_1]);
});
boost::bind(std::less< cg_vertex >(),
boost::bind(detail::subscript(topo_number), _1),
boost::bind(detail::subscript(topo_number), _2)));
}
std::vector< std::vector< cg_vertex > > chains;
+12 -19
View File
@@ -7,12 +7,9 @@
# Define SGB (stanford graph base top level directory) and
# LEDA (also top level directory) at the command line of jam using -s
require-b2 5.0.1 ;
import-search /boost/config/checks ;
import modules ;
import path ;
import config : requires ;
import ../../config/checks/config : requires ;
path-constant TEST_DIR : . ;
@@ -22,10 +19,6 @@ path-constant CYCLE_RATIO_INPUT_FILE : ./cycle_ratio_s382.90.dot ;
path-constant METIS_INPUT_FILE : ./weighted_graph.gr ;
path-constant WEIGHTED_MATCHING_INPUT_FILE : ./weighted_matching.dat ;
project : requirements <library>/boost/graph//boost_graph ;
alias graph_test_regular :
# test_graphs will eventually defined a framework for testing the structure
# and implementation of graph data structures and adaptors.
@@ -80,13 +73,13 @@ alias graph_test_regular :
[ run graph.cpp : : : <define>TEST=9 : graph_9 ]
[ compile graph_concepts.cpp ]
[ run graphviz_test.cpp
/boost/graph//boost_graph : --log_level=all ]
../build//boost_graph : --log_level=all ]
[ run metis_test.cpp : $(METIS_INPUT_FILE) ]
[ run gursoy_atun_layout_test.cpp : : : [ requires cxx11_noexcept cxx11_rvalue_references sfinae_expr cxx11_auto_declarations cxx11_lambdas cxx11_unified_initialization_syntax cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_hdr_chrono cxx11_thread_local cxx11_constexpr cxx11_nullptr cxx11_numeric_limits cxx11_decltype cxx11_hdr_array cxx11_hdr_atomic cxx11_hdr_type_traits cxx11_allocator cxx11_explicit_conversion_operators ] ]
[ run layout_test.cpp : : : <test-info>always_show_run_output <toolset>intel:<debug-symbols>off [ requires cxx11_noexcept cxx11_rvalue_references sfinae_expr cxx11_auto_declarations cxx11_lambdas cxx11_unified_initialization_syntax cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_hdr_chrono cxx11_thread_local cxx11_constexpr cxx11_nullptr cxx11_numeric_limits cxx11_decltype cxx11_hdr_array cxx11_hdr_atomic cxx11_hdr_type_traits cxx11_allocator cxx11_explicit_conversion_operators ] ]
[ run serialize.cpp
/boost/serialization//boost_serialization
../../serialization/build//boost_serialization
: : : ]
[ compile reverse_graph_cc.cpp ]
@@ -120,11 +113,11 @@ alias graph_test_regular :
[ run cuthill_mckee_ordering.cpp ]
[ run king_ordering.cpp ]
[ run matching_test.cpp ]
[ run weighted_matching_test.cpp : $(WEIGHTED_MATCHING_INPUT_FILE) ]
[ run weighted_matching_test.cpp ]
[ run weighted_matching_test2.cpp ]
[ run max_flow_test.cpp ]
[ run boykov_kolmogorov_max_flow_test.cpp ]
[ run cycle_ratio_tests.cpp /boost/graph//boost_graph : $(CYCLE_RATIO_INPUT_FILE) ]
[ run cycle_ratio_tests.cpp ../build//boost_graph : $(CYCLE_RATIO_INPUT_FILE) ]
[ run basic_planarity_test.cpp ]
[ run make_connected_test.cpp ]
[ run make_bicon_planar_test.cpp ]
@@ -145,14 +138,14 @@ alias graph_test_regular :
[ run clustering_coefficient.cpp ]
[ run core_numbers_test.cpp ]
[ run read_propmap.cpp ]
[ run mcgregor_subgraphs_test.cpp /boost/graph//boost_graph ]
[ run mcgregor_subgraphs_test.cpp ../build//boost_graph ]
[ compile grid_graph_cc.cpp ]
[ run grid_graph_test.cpp ]
[ run incremental_components_test.cpp ]
[ run two_graphs_common_spanning_trees_test.cpp ]
[ run random_spanning_tree_test.cpp /boost/graph//boost_graph ]
[ run random_spanning_tree_test.cpp ../build//boost_graph ]
[ run random_matching_test.cpp : 1000 1020 ]
[ run graphml_test.cpp /boost/graph//boost_graph : : "graphml_test.xml" ]
[ run graphml_test.cpp ../build//boost_graph : : "graphml_test.xml" ]
[ run mas_test.cpp : $(TEST_DIR) ]
[ run stoer_wagner_test.cpp : $(TEST_DIR) ]
[ compile filtered_graph_properties_dijkstra.cpp ]
@@ -178,12 +171,12 @@ alias graph_test_with_filesystem : :
alias graph_test_with_filesystem :
[ run all_planar_input_files_test.cpp
/boost/filesystem//boost_filesystem
/boost/system//boost_system
../../filesystem/build
../../system/build
: $(PLANAR_INPUT_FILES) ]
[ run parallel_edges_loops_test.cpp
/boost/filesystem//boost_filesystem
/boost/system//boost_system
../../filesystem/build
../../system/build
: $(PLANAR_INPUT_FILES) ]
;
-4
View File
@@ -21,7 +21,6 @@ int main(int, char*[])
BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((AdjacencyGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((MutableGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((AdjacencyMatrixConcept< Graph >));
}
@@ -31,7 +30,6 @@ int main(int, char*[])
BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((AdjacencyGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((MutableGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((AdjacencyMatrixConcept< Graph >));
}
@@ -46,7 +44,6 @@ int main(int, char*[])
BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((AdjacencyGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((AdjacencyMatrixConcept< Graph >));
BOOST_CONCEPT_ASSERT((VertexMutablePropertyGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((EdgeMutablePropertyGraphConcept< Graph >));
@@ -67,7 +64,6 @@ int main(int, char*[])
BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((AdjacencyGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((AdjacencyMatrixConcept< Graph >));
BOOST_CONCEPT_ASSERT((VertexMutablePropertyGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((EdgeMutablePropertyGraphConcept< Graph >));
+21 -74
View File
@@ -9,7 +9,6 @@
#include <iostream>
#include <algorithm>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/adjacency_matrix.hpp>
#include <boost/graph/dominator_tree.hpp>
using namespace std;
@@ -25,51 +24,13 @@ struct DominatorCorrectnessTestSet
using namespace boost;
// a workaround for the C++ standard before C++17, after switching to C++17,
// the method may be just inlined into the run_test() with constexpr if.
namespace detail
{
typedef adjacency_list< listS, listS, bidirectionalS,
property< vertex_index_t, std::size_t >, no_property >
G;
template < typename Graph >
void index_graph(Graph&, std::true_type /*IsRandomAccessAdjacentList*/)
int main(int, char*[])
{
// nothing to do for already indexed adjacent list
}
template < typename Graph >
void index_graph(Graph& g, std::false_type /*IsRandomAccessAdjacentList*/)
{
using IndexMap = typename property_map< Graph, vertex_index_t >::type;
IndexMap indexMap(get(vertex_index, g));
typename graph_traits< Graph >::vertex_iterator uItr, uEnd;
int j = 0;
for (boost::tie(uItr, uEnd) = vertices(g); uItr != uEnd; ++uItr, ++j)
{
put(indexMap, *uItr, j);
}
}
} // namespace detail
template < typename OEL, typename VL, typename D, typename VP, typename EP,
typename GP, typename EL >
void index_graph(adjacency_list< OEL, VL, D, VP, EP, GP, EL >& g)
{
using Traits = adjacency_list_traits< OEL, VL, D, EL >;
::detail::index_graph(
g, std::integral_constant< bool, Traits::is_rand_access::value > {});
}
template < typename D, typename VP, typename EP, typename GP, typename A >
void index_graph(adjacency_matrix<D, VP, EP, GP, A>&)
{
// nothing to do for already indexed adjacent matrix
}
template < typename Graph >
void run_test()
{
using edge = DominatorCorrectnessTestSet::edge;
typedef DominatorCorrectnessTestSet::edge edge;
DominatorCorrectnessTestSet testSet[7];
@@ -256,32 +217,34 @@ void run_test()
{
const int numOfVertices = testSet[i].numOfVertices;
Graph g(testSet[i].edges.begin(), testSet[i].edges.end(), numOfVertices);
G g(testSet[i].edges.begin(), testSet[i].edges.end(), numOfVertices);
using Vertex = typename graph_traits< Graph >::vertex_descriptor;
using IndexMap = typename property_map< Graph, vertex_index_t >::type;
IndexMap indexMap(get(vertex_index, g));
using PredMap
= iterator_property_map< typename vector< Vertex >::iterator, IndexMap >;
index_graph(g);
typedef graph_traits< G >::vertex_descriptor Vertex;
typedef property_map< G, vertex_index_t >::type IndexMap;
typedef iterator_property_map< vector< Vertex >::iterator, IndexMap >
PredMap;
vector< Vertex > domTreePredVector, domTreePredVector2;
IndexMap indexMap(get(vertex_index, g));
graph_traits< G >::vertex_iterator uItr, uEnd;
int j = 0;
for (boost::tie(uItr, uEnd) = vertices(g); uItr != uEnd; ++uItr, ++j)
{
put(indexMap, *uItr, j);
}
// Lengauer-Tarjan dominator tree algorithm
domTreePredVector = vector< Vertex >(
num_vertices(g), graph_traits< Graph >::null_vertex());
num_vertices(g), graph_traits< G >::null_vertex());
PredMap domTreePredMap
= make_iterator_property_map(domTreePredVector.begin(), indexMap);
lengauer_tarjan_dominator_tree(g, vertex(0, g), domTreePredMap);
vector< int > idom(num_vertices(g));
typename graph_traits< Graph >::vertex_iterator uItr, uEnd;
for (boost::tie(uItr, uEnd) = vertices(g); uItr != uEnd; ++uItr)
{
if (get(domTreePredMap, *uItr)
!= graph_traits< Graph >::null_vertex())
if (get(domTreePredMap, *uItr) != graph_traits< G >::null_vertex())
idom[get(indexMap, *uItr)]
= get(indexMap, get(domTreePredMap, *uItr));
else
@@ -297,7 +260,7 @@ void run_test()
// compare results of fast version and slow version of dominator tree
domTreePredVector2 = vector< Vertex >(
num_vertices(g), graph_traits< Graph >::null_vertex());
num_vertices(g), graph_traits< G >::null_vertex());
domTreePredMap
= make_iterator_property_map(domTreePredVector2.begin(), indexMap);
@@ -306,8 +269,7 @@ void run_test()
vector< int > idom2(num_vertices(g));
for (boost::tie(uItr, uEnd) = vertices(g); uItr != uEnd; ++uItr)
{
if (get(domTreePredMap, *uItr)
!= graph_traits< Graph >::null_vertex())
if (get(domTreePredMap, *uItr) != graph_traits< G >::null_vertex())
idom2[get(indexMap, *uItr)]
= get(indexMap, get(domTreePredMap, *uItr));
else
@@ -321,21 +283,6 @@ void run_test()
for (k = 0; k < num_vertices(g); ++k)
BOOST_TEST(domTreePredVector[k] == domTreePredVector2[k]);
}
cout << endl;
}
int main(int, char*[])
{
using AdjacencyListList = adjacency_list< listS, listS, bidirectionalS,
property< vertex_index_t, std::size_t >, no_property >;
using AdjacencyListVec = adjacency_list< listS, vecS, bidirectionalS >;
using AdjacencyMatrix = adjacency_matrix< directedS >;
run_test< AdjacencyListList >();
run_test< AdjacencyListVec >();
run_test< AdjacencyMatrix >();
return boost::report_errors();
}
-175
View File
@@ -1,175 +0,0 @@
digraph G {
0;
1;
2;
3;
4;
5;
6;
7;
8;
9;
10;
11;
12;
13;
14;
15;
16;
17;
18;
19;
20;
21;
22;
23;
24;
25;
26;
27;
28;
29;
30;
31;
32;
33;
34;
35;
36;
37;
38;
39;
40;
41;
42;
43;
44;
45;
46;
47;
48;
49;
50;
51;
52;
53;
54;
55;
56;
57;
58;
59;
60;
61;
62;
63;
64;
65;
66;
67;
68;
69;
70;
71;
72;
73;
74;
6->23 ;
0->23 ;
6->24 ;
0->24 ;
6->25 ;
1->25 ;
6->26 ;
1->26 ;
6->27 ;
2->27 ;
6->28 ;
2->28 ;
6->29 ;
3->29 ;
6->30 ;
3->30 ;
6->31 ;
4->31 ;
6->32 ;
4->32 ;
6->33 ;
5->33 ;
6->34 ;
5->34 ;
6->35 ;
0->35 ;
7->36 ;
1->36 ;
8->37 ;
3->37 ;
9->38 ;
3->38 ;
10->39 ;
3->39 ;
11->40 ;
3->40 ;
12->41 ;
3->41 ;
13->42 ;
3->42 ;
17->43 ;
3->43 ;
14->44 ;
3->44 ;
15->45 ;
3->45 ;
16->46 ;
3->46 ;
18->47 ;
3->47 ;
19->48 ;
3->48 ;
20->49 ;
3->49 ;
21->50 ;
3->50 ;
22->51 ;
3->51 ;
35->52 ;
69->52 ;
36->53 ;
70->53 ;
37->54 ;
72->54 ;
38->55 ;
72->55 ;
39->56 ;
72->56 ;
40->57 ;
72->57 ;
41->58 ;
72->58 ;
42->59 ;
72->59 ;
43->60 ;
72->60 ;
44->61 ;
72->61 ;
45->62 ;
72->62 ;
46->63 ;
72->63 ;
47->64 ;
72->64 ;
48->65 ;
72->65 ;
49->66 ;
72->66 ;
50->67 ;
72->67 ;
51->68 ;
72->68 ;
24->69 ;
26->70 ;
28->71 ;
30->72 ;
32->73 ;
34->74 ;
}
-175
View File
@@ -1,175 +0,0 @@
digraph G {
0;
1;
2;
3;
4;
5;
6;
7;
8;
9;
10;
11;
12;
13;
14;
15;
16;
17;
18;
19;
20;
21;
22;
23;
24;
25;
26;
27;
28;
29;
30;
31;
32;
33;
34;
35;
36;
37;
38;
39;
40;
41;
42;
43;
44;
45;
46;
47;
48;
49;
50;
51;
52;
53;
54;
55;
56;
57;
58;
59;
60;
61;
62;
63;
64;
65;
66;
67;
68;
69;
70;
71;
72;
73;
74;
6->23 ;
0->23 ;
6->24 ;
0->24 ;
6->25 ;
1->25 ;
6->26 ;
1->26 ;
6->27 ;
2->27 ;
6->28 ;
2->28 ;
6->29 ;
3->29 ;
6->30 ;
3->30 ;
6->31 ;
4->31 ;
6->32 ;
4->32 ;
6->33 ;
5->33 ;
6->34 ;
5->34 ;
6->35 ;
0->35 ;
7->36 ;
1->36 ;
10->37 ;
3->37 ;
11->38 ;
3->38 ;
12->39 ;
3->39 ;
13->40 ;
3->40 ;
17->41 ;
3->41 ;
14->42 ;
3->42 ;
15->43 ;
3->43 ;
16->44 ;
3->44 ;
18->45 ;
3->45 ;
19->46 ;
3->46 ;
20->47 ;
3->47 ;
21->48 ;
3->48 ;
22->49 ;
3->49 ;
8->50 ;
3->50 ;
9->51 ;
3->51 ;
35->52 ;
69->52 ;
36->53 ;
70->53 ;
37->54 ;
72->54 ;
38->55 ;
72->55 ;
39->56 ;
72->56 ;
40->57 ;
72->57 ;
41->58 ;
72->58 ;
42->59 ;
72->59 ;
43->60 ;
72->60 ;
44->61 ;
72->61 ;
45->62 ;
72->62 ;
46->63 ;
72->63 ;
47->64 ;
72->64 ;
48->65 ;
72->65 ;
49->66 ;
72->66 ;
50->67 ;
72->67 ;
51->68 ;
72->68 ;
24->69 ;
26->70 ;
28->71 ;
30->72 ;
32->73 ;
34->74 ;
}
+4 -1
View File
@@ -70,8 +70,11 @@ bool check_vertex_cleared(Graph& g, Vertex v, ID id)
found = ai;
break;
}
#elif defined(BOOST_NO_CXX98_BINDERS)
found
= std::find_if(ai, aiend, std::bind(cmp, v, std::placeholders::_1));
#else
found = std::find_if(ai, aiend, [&v, &cmp](const auto& el) { return cmp(v, el); });
found = std::find_if(ai, aiend, std::bind1st(cmp, v));
#endif
if (found != aiend)
-43
View File
@@ -31,10 +31,6 @@
#include <boost/random/mersenne_twister.hpp>
#include <boost/lexical_cast.hpp>
#define BOOST_GRAPH_USE_SPIRIT_PARSER
#include <boost/property_map/dynamic_property_map.hpp>
#include <boost/graph/graphviz.hpp>
#ifndef BOOST_NO_CXX11_HDR_RANDOM
#include <random>
typedef std::mt19937 random_generator_type;
@@ -408,51 +404,12 @@ void test_colored_isomorphism(int n, double edge_probability)
}
}
struct VertexProps
{
std::string node_id; // will store "0", "1", ..., "74"
};
using Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, VertexProps>;
void loadGraphFromDOT(const std::string& filename, Graph& g)
{
std::ifstream in(filename);
if (!in)
{
throw std::runtime_error("Error: Cannot open file ");
}
auto node_id_map = boost::get(&VertexProps::node_id, g);
boost::dynamic_properties dp;
dp.property("node_id", node_id_map);
if (!boost::read_graphviz(in, g, dp))
{
throw std::runtime_error("Error: Failed to read DOT ");
}
}
void test_github_issue_428()
{
using Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, VertexProps>;
Graph g0;
Graph g1;
loadGraphFromDOT("github-428-0.dot", g0);
loadGraphFromDOT("github-428-1.dot", g1);
const bool iso = boost::isomorphism(g0, g1);
BOOST_TEST(iso);
}
int main(int argc, char* argv[])
{
int n = argc < 3 ? 30 : boost::lexical_cast< int >(argv[1]);
double edge_prob = argc < 3 ? 0.45 : boost::lexical_cast< double >(argv[2]);
test_isomorphism(n, edge_prob);
test_colored_isomorphism(n, edge_prob);
test_github_issue_428();
return boost::report_errors();
}
-22
View File
@@ -9,7 +9,6 @@
#include <boost/graph/graph_concepts.hpp>
#include <boost/graph/graph_archetypes.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/adjacency_matrix.hpp>
#include <boost/graph/reverse_graph.hpp>
#include <boost/concept/assert.hpp>
#include <string>
@@ -60,26 +59,5 @@ int main(int, char*[])
get_property(gr, graph_name_t());
set_property(gr, graph_name_t(), "foo");
}
// Check matrix
{
typedef adjacency_matrix< directedS,
property< vertex_color_t, int >, property< edge_weight_t, int >,
property< graph_name_t, std::string > >
AdjMatrix;
typedef reverse_graph< AdjMatrix > Graph;
BOOST_CONCEPT_ASSERT((VertexListGraphConcept< Graph >));
BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< Graph >));
typedef graph_traits< Graph >::vertex_descriptor Vertex;
typedef graph_traits< Graph >::edge_descriptor Edge;
BOOST_CONCEPT_ASSERT(
(ReadablePropertyGraphConcept< Graph, Vertex, vertex_color_t >));
BOOST_CONCEPT_ASSERT(
(ReadablePropertyGraphConcept< Graph, Edge, edge_weight_t >));
BOOST_CONCEPT_ASSERT(
(ReadablePropertyGraphConcept< Graph, Edge, edge_underlying_t >));
AdjMatrix g(42);
Graph gr(g);
get_property(gr, graph_name_t());
}
return 0;
}
-4
View File
@@ -132,8 +132,6 @@ int main()
Graph;
BOOST_META_ASSERT(is_directed_graph< Graph >);
BOOST_META_ASSERT(!is_multigraph< Graph >);
BOOST_META_ASSERT(is_bidirectional_graph< Graph >);
BOOST_META_ASSERT(is_directed_bidirectional_graph< Graph >);
BOOST_META_ASSERT(has_vertex_property< Graph >);
BOOST_META_ASSERT(has_bundled_vertex_property< Graph >);
BOOST_META_ASSERT(has_edge_property< Graph >);
@@ -147,8 +145,6 @@ int main()
typedef adjacency_matrix< directedS, VertexBundle, EdgeBundle > Graph;
BOOST_META_ASSERT(is_directed_graph< Graph >);
BOOST_META_ASSERT(!is_multigraph< Graph >);
BOOST_META_ASSERT(is_bidirectional_graph< Graph >);
BOOST_META_ASSERT(is_directed_bidirectional_graph< Graph >);
BOOST_META_ASSERT(has_vertex_property< Graph >);
BOOST_META_ASSERT(has_bundled_vertex_property< Graph >);
BOOST_META_ASSERT(has_edge_property< Graph >);
+2 -5
View File
@@ -136,12 +136,9 @@ Graph make_graph(typename graph_traits< Graph >::vertices_size_type num_v,
return g;
}
int main(int argc, char* argv[])
int main(int, char*[])
{
const char* filename = "weighted_matching.dat";
if (argc > 1)
filename = argv[1];
std::ifstream in_file(filename);
std::ifstream in_file("weighted_matching.dat");
BOOST_TEST(in_file.good());
std::string line;
while (std::getline(in_file, line))