mirror of
https://github.com/boostorg/graph.git
synced 2026-07-21 13:23:42 +00:00
Compare commits
66 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a477d6d787 | |||
| 5464928d0f | |||
| d4e2ba1802 | |||
| 6c78c84156 | |||
| a94c7056e2 | |||
| 2eb59d35a7 | |||
| 4b521fe624 | |||
| 46559d7a6e | |||
| d10b83cedd | |||
| 1cfeb9ad6b | |||
| 6df9717c84 | |||
| 7e1863ae10 | |||
| 3784692731 | |||
| 4697f3fb19 | |||
| 4aec705625 | |||
| acc19514d7 | |||
| f2f55c2062 | |||
| 4951181a2e | |||
| 7b7ab3f917 | |||
| 7b9640389c | |||
| f434208542 | |||
| 34f3587678 | |||
| e9a12bb577 | |||
| 823e17fb44 | |||
| be7434e584 | |||
| 258f47a3b1 | |||
| cbae97953a | |||
| 9bed95c45c | |||
| d93f67d804 | |||
| 6ebdc2c8fd | |||
| 4792e04be7 | |||
| 7b04334601 | |||
| 57058f091a | |||
| e936b09340 | |||
| 38b4f317a8 | |||
| 561e377199 | |||
| e121340571 | |||
| 3de9380d48 | |||
| 8119d0e169 | |||
| 9237081239 | |||
| 50d26818e0 | |||
| 8f05ca23fa | |||
| 8a2d0439e4 | |||
| d5531e24dc | |||
| 2d182cff02 | |||
| 4aadc91f5c | |||
| 5dbdc5546a | |||
| 4d701e74f2 | |||
| b0be1f7087 | |||
| dabe257fda | |||
| ab1d87b956 | |||
| f76084c5b8 | |||
| df399ee1ed | |||
| a9516ad819 | |||
| 82a4c4e9ca | |||
| a40316edea | |||
| 325f5b7921 | |||
| 6b09e7b7e3 | |||
| 41e8999121 | |||
| a5b6c4aeec | |||
| 4857f12f7a | |||
| 3f2414abd2 | |||
| e0d11417c5 | |||
| fe90a5b067 | |||
| e2547c2137 | |||
| 3d5eba2410 |
@@ -5,6 +5,7 @@ AlignEscapedNewlinesLeft: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
BreakBeforeBraces: Allman
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakTemplateDeclarations: Yes
|
||||
ColumnLimit: 80
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 0
|
||||
|
||||
-15
@@ -14,12 +14,6 @@ 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),
|
||||
|
||||
@@ -33,23 +27,15 @@ 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),
|
||||
@@ -57,7 +43,6 @@ 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
|
||||
|
||||
+19
-64
@@ -7,16 +7,15 @@
|
||||
name: CI
|
||||
on: [ push, pull_request ]
|
||||
jobs:
|
||||
ubuntu-focal:
|
||||
runs-on: ubuntu-20.04
|
||||
ubuntu:
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# 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 ]
|
||||
compiler: [ gcc-14, clang-19 ]
|
||||
cxxstd: [ 14, 17, 20, 23 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@master
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
@@ -24,12 +23,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 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: 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: Install packages
|
||||
run: sudo apt install g++-9 clang-10
|
||||
run: sudo apt install ${{ matrix.compiler }}
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
@@ -48,13 +47,13 @@ jobs:
|
||||
run: ./b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Generate user config
|
||||
run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} ;" > ~/user-config.jam'
|
||||
run: 'echo "using $TOOLSET : : $CXX ;" > ~/user-config.jam'
|
||||
working-directory: ../boost-root
|
||||
- name: Config info
|
||||
run: ../../../b2 print_config_info toolset=$TOOLSET cxxstd=14,17,2a
|
||||
run: ../../../b2 print_config_info toolset=$TOOLSET cxxstd=${{ matrix.cxxstd }}
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ../../../b2 toolset=$TOOLSET cxxstd=14,17,2a
|
||||
run: ../../../b2 toolset=$TOOLSET cxxstd=${{ matrix.cxxstd }}
|
||||
working-directory: ../boost-root/libs/graph/test
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
@@ -62,8 +61,9 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
toolset: [ clang ]
|
||||
cxxstd: [ 14, 17, 20 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@master
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
@@ -89,51 +89,10 @@ jobs:
|
||||
run: ./b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Config info
|
||||
run: ../../../b2 print_config_info toolset=${{ matrix.toolset }} cxxstd=14,17,2a
|
||||
run: ../../../b2 print_config_info toolset=${{ matrix.toolset }} cxxstd=${{ matrix.cxxstd }}
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
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
|
||||
run: ../../../b2 toolset=${{ matrix.toolset }} cxxstd=${{ matrix.cxxstd }} define=CI_SUPPRESS_KNOWN_ISSUES
|
||||
working-directory: ../boost-root/libs/graph/test
|
||||
windows_msvc_14_3:
|
||||
runs-on: windows-2022
|
||||
@@ -182,10 +141,8 @@ 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
|
||||
|
||||
@@ -231,10 +188,8 @@ 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
|
||||
|
||||
@@ -290,8 +245,8 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-2019
|
||||
- os: windows-2022
|
||||
- os: windows-2025
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
@@ -339,8 +294,8 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-2019
|
||||
- os: windows-2022
|
||||
- os: windows-2025
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
|
||||
+1
-2
@@ -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.5...3.16)
|
||||
cmake_minimum_required(VERSION 3.8...3.16)
|
||||
|
||||
project(boost_graph VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||
|
||||
@@ -22,7 +22,6 @@ target_link_libraries(boost_graph
|
||||
Boost::array
|
||||
Boost::assert
|
||||
Boost::bimap
|
||||
Boost::bind
|
||||
Boost::concept_check
|
||||
Boost::config
|
||||
Boost::container_hash
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
# 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
|
||||
;
|
||||
|
||||
+8
-4
@@ -6,9 +6,15 @@
|
||||
|
||||
import mpi ;
|
||||
|
||||
project boost/graph
|
||||
: requirements <include>../src
|
||||
constant boost_dependencies_private :
|
||||
/boost/regex//boost_regex
|
||||
;
|
||||
|
||||
project
|
||||
: common-requirements <include>../include <library>$(boost_dependencies)
|
||||
: requirements <include>../src <library>$(boost_dependencies_private)
|
||||
: source-location ../src
|
||||
: usage-requirements <define>BOOST_GRAPH_NO_LIB=1
|
||||
;
|
||||
|
||||
lib boost_graph
|
||||
@@ -24,5 +30,3 @@ lib boost_graph
|
||||
:
|
||||
:
|
||||
;
|
||||
|
||||
boost-install boost_graph ;
|
||||
|
||||
+1
-1
@@ -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_example.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_properties.cpp"><tt>libs/graph/example/grid_graph_properties.cpp</tt></a>
|
||||
</p>
|
||||
|
||||
<h4>Template Parameters</h4>
|
||||
|
||||
@@ -329,6 +329,11 @@ If <tt>vis</tt> is an object of a type modelling the ResourceConstrainedShortest
|
||||
<table border>
|
||||
<tr>
|
||||
<td>
|
||||
<tt>vis.on_enter_loop(const Queue& queue, const Graph& g )</tt>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<tt>vis.on_label_popped( const Label& l, const Graph& g )</tt>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -353,7 +358,7 @@ If <tt>vis</tt> is an object of a type modelling the ResourceConstrainedShortest
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
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.
|
||||
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.
|
||||
<p>
|
||||
|
||||
<a name="FunctionsDescription"><h3>Functions Description</h3></a>
|
||||
|
||||
+12
-7
@@ -3,12 +3,17 @@
|
||||
# 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)
|
||||
|
||||
import ../../config/checks/config : requires ;
|
||||
require-b2 5.0.1 ;
|
||||
import-search /boost/config/checks ;
|
||||
|
||||
import 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 ;
|
||||
@@ -75,15 +80,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 : [ 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 /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 ] ;
|
||||
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 ../build//boost_graph ;
|
||||
run graphviz.cpp ../build//boost_graph : $(TEST_DIR)/graphviz_example.dot ;
|
||||
run graph-thingie.cpp /boost/graph//boost_graph ;
|
||||
run graphviz.cpp /boost/graph//boost_graph : $(TEST_DIR)/graphviz_example.dot ;
|
||||
run grid_graph_example.cpp ;
|
||||
run grid_graph_properties.cpp ;
|
||||
exe hawick_circuits : hawick_circuits.cpp ;
|
||||
@@ -114,7 +119,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 ../build//boost_graph : $(TEST_DIR)/figs/ospf-graph.dot $(TEST_DIR)/figs/ospf-sptree.dot $(TEST_DIR)/routing-table.dat ;
|
||||
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 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 ;
|
||||
@@ -129,7 +134,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 ../build//boost_graph ;
|
||||
run read_graphviz.cpp /boost/graph//boost_graph ;
|
||||
exe read_write_dimacs : read_write_dimacs-eg.cpp ;
|
||||
run remove_edge_if_bidir.cpp ;
|
||||
run remove_edge_if_dir.cpp ;
|
||||
@@ -208,7 +213,7 @@ explicit girth ;
|
||||
#run edge-connectivity.cpp ;
|
||||
#
|
||||
# These compile, but still use the old graphviz interface and die and runtime:
|
||||
# run strong_components.cpp ../build//boost_graph ;
|
||||
# run strong_components.cpp /boost/graph//boost_graph ;
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -25,19 +25,18 @@ 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(edges, edges + n_edges);
|
||||
Graph g(std::begin(edges), std::end(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 };
|
||||
|
||||
@@ -57,8 +57,8 @@ int main(int, char*[])
|
||||
Pair(6, 7) }; // g-h
|
||||
|
||||
Graph G(10);
|
||||
for (int i = 0; i < 14; ++i)
|
||||
add_edge(edges[i].first, edges[i].second, G);
|
||||
for (auto const& edge : edges)
|
||||
add_edge(edge.first, edge.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 i = inv_perm.begin(); i != inv_perm.end(); ++i)
|
||||
cout << index_map[*i] << " ";
|
||||
for (auto const& vertex : inv_perm)
|
||||
cout << index_map[vertex] << " ";
|
||||
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 i = inv_perm.begin(); i != inv_perm.end(); ++i)
|
||||
cout << index_map[*i] << " ";
|
||||
for (auto const& vertex : inv_perm)
|
||||
cout << index_map[vertex] << " ";
|
||||
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 i = inv_perm.begin(); i != inv_perm.end(); ++i)
|
||||
cout << index_map[*i] << " ";
|
||||
for (auto const& vertex : inv_perm)
|
||||
cout << index_map[vertex] << " ";
|
||||
cout << endl;
|
||||
|
||||
for (size_type c = 0; c != inv_perm.size(); ++c)
|
||||
|
||||
@@ -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 si = S_star.begin(); si != S_star.end(); ++si)
|
||||
in_S_star[*si] = true;
|
||||
for (auto const& vertex : S_star.begin())
|
||||
in_S_star[vertex] = true;
|
||||
degree_size_type c = 0;
|
||||
for (auto si = S_star.begin(); si != S_star.end(); ++si)
|
||||
for (auto const& vertex : S_star.begin())
|
||||
{
|
||||
typename graph_traits< VertexListGraph >::out_edge_iterator ei, ei_end;
|
||||
for (boost::tie(ei, ei_end) = out_edges(*si, g); ei != ei_end; ++ei)
|
||||
for (boost::tie(ei, ei_end) = out_edges(vertex, 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 i = disconnecting_set.begin(); i != disconnecting_set.end(); ++i)
|
||||
std::cout << "(" << attr_map[source(*i, g)]["label"] << ","
|
||||
<< attr_map[target(*i, g)]["label"] << ") ";
|
||||
for (auto const& edge : disconnecting_set)
|
||||
std::cout << "(" << attr_map[source(edge, g)]["label"] << ","
|
||||
<< attr_map[target(edge, g)]["label"] << ") ";
|
||||
std::cout << "}." << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -45,18 +45,15 @@ int main()
|
||||
B,
|
||||
C,
|
||||
D,
|
||||
E,
|
||||
N
|
||||
E
|
||||
};
|
||||
const char* name = "ABCDE";
|
||||
typedef std::vector< std::list< int > > Graph;
|
||||
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);
|
||||
Graph g = { { B, C }, // A
|
||||
{}, // B
|
||||
{ D, E }, // C
|
||||
{ E }, // D
|
||||
{ C } }; // E
|
||||
|
||||
constant_target filter(E);
|
||||
filtered_graph< Graph, constant_target > fg(g, filter);
|
||||
|
||||
+10
-10
@@ -778,13 +778,13 @@ int writeHB_mat_double(const char* filename, int M, int N,
|
||||
|
||||
if ( Ptrfmt == NULL ) Ptrfmt = "(8I10)";
|
||||
ParseIfmt(Ptrfmt,&Ptrperline,&Ptrwidth);
|
||||
sprintf(pformat,"%%%dd",Ptrwidth);
|
||||
snprintf(pformat, sizeof(pformat), "%%%dd", Ptrwidth);
|
||||
ptrcrd = (N+1)/Ptrperline;
|
||||
if ( (N+1)%Ptrperline != 0) ptrcrd++;
|
||||
|
||||
if ( Indfmt == NULL ) Indfmt = Ptrfmt;
|
||||
ParseIfmt(Indfmt,&Indperline,&Indwidth);
|
||||
sprintf(iformat,"%%%dd",Indwidth);
|
||||
snprintf(iformat, sizeof(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')
|
||||
sprintf(vformat,"%% %d.%df",Valwidth,Valprec);
|
||||
snprintf(vformat, sizeof(vformat), "%% %d.%df", Valwidth, Valprec);
|
||||
else
|
||||
sprintf(vformat,"%% %d.%dE",Valwidth,Valprec);
|
||||
snprintf(vformat, sizeof(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')
|
||||
sprintf(rformat,"%% %d.%df",Rhswidth,Rhsprec);
|
||||
snprintf(rformat, sizeof(rformat), "%% %d.%df", Rhswidth, Rhsprec);
|
||||
else
|
||||
sprintf(rformat,"%% %d.%dE",Rhswidth,Rhsprec);
|
||||
snprintf(rformat, sizeof(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);
|
||||
sprintf(pformat,"%%%dd",Ptrwidth);
|
||||
snprintf(pformat, sizeof(pformat), "%%%dd", Ptrwidth);
|
||||
|
||||
if ( Indfmt == NULL ) Indfmt = Ptrfmt;
|
||||
ParseIfmt(Indfmt,&Indperline,&Indwidth);
|
||||
sprintf(iformat,"%%%dd",Indwidth);
|
||||
snprintf(iformat, sizeof(iformat), "%%%dd", Indwidth);
|
||||
|
||||
if ( Type[0] != 'P' ) { /* Skip if pattern only */
|
||||
if ( Valfmt == NULL ) Valfmt = "(4E20.13)";
|
||||
ParseRfmt(Valfmt,&Valperline,&Valwidth,&Valprec,&Valflag);
|
||||
sprintf(vformat,"%%%ds",Valwidth);
|
||||
snprintf(vformat, sizeof(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);
|
||||
sprintf(rformat,"%%%ds",Rhswidth);
|
||||
snprintf(rformat, sizeof(rformat), "%%%ds", Rhswidth);
|
||||
rhscrd = nrhsentries/Rhsperline;
|
||||
if ( nrhsentries%Rhsperline != 0) rhscrd++;
|
||||
if ( Rhstype[1] == 'G' ) rhscrd+=rhscrd;
|
||||
|
||||
@@ -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 i = inv_perm.begin(); i != inv_perm.end(); ++i)
|
||||
cout << index_map[*i] << " ";
|
||||
for (auto const& vertex : inv_perm)
|
||||
cout << index_map[vertex] << " ";
|
||||
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 i = inv_perm.begin(); i != inv_perm.end(); ++i)
|
||||
cout << index_map[*i] << " ";
|
||||
for (auto const& vertex : inv_perm)
|
||||
cout << index_map[vertex] << " ";
|
||||
cout << endl;
|
||||
|
||||
for (size_type c = 0; c != inv_perm.size(); ++c)
|
||||
|
||||
@@ -46,14 +46,14 @@ int main()
|
||||
|
||||
auto weight = get(edge_weight, g);
|
||||
int total_weight = 0;
|
||||
for (size_type e = 0; e < mst.size(); ++e)
|
||||
total_weight += get(weight, mst[e]);
|
||||
for (auto const& edge : mst)
|
||||
total_weight += get(weight, edge);
|
||||
std::cout << "total weight: " << total_weight << std::endl;
|
||||
|
||||
typedef graph_traits< Graph >::vertex_descriptor Vertex;
|
||||
for (size_type i = 0; i < mst.size(); ++i)
|
||||
for (auto const& edge : mst)
|
||||
{
|
||||
auto u = source(mst[i], g), v = target(mst[i], g);
|
||||
auto u = source(edge, g), v = target(edge, g);
|
||||
edge_attr_map[edge(u, v, g_dot).first]["color"] = "black";
|
||||
}
|
||||
std::ofstream out("figs/telephone-mst-kruskal.dot");
|
||||
|
||||
@@ -25,15 +25,14 @@ int main()
|
||||
|
||||
const int n_vertices = 18;
|
||||
|
||||
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 ");
|
||||
std::vector< std::string > ascii_graph
|
||||
= { " 0 1---2 3 ",
|
||||
" \\ / \\ / ",
|
||||
" 4---5 6---7 ",
|
||||
" | | | | ",
|
||||
" 8---9 10---11 ",
|
||||
" / \\ / \\ ",
|
||||
" 12 13 14---15 16 17 " };
|
||||
|
||||
// It has a perfect matching of size 8. There are two isolated
|
||||
// vertices that we'll use later...
|
||||
@@ -75,8 +74,8 @@ int main()
|
||||
|
||||
std::cout << "In the following graph:" << std::endl << std::endl;
|
||||
|
||||
for (auto itr = ascii_graph.begin(); itr != ascii_graph.end(); ++itr)
|
||||
std::cout << *itr << std::endl;
|
||||
for (auto const& str : ascii_graph)
|
||||
std::cout << str << std::endl;
|
||||
|
||||
std::cout << std::endl
|
||||
<< "Found a matching of size " << matching_size(g, &mate[0])
|
||||
|
||||
@@ -52,8 +52,8 @@ int main(int, char*[])
|
||||
const char name[] = "abcdef";
|
||||
|
||||
const int num_nodes = 6;
|
||||
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) };
|
||||
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) };
|
||||
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(edges, edges + n_edges, weights, num_nodes);
|
||||
auto weightmap = get(edge_weight, G);
|
||||
Graph G(std::begin(edges), std::end(edges), weights, num_nodes);
|
||||
auto = get(edge_weight, G);
|
||||
#endif
|
||||
|
||||
std::vector< Vertex > p(num_vertices(G));
|
||||
|
||||
@@ -18,7 +18,7 @@ int main()
|
||||
Graph;
|
||||
typedef std::pair< int, int > E;
|
||||
const int num_nodes = 5;
|
||||
E edges[]
|
||||
const auto 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(edges, edges + sizeof(edges) / sizeof(E), weights, num_nodes);
|
||||
Graph g(std::begin(edges), std::end(edges), weights, num_nodes);
|
||||
#endif
|
||||
std::vector< graph_traits< Graph >::vertex_descriptor > p(num_vertices(g));
|
||||
|
||||
|
||||
@@ -41,17 +41,10 @@ typedef adjacency_list< vecS, vecS, directedS > Graph;
|
||||
int main()
|
||||
{
|
||||
typedef std::pair< std::size_t, std::size_t > Edge;
|
||||
Edge edges[6] = { Edge(0, 3), Edge(0, 2), Edge(0, 3), Edge(1, 3),
|
||||
const auto edges = { Edge(0, 3), Edge(0, 2), Edge(0, 3), Edge(1, 3),
|
||||
Edge(2, 0), Edge(3, 2) };
|
||||
|
||||
#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
|
||||
Graph g(std::begin(edges), std::end(edges), 4);
|
||||
|
||||
std::cout << "original graph:" << std::endl;
|
||||
print_graph(g, get(vertex_index, g));
|
||||
|
||||
@@ -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(edges, edges + 16, ws, 8, 16);
|
||||
undirected_graph g(std::begin(edges), std::end(edges), ws, 8, 16);
|
||||
|
||||
// define a property map, `parities`, that will store a boolean value for
|
||||
// each vertex. Vertices that have the same parity after
|
||||
|
||||
+4
-12
@@ -19,25 +19,17 @@ 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(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::vector< std::list< int > > g
|
||||
= { { 3 }, { 3, 4 }, { 1 }, { 5 }, { 6 }, { 6 }, {} };
|
||||
|
||||
std::deque< int > topo_order;
|
||||
|
||||
topological_sort(g, std::front_inserter(topo_order),
|
||||
vertex_index_map(identity_property_map()));
|
||||
|
||||
int n = 1;
|
||||
for (auto i = topo_order.begin(); i != topo_order.end(); ++i, ++n)
|
||||
std::cout << tasks[*i] << std::endl;
|
||||
for (auto const& vertex : topo_order)
|
||||
std::cout << tasks[vertex] << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,8 @@ int main()
|
||||
topological_sort(g, std::front_inserter(topo_order),
|
||||
vertex_index_map(identity_property_map()));
|
||||
|
||||
int n = 1;
|
||||
for (auto i = topo_order.begin(); i != topo_order.end(); ++i, ++n)
|
||||
std::cout << tasks[*i] << std::endl;
|
||||
for (auto const& vertex : topo_order)
|
||||
std::cout << tasks[vertex] << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -43,16 +43,10 @@ int main(int, char*[])
|
||||
Graph;
|
||||
|
||||
typedef boost::graph_traits< Graph >::vertex_descriptor Vertex;
|
||||
Pair edges[6] = { Pair(0, 1), Pair(2, 4), Pair(2, 5), Pair(0, 3),
|
||||
const auto edges = { Pair(0, 1), Pair(2, 4), Pair(2, 5), Pair(0, 3),
|
||||
Pair(1, 4), Pair(4, 3) };
|
||||
#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
|
||||
|
||||
Graph G(std::begin(edges), std::end(edges), 6 /* vertices count */);
|
||||
|
||||
auto id = get(vertex_index, G);
|
||||
|
||||
|
||||
@@ -36,22 +36,15 @@ typedef boost::graph_traits< Graph >::edge_iterator edge_iterator;
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
Graph iG, vG;
|
||||
vector< edge_descriptor > iG_o;
|
||||
vector< edge_descriptor > vG_o;
|
||||
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 };
|
||||
|
||||
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< 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 };
|
||||
|
||||
vector< bool > inL(iG_o.size(), false);
|
||||
|
||||
|
||||
@@ -27,22 +27,18 @@ int main()
|
||||
v,
|
||||
w,
|
||||
x,
|
||||
y,
|
||||
N
|
||||
y
|
||||
};
|
||||
char name[] = "rstuvwxy";
|
||||
typedef std::vector< std::list< int > > Graph;
|
||||
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);
|
||||
Graph g = { { v }, // r
|
||||
{ r, r, w }, // s
|
||||
{ x }, // t
|
||||
{ t }, // u
|
||||
{}, // v
|
||||
{ t, x }, // w
|
||||
{ y }, // x
|
||||
{ u } }; // y
|
||||
boost::print_graph(g, name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+3
-9
@@ -71,15 +71,9 @@ int main(int, char*[])
|
||||
|
||||
typedef adjacency_list<> Graph;
|
||||
typedef std::pair< int, int > E;
|
||||
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
|
||||
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);
|
||||
|
||||
typedef boost::graph_traits< Graph >::vertices_size_type size_type;
|
||||
|
||||
|
||||
@@ -433,7 +433,8 @@ 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 edge_list_graph_tag,
|
||||
public virtual bidirectional_graph_tag
|
||||
{
|
||||
};
|
||||
|
||||
@@ -826,6 +827,27 @@ 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
|
||||
|
||||
|
||||
@@ -62,6 +62,21 @@ 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
|
||||
@@ -80,13 +95,9 @@ namespace detail
|
||||
*/
|
||||
dominator_visitor(const Graph& g, const Vertex& entry,
|
||||
const IndexMap& indexMap, DomTreePredMap domTreePredMap)
|
||||
: 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))
|
||||
: pred_(num_vertices(g))
|
||||
, predMap_(make_iterator_property_map(pred_.begin(), indexMap))
|
||||
, samedom_(num_vertices(g), graph_traits< Graph >::null_vertex())
|
||||
, buckets_(num_vertices(g))
|
||||
, bucketMap_(make_iterator_property_map(buckets_.begin(), indexMap))
|
||||
, entry_(entry)
|
||||
@@ -132,18 +143,18 @@ namespace detail
|
||||
if (get(dfnumMap, v) <= get(dfnumMap, n))
|
||||
s2 = v;
|
||||
else
|
||||
s2 = get(semiMap_, ancestor_with_lowest_semi_(v, dfnumMap));
|
||||
s2 = get(predMap_, ancestor_with_lowest_semi_(v, dfnumMap))
|
||||
.semi;
|
||||
|
||||
if (get(dfnumMap, s2) < get(dfnumMap, s))
|
||||
s = s2;
|
||||
}
|
||||
put(semiMap_, n, s);
|
||||
auto& pred_of_n = get(predMap_, n);
|
||||
pred_of_n = {s, p, n};
|
||||
|
||||
// 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,
|
||||
@@ -161,7 +172,7 @@ namespace detail
|
||||
{
|
||||
const Vertex v(*buckItr);
|
||||
const Vertex y(ancestor_with_lowest_semi_(v, dfnumMap));
|
||||
if (get(semiMap_, y) == get(semiMap_, v))
|
||||
if (get(predMap_, y).semi == get(predMap_, v).semi)
|
||||
put(domTreePredMap_, v, p);
|
||||
else
|
||||
put(samedomMap, v, y);
|
||||
@@ -177,24 +188,32 @@ namespace detail
|
||||
const Vertex ancestor_with_lowest_semi_(
|
||||
const Vertex& v, const TimeMap& dfnumMap)
|
||||
{
|
||||
const Vertex a(get(ancestorMap_, v));
|
||||
const Vertex a(get(predMap_, v).ancestor);
|
||||
const auto& pred_of_a = get(predMap_, a);
|
||||
|
||||
if (get(ancestorMap_, a) != graph_traits< Graph >::null_vertex())
|
||||
auto& pred_of_v = get(predMap_, v);
|
||||
|
||||
if (pred_of_a.ancestor != graph_traits< Graph >::null_vertex())
|
||||
{
|
||||
const Vertex b(ancestor_with_lowest_semi_(a, dfnumMap));
|
||||
const auto& pred_of_b = get(predMap_, b);
|
||||
|
||||
put(ancestorMap_, v, get(ancestorMap_, a));
|
||||
pred_of_v.ancestor = pred_of_a.ancestor;
|
||||
|
||||
if (get(dfnumMap, get(semiMap_, b))
|
||||
< get(dfnumMap, get(semiMap_, get(bestMap_, v))))
|
||||
put(bestMap_, v, b);
|
||||
if (get(dfnumMap, pred_of_b.semi)
|
||||
< get(dfnumMap, get(predMap_, pred_of_v.best).semi))
|
||||
pred_of_v.best = b;
|
||||
}
|
||||
|
||||
return get(bestMap_, v);
|
||||
return pred_of_v.best;
|
||||
}
|
||||
|
||||
std::vector< Vertex > semi_, ancestor_, samedom_, best_;
|
||||
PredMap semiMap_, ancestorMap_, bestMap_;
|
||||
std::vector< vertex_triple< Graph > > pred_;
|
||||
iterator_property_map< typename std::vector< vertex_triple< Graph > >::iterator,
|
||||
IndexMap >
|
||||
predMap_;
|
||||
|
||||
std::vector< Vertex > samedom_;
|
||||
std::vector< std::vector< Vertex > > buckets_;
|
||||
|
||||
iterator_property_map<
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#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>
|
||||
@@ -241,14 +240,10 @@ 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);
|
||||
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)));
|
||||
auto mei = boost::first_max_element(oei, oeie,
|
||||
[this](const auto& first, const auto& second)
|
||||
{ return m_cmp(m_ew1m[first], m_ew1m[second]); });
|
||||
if (mei == oeie)
|
||||
{
|
||||
if (m_sink == graph_traits< Graph >().null_vertex())
|
||||
@@ -356,16 +351,17 @@ 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,
|
||||
boost::bind(std::equal_to< my_color_type >(), my_white,
|
||||
boost::bind(&color_map_t::operator[], vcm_, _1))))
|
||||
[this, &vcm_](const auto& uv)
|
||||
{
|
||||
return std::equal_to< my_color_type >()(
|
||||
my_white, vcm_[uv]);
|
||||
}))
|
||||
!= vie)
|
||||
/// While there are undiscovered vertices
|
||||
{
|
||||
|
||||
@@ -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 < *y_multiplicity_iter;
|
||||
return x_multiplicity_iter->second < y_multiplicity_iter->second;
|
||||
}
|
||||
Invariant1 invariant1;
|
||||
const InvariantCountMap* multiplicity;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#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>
|
||||
@@ -49,8 +48,6 @@ 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;
|
||||
|
||||
@@ -61,7 +58,7 @@ namespace detail
|
||||
reverse_iterator rbegin = Qptr->rbegin();
|
||||
|
||||
// heap the vertices already there
|
||||
std::make_heap(rbegin, rend, boost::bind< bool >(comp, _2, _1));
|
||||
std::make_heap(rbegin, rend, [this](const auto& first, const auto& second) { return comp(second, first); });
|
||||
|
||||
unsigned i = 0;
|
||||
|
||||
|
||||
@@ -11,9 +11,8 @@
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm> // for std::min and std::max
|
||||
#include <functional>
|
||||
#include <functional> //for std::less
|
||||
#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>
|
||||
@@ -130,16 +129,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(),
|
||||
boost::bind(std::less< cg_vertex >(),
|
||||
boost::bind(detail::subscript(topo_number), _1),
|
||||
boost::bind(detail::subscript(topo_number), _2)));
|
||||
[&topo_number](const auto& cg_0, const auto& cg_1)
|
||||
{
|
||||
return std::less< cg_vertex >()(
|
||||
topo_number[cg_0], topo_number[cg_1]);
|
||||
});
|
||||
}
|
||||
|
||||
std::vector< std::vector< cg_vertex > > chains;
|
||||
|
||||
+19
-12
@@ -7,9 +7,12 @@
|
||||
# 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/checks/config : requires ;
|
||||
import config : requires ;
|
||||
|
||||
path-constant TEST_DIR : . ;
|
||||
|
||||
@@ -19,6 +22,10 @@ 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.
|
||||
@@ -73,13 +80,13 @@ alias graph_test_regular :
|
||||
[ run graph.cpp : : : <define>TEST=9 : graph_9 ]
|
||||
[ compile graph_concepts.cpp ]
|
||||
[ run graphviz_test.cpp
|
||||
../build//boost_graph : --log_level=all ]
|
||||
/boost/graph//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
|
||||
../../serialization/build//boost_serialization
|
||||
/boost/serialization//boost_serialization
|
||||
: : : ]
|
||||
|
||||
[ compile reverse_graph_cc.cpp ]
|
||||
@@ -113,11 +120,11 @@ alias graph_test_regular :
|
||||
[ run cuthill_mckee_ordering.cpp ]
|
||||
[ run king_ordering.cpp ]
|
||||
[ run matching_test.cpp ]
|
||||
[ run weighted_matching_test.cpp ]
|
||||
[ run weighted_matching_test.cpp : $(WEIGHTED_MATCHING_INPUT_FILE) ]
|
||||
[ run weighted_matching_test2.cpp ]
|
||||
[ run max_flow_test.cpp ]
|
||||
[ run boykov_kolmogorov_max_flow_test.cpp ]
|
||||
[ run cycle_ratio_tests.cpp ../build//boost_graph : $(CYCLE_RATIO_INPUT_FILE) ]
|
||||
[ run cycle_ratio_tests.cpp /boost/graph//boost_graph : $(CYCLE_RATIO_INPUT_FILE) ]
|
||||
[ run basic_planarity_test.cpp ]
|
||||
[ run make_connected_test.cpp ]
|
||||
[ run make_bicon_planar_test.cpp ]
|
||||
@@ -138,14 +145,14 @@ alias graph_test_regular :
|
||||
[ run clustering_coefficient.cpp ]
|
||||
[ run core_numbers_test.cpp ]
|
||||
[ run read_propmap.cpp ]
|
||||
[ run mcgregor_subgraphs_test.cpp ../build//boost_graph ]
|
||||
[ run mcgregor_subgraphs_test.cpp /boost/graph//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 ../build//boost_graph ]
|
||||
[ run random_spanning_tree_test.cpp /boost/graph//boost_graph ]
|
||||
[ run random_matching_test.cpp : 1000 1020 ]
|
||||
[ run graphml_test.cpp ../build//boost_graph : : "graphml_test.xml" ]
|
||||
[ run graphml_test.cpp /boost/graph//boost_graph : : "graphml_test.xml" ]
|
||||
[ run mas_test.cpp : $(TEST_DIR) ]
|
||||
[ run stoer_wagner_test.cpp : $(TEST_DIR) ]
|
||||
[ compile filtered_graph_properties_dijkstra.cpp ]
|
||||
@@ -171,12 +178,12 @@ alias graph_test_with_filesystem : :
|
||||
|
||||
alias graph_test_with_filesystem :
|
||||
[ run all_planar_input_files_test.cpp
|
||||
../../filesystem/build
|
||||
../../system/build
|
||||
/boost/filesystem//boost_filesystem
|
||||
/boost/system//boost_system
|
||||
: $(PLANAR_INPUT_FILES) ]
|
||||
[ run parallel_edges_loops_test.cpp
|
||||
../../filesystem/build
|
||||
../../system/build
|
||||
/boost/filesystem//boost_filesystem
|
||||
/boost/system//boost_system
|
||||
: $(PLANAR_INPUT_FILES) ]
|
||||
;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ 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 >));
|
||||
}
|
||||
@@ -30,6 +31,7 @@ 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 >));
|
||||
}
|
||||
@@ -44,6 +46,7 @@ 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 >));
|
||||
@@ -64,6 +67,7 @@ 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 >));
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#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;
|
||||
@@ -24,13 +25,51 @@ struct DominatorCorrectnessTestSet
|
||||
|
||||
using namespace boost;
|
||||
|
||||
typedef adjacency_list< listS, listS, bidirectionalS,
|
||||
property< vertex_index_t, std::size_t >, no_property >
|
||||
G;
|
||||
|
||||
int main(int, char*[])
|
||||
// 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 DominatorCorrectnessTestSet::edge edge;
|
||||
|
||||
template < typename Graph >
|
||||
void index_graph(Graph&, std::true_type /*IsRandomAccessAdjacentList*/)
|
||||
{
|
||||
// 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;
|
||||
|
||||
DominatorCorrectnessTestSet testSet[7];
|
||||
|
||||
@@ -217,34 +256,32 @@ int main(int, char*[])
|
||||
{
|
||||
const int numOfVertices = testSet[i].numOfVertices;
|
||||
|
||||
G g(testSet[i].edges.begin(), testSet[i].edges.end(), numOfVertices);
|
||||
Graph g(testSet[i].edges.begin(), testSet[i].edges.end(), numOfVertices);
|
||||
|
||||
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;
|
||||
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);
|
||||
|
||||
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< G >::null_vertex());
|
||||
num_vertices(g), graph_traits< Graph >::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< G >::null_vertex())
|
||||
if (get(domTreePredMap, *uItr)
|
||||
!= graph_traits< Graph >::null_vertex())
|
||||
idom[get(indexMap, *uItr)]
|
||||
= get(indexMap, get(domTreePredMap, *uItr));
|
||||
else
|
||||
@@ -260,7 +297,7 @@ int main(int, char*[])
|
||||
|
||||
// compare results of fast version and slow version of dominator tree
|
||||
domTreePredVector2 = vector< Vertex >(
|
||||
num_vertices(g), graph_traits< G >::null_vertex());
|
||||
num_vertices(g), graph_traits< Graph >::null_vertex());
|
||||
domTreePredMap
|
||||
= make_iterator_property_map(domTreePredVector2.begin(), indexMap);
|
||||
|
||||
@@ -269,7 +306,8 @@ int main(int, char*[])
|
||||
vector< int > idom2(num_vertices(g));
|
||||
for (boost::tie(uItr, uEnd) = vertices(g); uItr != uEnd; ++uItr)
|
||||
{
|
||||
if (get(domTreePredMap, *uItr) != graph_traits< G >::null_vertex())
|
||||
if (get(domTreePredMap, *uItr)
|
||||
!= graph_traits< Graph >::null_vertex())
|
||||
idom2[get(indexMap, *uItr)]
|
||||
= get(indexMap, get(domTreePredMap, *uItr));
|
||||
else
|
||||
@@ -283,6 +321,21 @@ int main(int, char*[])
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
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 ;
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
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 ;
|
||||
}
|
||||
+1
-4
@@ -70,11 +70,8 @@ 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, std::bind1st(cmp, v));
|
||||
found = std::find_if(ai, aiend, [&v, &cmp](const auto& el) { return cmp(v, el); });
|
||||
#endif
|
||||
|
||||
if (found != aiend)
|
||||
|
||||
@@ -31,6 +31,10 @@
|
||||
#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;
|
||||
@@ -404,12 +408,51 @@ 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();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#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>
|
||||
@@ -59,5 +60,26 @@ 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;
|
||||
}
|
||||
|
||||
@@ -132,6 +132,8 @@ 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 >);
|
||||
@@ -145,6 +147,8 @@ 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 >);
|
||||
|
||||
@@ -136,9 +136,12 @@ Graph make_graph(typename graph_traits< Graph >::vertices_size_type num_v,
|
||||
return g;
|
||||
}
|
||||
|
||||
int main(int, char*[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::ifstream in_file("weighted_matching.dat");
|
||||
const char* filename = "weighted_matching.dat";
|
||||
if (argc > 1)
|
||||
filename = argv[1];
|
||||
std::ifstream in_file(filename);
|
||||
BOOST_TEST(in_file.good());
|
||||
std::string line;
|
||||
while (std::getline(in_file, line))
|
||||
|
||||
Reference in New Issue
Block a user