diff --git a/.clang-format b/.clang-format index a4ce58c47..e73f6d56b 100644 --- a/.clang-format +++ b/.clang-format @@ -1,5 +1,5 @@ BasedOnStyle: WebKit -Standard: Cpp11 +Standard: Cpp03 AlignAfterOpenBracket: false AlignEscapedNewlinesLeft: true AlwaysBreakAfterDefinitionReturnType: None @@ -13,4 +13,3 @@ SortIncludes: false AlignTrailingComments: false SpacesInAngles: true - diff --git a/.gitignore b/.gitignore index 36e77b53c..ef202911d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,12 @@ kevin-bacon2.dat random.dot triangular-fr.dot triangular-kk.dot +ospf-sptree.dot +routing-table.dat +tc-out.dot +test-astar-cities.dot +web-graph.dot +cycle_ratio_s382.90.dot +test/metric_tsp_approx.graph +test/weighted_graph.gr +test/weighted_matching.dat diff --git a/.travis.yml b/.travis.yml index e1cab8619..6bb3ae580 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,298 +1,911 @@ -# Copyright 2016, 2017 Peter Dimov -# Copyright 2018 Joh Maddock -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) - -language: cpp - -python: "2.7" - -os: - - linux - - osx - -branches: - only: - - master - - develop - - /feature\/.*/ - -env: - matrix: - - BOGUS_JOB=true - -matrix: - - exclude: - - env: BOGUS_JOB=true - - include: - - os: linux - compiler: g++-4.4 - env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x - addons: - apt: - packages: - - g++-4.4 - sources: +--- +addons: + apt: + packages: + - binutils-gold + - gdb + - libc6-dbg +after_script: true +anchors: + clang-38: + apt: + packages: + - clang-3.8 + - gcc-multilib + - libstdc++-6-dev + sources: + - llvm-toolchain-xenial-3.8 + - ubuntu-toolchain-r-test + clang-4: + apt: + packages: + - clang-4.0 + - gcc-multilib + - libstdc++-6-dev + sources: + - llvm-toolchain-xenial-4.0 + - ubuntu-toolchain-r-test + clang-5: + apt: + packages: + - clang-5.0 + - gcc-multilib + - libstdc++-7-dev + sources: + - llvm-toolchain-xenial-5.0 + - ubuntu-toolchain-r-test + clang-6: + apt: + packages: + - clang-6.0 + - gcc-multilib + - libc6-dbg + - libc++-dev + - libstdc++-8-dev + sources: + - llvm-toolchain-xenial-6.0 + - ubuntu-toolchain-r-test + clang-7: + apt: + packages: + - clang-7 + - gcc-multilib + - libc6-dbg + - libc++-dev + - libstdc++-8-dev + sources: + - llvm-toolchain-xenial-7 + - ubuntu-toolchain-r-test + clang-8: + apt: + packages: + - clang-8 + - gcc-multilib + - libc6-dbg + - libc++-dev + - libstdc++-8-dev + sources: + - llvm-toolchain-xenial-8 + - ubuntu-toolchain-r-test + gcc-48: + apt: + packages: + - g++-4.8 + - g++-4.8-multilib + gcc-49: + apt: + packages: + - g++-4.9 + - g++-4.9-multilib + sources: + - ubuntu-toolchain-r-test + gcc-5: + apt: + packages: + - g++-5 + - g++-5-multilib + gcc-6: + apt: + packages: + - g++-6 + - g++-6-multilib + sources: + - ubuntu-toolchain-r-test + gcc-7: + apt: + packages: + - g++-7 + - g++-7-multilib + sources: + - ubuntu-toolchain-r-test + gcc-8: + apt: + packages: + - g++-8 + - g++-8-multilib + sources: + - ubuntu-toolchain-r-test + gcc-9: + apt: + packages: + - g++-9 + - g++-9-multilib + sources: + - ubuntu-toolchain-r-test +before_install: true +before_script: true +dist: bionic +env: + global: + - "B2_ADDRESS_MODEL=address-model=64,32" + - "B2_THREADING=threading=multi,single" + - "B2_VARIANT=variant=release,debug" +install: "source utility/ci/travis/install.sh" +jobs: + include: + - + addons: + apt: + packages: + - g++-4.8 + dist: trusty + env: + - B2_TOOLSET=gcc-4.8 + - "B2_CXXSTD=cxxstd=03,11" + - "COPTS=cxxflags=-Wall -Wextra -Wpedantic -Wredundant-decls -Wcast-align -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Werror -Winvalid-pch -Wredundant-decls -Wformat=2 -Wmissing-format-attribute -Wformat-nonliteral -fstack-protector-all -fstack-check-lubsan -Wno-unused-parameter -Wno-missing-declarations -Wno-sign-compare -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -Wodr -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - g++-4.9 + sources: - ubuntu-toolchain-r-test - - - os: linux - compiler: g++-4.6 - env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x - addons: - apt: - packages: - - g++-4.6 - sources: + dist: trusty + env: + - B2_TOOLSET=gcc-4.9 + - "B2_CXXSTD=cxxstd=03,11" + - "COPTS=cxxflags=-Wall -Wextra -Wpedantic -Wredundant-decls -Wcast-align -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Werror -Winvalid-pch -Wredundant-decls -Wformat=2 -Wmissing-format-attribute -Wformat-nonliteral -fstack-protector-all -fstack-check-lubsan -Wno-unused-parameter -Wno-missing-declarations -Wno-sign-compare -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -Wodr -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - clang-3.8 + - libstdc++-6-dev + sources: + - llvm-toolchain-xenial-3.8 - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11 - addons: - apt: - packages: - - g++-4.7 - sources: + dist: trusty + env: + - B2_TOOLSET=clang-3.8 + - "B2_CXXSTD=cxxstd=03,11,14" + - "COPTS=cxxflags=-Wall -Wextra -Wpedantic -Wredundant-decls -Wcast-align -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Werror -Winvalid-pch -Wredundant-decls -Wformat=2 -Wmissing-format-attribute -Wformat-nonliteral -fstack-protector-all -fstack-check-lubsan -Wno-unused-parameter -Wno-missing-declarations -Wno-sign-compare -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -Wodr -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - g++-5 + env: + - B2_TOOLSET=gcc-5 + - B2_CXXSTD=cxxstd=11 + - "COPTS=cxxflags=-Wall -Wextra -Wpedantic -Wredundant-decls -Wcast-align -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Werror -Winvalid-pch -Wredundant-decls -Wformat=2 -Wmissing-format-attribute -Wformat-nonliteral -fstack-protector-all -fstack-check-lubsan -Wno-unused-parameter -Wno-missing-declarations -Wno-sign-compare -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -Wodr -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - g++-6 + sources: - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11 - addons: - apt: - packages: - - g++-4.8 - sources: + env: + - B2_TOOLSET=gcc-6 + - "B2_CXXSTD=cxxstd=11,14" + - "COPTS=cxxflags=-Wall -Wextra -Wpedantic -Wredundant-decls -Wcast-align -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Werror -Winvalid-pch -Wredundant-decls -Wformat=2 -Wmissing-format-attribute -Wformat-nonliteral -fstack-protector-all -fstack-check-lubsan -Wno-unused-parameter -Wno-missing-declarations -Wno-sign-compare -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -Wodr -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - g++-7 + sources: - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11 - addons: - apt: - packages: - - g++-4.9 - sources: + env: + - B2_TOOLSET=gcc-7 + - "B2_CXXSTD=cxxstd=11,14,17" + - "COPTS=cxxflags=-Wall -Wextra -Wpedantic -Wredundant-decls -Wcast-align -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Werror -Winvalid-pch -Wredundant-decls -Wformat=2 -Wmissing-format-attribute -Wformat-nonliteral -fstack-protector-all -fstack-check-lubsan -Wno-unused-parameter -Wno-missing-declarations -Wno-sign-compare -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -Wodr -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - g++-8 + sources: - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14 - addons: - apt: + env: + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=14,17,2a" + - "COPTS=cxxflags=-Wall -Wextra -Wpedantic -Wredundant-decls -Wcast-align -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Werror -Winvalid-pch -Wredundant-decls -Wformat=2 -Wmissing-format-attribute -Wformat-nonliteral -fstack-protector-all -fstack-check-lubsan -Wno-unused-parameter -Wno-missing-declarations -Wno-sign-compare -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -Wodr -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: packages: - - g++-5 - sources: + - clang-4.0 + - libstdc++-6-dev + sources: + - llvm-toolchain-xenial-4.0 - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11 - addons: - apt: - packages: - - g++-6 - sources: + env: + - B2_TOOLSET=clang-4.0 + - "B2_CXXSTD=cxxstd=11,14" + - "COPTS=cxxflags=-Wall -Wextra -Wpedantic -Wredundant-decls -Wcast-align -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Werror -Winvalid-pch -Wredundant-decls -Wformat=2 -Wmissing-format-attribute -Wformat-nonliteral -fstack-protector-all -fstack-check-lubsan -Wno-unused-parameter -Wno-missing-declarations -Wno-sign-compare -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -Wodr -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - clang-5.0 + - libstdc++-7-dev + sources: + - llvm-toolchain-xenial-5.0 - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=14,1z - addons: - apt: - packages: - - g++-6 - sources: + env: + - B2_TOOLSET=clang-5.0 + - "B2_CXXSTD=cxxstd=11,14,17" + - "COPTS=cxxflags=-Weverything -Werror -fstack-protector-all -fstack-check-lubsan -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - clang-6.0 + - libc6-dbg + - libc++-dev + - libstdc++-8-dev + sources: + - llvm-toolchain-xenial-6.0 - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-7 - env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11 - addons: - apt: - packages: - - g++-7 - sources: + env: + - B2_TOOLSET=clang-6.0 + - "B2_CXXSTD=cxxstd=14,17,2a" + - "COPTS=cxxflags=-Weverything -Werror -fstack-protector-all -fstack-check-lubsan -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - clang-7 + - libc6-dbg + - libc++-dev + - libstdc++-8-dev + sources: + - llvm-toolchain-xenial-7 - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-7 - env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=14,17 - addons: - apt: + env: + - B2_TOOLSET=clang-7 + - "B2_CXXSTD=cxxstd=14,17,2a" + - "COPTS=cxxflags=-Weverything -Werror -fstack-protector-all -fstack-check-lubsan -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - clang-8 + - libc6-dbg + - libc++-dev + - libstdc++-8-dev + sources: + - llvm-toolchain-xenial-8 + - ubuntu-toolchain-r-test + env: + - B2_TOOLSET=clang-8 + - "B2_CXXSTD=cxxstd=14,17,2a" + - "COPTS=cxxflags=-Weverything -Werror -fstack-protector-all -fstack-check-lubsan -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + addons: + apt: + packages: + - clang-6.0 + - libc6-dbg + - libc++-dev + - libstdc++-8-dev + sources: + - llvm-toolchain-xenial-6.0 + - ubuntu-toolchain-r-test + env: + - B2_TOOLSET=clang-6.0 + - "B2_CXXSTD=cxxstd=03,11,14,17,2a" + - B2_CXXFLAGS=-stdlib=libc++ + - "COPTS=cxxflags=-Weverything -Werror -fstack-protector-all -fstack-check-lubsan -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Unit Tests" + os: linux + stage: test + - + env: + - B2_TOOLSET=clang + - "B2_CXXSTD=cxxstd=03,11,17" + name: "Unit Tests" + os: osx + stage: test + - + addons: + apt: + packages: + - clang-format-8 + sources: + - llvm-toolchain-xenial-8 + - ubuntu-toolchain-r-test + after_script: true + before_install: + - "utility/ci/travis/format-check.sh || exit 1" + before_script: true + dist: bionic + install: true + name: clang-format + os: linux + script: true + stage: Static_QC + - + addons: + apt: packages: - - g++-7 + - cppcheck sources: - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11 - addons: - apt: - packages: + after_script: true + before_install: + - "utility/ci/travis/cppcheck.sh || exit 1" + before_script: true + dist: bionic + install: true + name: cppcheck + os: linux + script: true + stage: Static_QC + - + addons: + apt: + packages: - g++-8 - sources: + sources: - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=14,17 - addons: - apt: - packages: + dist: bionic + env: + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=03,11" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + name: codecov.io + os: linux + script: + - "pushd /tmp && git clone https://github.com/linux-test-project/lcov.git && export PATH=/tmp/lcov/bin:$PATH && which lcov && lcov --version && popd" + - utility/ci/codecov/coverage.sh + stage: Dynamic_QC + - + addons: + apt: + packages: - g++-8 - sources: + - gcc-8-multilib + - g++-8-multilib + - gcc-multilib + - g++-multilib + sources: - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11 - - - os: linux - env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11 - addons: - apt: - packages: - - clang-3.5 - sources: + dist: bionic + env: + - COMMENT=ubsan + - "B2_ADDRESS_MODEL=address-model=32" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=03" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - "COPTS=cxxflags=-fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" + - "LOPTS=linkflags=-fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold" + - UBSAN_OPTIONS='print_stacktrace=1' + name: "x86 C++03 Undefined behavior sanitizer" + os: linux + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - gcc-8-multilib + - g++-8-multilib + - gcc-multilib + - g++-multilib + sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.5 - - - os: linux - env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11 - addons: - apt: - packages: - - clang-3.6 - sources: + dist: bionic + env: + - COMMENT=ubsan + - "B2_ADDRESS_MODEL=address-model=32" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=11" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - "COPTS=cxxflags=-fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" + - "LOPTS=linkflags=-fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold" + - UBSAN_OPTIONS='print_stacktrace=1' + name: "x86 C++11 Undefined behavior sanitizer" + os: linux + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - gcc-8-multilib + - g++-8-multilib + - gcc-multilib + - g++-multilib + sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.6 - - - os: linux - env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11 - addons: - apt: - packages: - - clang-3.7 - sources: + dist: bionic + env: + - COMMENT=ubsan + - "B2_ADDRESS_MODEL=address-model=32" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=14" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - "COPTS=cxxflags=-fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" + - "LOPTS=linkflags=-fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold" + - UBSAN_OPTIONS='print_stacktrace=1' + name: "x86 C++14 Undefined behavior sanitizer" + os: linux + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - gcc-8-multilib + - g++-8-multilib + - gcc-multilib + - g++-multilib + sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.7 - - # Fails to compile std lib headers (toolset issue): - #- os: linux - # env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z - # addons: - # apt: - # packages: - # - clang-3.8 - # sources: - # - ubuntu-toolchain-r-test - # - llvm-toolchain-precise-3.8 - # - #- os: linux - # env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z - # addons: - # apt: - # packages: - # - clang-3.9 - # sources: - # - ubuntu-toolchain-r-test - # - llvm-toolchain-precise-3.9 - - - os: linux - compiler: clang++-4.0 - env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,1z - addons: - apt: - packages: - - clang-4.0 - sources: + dist: bionic + env: + - COMMENT=ubsan + - "B2_ADDRESS_MODEL=address-model=32" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=17" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - "COPTS=cxxflags=-fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" + - "LOPTS=linkflags=-fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold" + - UBSAN_OPTIONS='print_stacktrace=1' + name: "x86 C++17 Undefined behavior sanitizer" + os: linux + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - gcc-8-multilib + - g++-8-multilib + - gcc-multilib + - g++-multilib + sources: - ubuntu-toolchain-r-test - - llvm-toolchain-trusty-4.0 - - - os: linux - compiler: clang++-5.0 - env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11 - addons: - apt: - packages: - - clang-5.0 - sources: + dist: bionic + env: + - COMMENT=ubsan + - "B2_ADDRESS_MODEL=address-model=32" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=2a" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - "COPTS=cxxflags=-fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" + - "LOPTS=linkflags=-fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold" + - UBSAN_OPTIONS='print_stacktrace=1' + name: "x86 C++2a Undefined behavior sanitizer" + os: linux + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + sources: - ubuntu-toolchain-r-test - - llvm-toolchain-trusty-5.0 - - - os: linux - compiler: clang++-5.0 - env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=14,1z - addons: - apt: - packages: - - clang-5.0 - sources: + dist: bionic + env: + - COMMENT=ubsan + - "B2_ADDRESS_MODEL=address-model=64" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=03" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - "COPTS=cxxflags=-fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" + - "LOPTS=linkflags=-fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold" + - UBSAN_OPTIONS='print_stacktrace=1' + name: "x86_64 C++03 Undefined behavior sanitizer" + os: linux + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=ubsan + - "B2_ADDRESS_MODEL=address-model=64" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=11" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - "COPTS=cxxflags=-fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" + - "LOPTS=linkflags=-fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold" + - UBSAN_OPTIONS='print_stacktrace=1' + name: "x86_64 C++11 Undefined behavior sanitizer" + os: linux + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=ubsan + - "B2_ADDRESS_MODEL=address-model=64" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=14" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - "COPTS=cxxflags=-fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" + - "LOPTS=linkflags=-fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold" + - UBSAN_OPTIONS='print_stacktrace=1' + name: "x86_64 C++14 Undefined behavior sanitizer" + os: linux + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + sources: - ubuntu-toolchain-r-test - - llvm-toolchain-trusty-5.0 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03 - osx_image: xcode7.3 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=11 - osx_image: xcode7.3 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=14,1z - osx_image: xcode7.3 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03 - osx_image: xcode8.3 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=11 - osx_image: xcode8.3 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=14,1z - osx_image: xcode8.3 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03 - osx_image: xcode9.4.1 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=11 - osx_image: xcode9.4.1 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=14,1z - osx_image: xcode9.4.1 - - -install: - - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true - - cd .. - - git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root - - cd boost-root - - git submodule update --init tools/boost_install - - git submodule update --init libs/headers - - git submodule update --init tools/build - - git submodule update --init libs/config - - git submodule update --init tools/boostdep - - cp -r $TRAVIS_BUILD_DIR/* libs/graph - - python tools/boostdep/depinst/depinst.py graph - - ./bootstrap.sh - - ./b2 headers - - -script: - - |- - echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam - - IFS=',' - - for CXXLOCAL in $CXXSTD; do (cd libs/config/test && ../../../b2 config_info_travis_install toolset=$TOOLSET cxxstd=$CXXLOCAL && ./config_info_travis && rm ./config_info_travis) done - - unset IFS - - ./b2 -j3 libs/graph/test toolset=$TOOLSET cxxstd=$CXXSTD - -notifications: - email: - on_success: always + dist: bionic + env: + - COMMENT=ubsan + - "B2_ADDRESS_MODEL=address-model=64" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=17" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - "COPTS=cxxflags=-fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" + - "LOPTS=linkflags=-fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold" + - UBSAN_OPTIONS='print_stacktrace=1' + name: "x86_64 C++17 Undefined behavior sanitizer" + os: linux + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=ubsan + - "B2_ADDRESS_MODEL=address-model=64" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=2a" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - "COPTS=cxxflags=-fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all" + - "LOPTS=linkflags=-fsanitize=undefined -fno-sanitize-recover=all -fuse-ld=gold" + - UBSAN_OPTIONS='print_stacktrace=1' + name: "x86_64 C++2a Undefined behavior sanitizer" + os: linux + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - gcc-8-multilib + - g++-8-multilib + - gcc-multilib + - g++-multilib + - valgrind + - libc6-dbg:i386 + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=valgrind + - "B2_ADDRESS_MODEL=address-model=32" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=03" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - B2_TESTFLAGS=testing.launcher=valgrind + - "COPTS=cxxflags=-O2" + - VALGRIND_OPTS=--error-exitcode=1 + name: "x86 C++03 Valgrind" + os: linux + before_install: utility/ci/travis/valgrind.sh + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - gcc-8-multilib + - g++-8-multilib + - gcc-multilib + - g++-multilib + - valgrind + - libc6-dbg:i386 + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=valgrind + - "B2_ADDRESS_MODEL=address-model=32" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=11" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - B2_TESTFLAGS=testing.launcher=valgrind + - "COPTS=cxxflags=-O2" + - VALGRIND_OPTS=--error-exitcode=1 + name: "x86 C++11 Valgrind" + os: linux + before_install: utility/ci/travis/valgrind.sh + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - gcc-8-multilib + - g++-8-multilib + - gcc-multilib + - g++-multilib + - valgrind + - libc6-dbg:i386 + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=valgrind + - "B2_ADDRESS_MODEL=address-model=32" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=14" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - B2_TESTFLAGS=testing.launcher=valgrind + - "COPTS=cxxflags=-O2" + - VALGRIND_OPTS=--error-exitcode=1 + name: "x86 C++14 Valgrind" + os: linux + before_install: utility/ci/travis/valgrind.sh + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - gcc-8-multilib + - g++-8-multilib + - gcc-multilib + - g++-multilib + - valgrind + - libc6-dbg:i386 + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=valgrind + - "B2_ADDRESS_MODEL=address-model=32" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=17" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - B2_TESTFLAGS=testing.launcher=valgrind + - "COPTS=cxxflags=-O2" + - VALGRIND_OPTS=--error-exitcode=1 + name: "x86 C++17 Valgrind" + os: linux + before_install: utility/ci/travis/valgrind.sh + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - gcc-8-multilib + - g++-8-multilib + - gcc-multilib + - g++-multilib + - valgrind + - libc6-dbg:i386 + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=valgrind + - "B2_ADDRESS_MODEL=address-model=32" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=2a" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - B2_TESTFLAGS=testing.launcher=valgrind + - "COPTS=cxxflags=-O2" + - VALGRIND_OPTS=--error-exitcode=1 + name: "x86 C++2a Valgrind" + os: linux + before_install: utility/ci/travis/valgrind.sh + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - valgrind + - libc6-dbg + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=valgrind + - "B2_ADDRESS_MODEL=address-model=64" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=03" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - B2_TESTFLAGS=testing.launcher=valgrind + - "COPTS=cxxflags=-O2" + - VALGRIND_OPTS=--error-exitcode=1 + name: "x86_64 C++03 Valgrind" + os: linux + before_install: utility/ci/travis/valgrind.sh + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - valgrind + - libc6-dbg + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=valgrind + - "B2_ADDRESS_MODEL=address-model=64" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=11" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - B2_TESTFLAGS=testing.launcher=valgrind + - "COPTS=cxxflags=-O2" + - VALGRIND_OPTS=--error-exitcode=1 + name: "x86_64 C++11 Valgrind" + os: linux + before_install: utility/ci/travis/valgrind.sh + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - valgrind + - libc6-dbg + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=valgrind + - "B2_ADDRESS_MODEL=address-model=64" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=14" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - B2_TESTFLAGS=testing.launcher=valgrind + - "COPTS=cxxflags=-O2" + - VALGRIND_OPTS=--error-exitcode=1 + name: "x86_64 C++14 Valgrind" + os: linux + before_install: utility/ci/travis/valgrind.sh + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - valgrind + - libc6-dbg + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=valgrind + - "B2_ADDRESS_MODEL=address-model=64" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=17" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - B2_TESTFLAGS=testing.launcher=valgrind + - "COPTS=cxxflags=-O2" + - VALGRIND_OPTS=--error-exitcode=1 + name: "x86_64 C++17 Valgrind" + os: linux + before_install: utility/ci/travis/valgrind.sh + stage: Dynamic_QC + - + addons: + apt: + packages: + - g++-8 + - valgrind + - libc6-dbg + sources: + - ubuntu-toolchain-r-test + dist: bionic + env: + - COMMENT=valgrind + - "B2_ADDRESS_MODEL=address-model=64" + - B2_VARIANT=variant=debug + - B2_TOOLSET=gcc-8 + - "B2_CXXSTD=cxxstd=2a" + - B2_DEFINES='define=BOOST_NO_STRESS_TEST=1' + - B2_TESTFLAGS=testing.launcher=valgrind + - "COPTS=cxxflags=-O2" + - VALGRIND_OPTS=--error-exitcode=1" + name: "x86_64 C++2a Valgrind" + os: linux + before_install: utility/ci/travis/valgrind.sh + stage: Dynamic_QC + - + dist: bionic + env: + - "COMMENT='Coverity Scan'" + - B2_TOOLSET=clang-6.0 + - "COPTS=cxxflags=-Weverything -Werror -fstack-protector-all -fstack-check-lubsan -fPIC -fsanitize=address -fsanitize=pointer-compare -fsanitize=leak -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -fcf-protection=full -fvtable-verify=std -lasan -llsan -fsanitize=undefined -fsanitize-address-use-after-scope -fvtv-debug" + - "LOPTS=linkflags=-lubsan -fPIC -llsan -lasan" + name: "Coverty" + os: linux + script: utility/ci/coverty/coverage.sh + stage: Dynamic_QC +language: cpp +notifications: + email: false +script: "source utility/ci/travis/build.sh" +stages: + - Static_QC + - Dynamic_QC + - test diff --git a/README.md b/README.md index 7a4dc7355..d63f5f40b 100644 --- a/README.md +++ b/README.md @@ -18,24 +18,24 @@ There is no mailing-list specific to Boost Graph, although you can use the gener ## Development ## -Clone the whole boost project, which includes the individual Boost projects as submodules ([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)): +Clone the whole boost project, which includes the individual Boost projects as submodules ([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)): git clone https://github.com/boostorg/boost cd boost git submodule update --init -The Boost Graph Library is located in `libs/graph/`. +The Boost Graph Library is located in `libs/graph/`. Boost Graph Library is mostly made of headers but also contains some compiled components. Here are the build commands: - - ./bootstrap.sh <- compile b2 + + ./bootstrap.sh <- compile b2 ./b2 headers <- just installs headers ./b2 <- build compiled components **Note:** The Boost Graph Library cannot currently be built outside of Boost itself. ### Running tests ### -First, make sure you are in `libs/graph/test`. +First, make sure you are in `libs/graph/test`. You can either run all the 300+ tests listed in `Jamfile.v2` or run a single test: ../../../b2 <- run all tests diff --git a/doc/AStarHeuristic.html b/doc/AStarHeuristic.html index dbe2132d6..b035a2825 100644 --- a/doc/AStarHeuristic.html +++ b/doc/AStarHeuristic.html @@ -1,17 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
boost::graph_traits<G>::traversal_categoryThis describes the ways in which the vertices and edges of the graph can be visited. The choices are incidence_graph_tag, -adjacency_graph_tag, bidirectional_graph_tag, -vertex_list_graph_tag, edge_list_graph_tag, and +adjacency_graph_tag, bidirectional_graph_tag, +vertex_list_graph_tag, edge_list_graph_tag, and adjacency_matrix_tag.
+
+
+
+
@@ -61,17 +61,17 @@
+
+
+
+
+
+
+
+
-A planar embedding is a refinement of +A planar embedding is a refinement of LValuePropertyMap that places additional restrictions the value_type used in the property map. @@ -36,24 +36,24 @@
| Embedding | +|
| Embedding | is a type that models the Planar Embedding concept. |
| embedding | is an object of type Embedding. |
| Graph | +|
| Graph | is the type of the underlying graph. |
| e | -is an object of type graph_traits<Graph>::edge_descriptor. + |
| e | +is an object of type graph_traits<Graph>::edge_descriptor. |
| + |
| Const Iterator | boost::property_traits<Embedding>::value_type::const_iterator | -The iterator type used to iterate over the ordering of the edges in the + | The iterator type used to iterate over the ordering of the edges in the planar embedding of a particular vertex |
| Expression | Return Type | Description | -|
|---|---|---|---|
| embedding[v].begin() | boost::property_traits<Embedding>::value_type::const_iterator | -Returns an iterator to the beginning of the range of edges in the + | Returns an iterator to the beginning of the range of edges in the embedding around vertex v |
| embedding[v].end() | boost::property_traits<Embedding>::value_type::const_iterator | -Returns an iterator to the end of the range of edges in the + | Returns an iterator to the end of the range of edges in the embedding around vertex v |
| embedding[v].clear() | void | Clears all edges in the embedding around a vertex v | |
| embedding[v].push_back(e) | void | -Adds an edge e to the end of the sequence of embedded edges + | Adds an edge e to the end of the sequence of embedded edges around the vertex v | vis.begin_face() | void | -This is invoked once for each face, before any vertices or edges on the face -are visited. +This is invoked once for each face, before any vertices or edges on the face +are visited. | @@ -108,7 +108,7 @@vis.end_face() | void | -This is invoked once for each face, after all vertices and edges on the face +This is invoked once for each face, after all vertices and edges on the face are visited. | @@ -129,13 +129,13 @@boost::property_map<G, PropertyTag>::typeThe type of the property map for the property specified by PropertyTag. This type must be a model of ReadWritePropertyMap +href="../../property_map/doc/ReadWritePropertyMap.html">ReadWritePropertyMap with a key type the same as the graph's vertex or edge descriptor type. |
@@ -207,4 +207,4 @@
+
+
@@ -59,14 +59,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
-adjacency_matrix<Directed, VertexProperty,
+adjacency_matrix<Directed, VertexProperty,
EdgeProperty, GraphProperty,
Allocator>
@@ -61,7 +61,7 @@
enum { A, B, C, D, E, F, N };
const char* name = "ABCDEF";
-
+
typedef boost::adjacency_matrix<boost::directedS> Graph;
Graph g(N);
add_edge(B, C, g);
@@ -112,17 +112,17 @@ Example
The output is:
- vertex set: A B C D E F + vertex set: A B C D E F - edge set: (B,C) (B,F) (C,A) (C,C) (D,E) (E,D) (F,A) + edge set: (B,C) (B,F) (C,A) (C,C) (D,E) (E,D) (F,A) - out-edges: - A --> - B --> C F - C --> A C - D --> E - E --> D - F --> A + out-edges: + A --> + B --> C F + C --> A C + D --> E + E --> D + F --> ACreating the graph of Figure 2. @@ -152,17 +152,17 @@
- vertex set: A B C D E F + vertex set: A B C D E F - edge set: (C,A) (C,B) (E,D) (F,A) (F,B) + edge set: (C,A) (C,B) (E,D) (F,A) (F,B) - incident edges: - A <--> C F - B <--> C F - C <--> A B - D <--> E - E <--> D - F <--> A B + incident edges: + A <--> C F + B <--> C F + C <--> A B + D <--> E + E <--> D + F <--> A B@@ -205,7 +205,7 @@
+
+
+
+
The graph object on which the algorithm will be applied for astar_search_no_init(). The type - IncidenceGraph must be a model of the + IncidenceGraph must be a model of the Incidence Graph concept.@@ -586,4 +586,4 @@
+
+
+
+
+
+
// named paramter version template <class EdgeListGraph, class Size, class P, class T, class R> -bool bellman_ford_shortest_paths(const EdgeListGraph& g, Size N, +bool bellman_ford_shortest_paths(const EdgeListGraph& g, Size N, const bgl_named_params<P, T, R>& params = all defaults); template <class VertexAndEdgeListGraph, class P, class T, class R> @@ -36,8 +36,8 @@@@ -51,7 +51,7 @@
class PredecessorMap, class DistanceMap, class BinaryFunction, class BinaryPredicate, class BellmanFordVisitor> -bool bellman_ford_shortest_paths(EdgeListGraph& g, Size N, - WeightMap weight, PredecessorMap pred, DistanceMap distance, +bool bellman_ford_shortest_paths(EdgeListGraph& g, Size N, + WeightMap weight, PredecessorMap pred, DistanceMap distance, BinaryFunction combine, BinaryPredicate compare, BellmanFordVisitor v)
edge weights. For the definition of the shortest paths problem see
Section Shortest-Paths
-Algorithms.
+Algorithms.
If you only need to solve the shortest paths problem for positive edge
weights, Dijkstra's algorithm provides a more efficient
alternative. If all the edge weights are all equal to one then breadth-first
@@ -77,7 +77,7 @@
RELAX(u, v, w, d, p)
- if (w(u,v) + d[u] < d[v])
+ if (w(u,v) + d[u] < d[v])
d[v] := w(u,v) + d[u]
p[v] := u
else
@@ -91,7 +91,7 @@
relax edge (u,v)
-edge (u,v) is not relaxed
+edge (u,v) is not relaxed
BELLMAN-FORD(G)
// Optional initialization
- for each vertex u in V
+ for each vertex u in V
d[u] := infinity
- p[u] := u
+ p[u] := u
end for
- for i := 1 to |V|-1
- for each edge (u,v) in E
+ for i := 1 to |V|-1
+ for each edge (u,v) in E
RELAX(u, v, w, d, p)
end for
end for
- for each edge (u,v) in E
+ for each edge (u,v) in E
if (w(u,v) + d[u] < d[v])
return (false, , )
- else
+ else
...
end for
return (true, p, d)
@@ -148,9 +148,9 @@
-edge (u,v) was not minimized
+edge (u,v) was not minimized
-edge (u,v) was minimized
+edge (u,v) was minimized
@@ -175,7 +175,7 @@
A directed or undirected graph whose type must be a model of Edge List Graph. If a root vertex is @@ -211,7 +211,7 @@-OUT: predecessor_map(PredecessorMap p_map) +OUT: predecessor_map(PredecessorMap p_map)Named Parameters
Python default: graph.get_edge_double_map("weight")
The predecessor map records the edges in the minimum spanning tree. Upon completion of the algorithm, the edges (p[u],u) @@ -227,7 +227,7 @@-IN/OUT: distance_map(DistanceMap d) +IN/OUT: distance_map(DistanceMap d)Named Parameters
Python: Must be a vertex_vertex_map for the graph.
The shortest path weight from the source vertex to each vertex in the graph g is recorded in this property map. The type @@ -307,11 +307,11 @@Visitor Event Points
- vis.examine_edge(e, g) is invoked on every edge in the graph |V| times.
- vis.edge_relaxed(e, g) is invoked when the distance - label for the target vertex is decreased. The edge (u,v) that + label for the target vertex is decreased. The edge (u,v) that participated in the last relaxation for vertex v is an edge in the - shortest paths tree. + shortest paths tree.
- vis.edge_not_relaxed(e, g) is invoked if the distance label - for the target vertex is not decreased. + for the target vertex is not decreased.
- vis.edge_minimized(e, g) is invoked during the second stage of the algorithm, during the test of whether each edge was minimized. If the edge is minimized then this function @@ -330,7 +330,7 @@
Example
Notes
-[1] +
[1] Since the visitor parameter is passed by value, if your visitor contains state then any changes to the state during the algorithm will be made to a copy of the visitor object, not the visitor object @@ -346,4 +346,4 @@
Notes
- + diff --git a/doc/bellman_visitor.html b/doc/bellman_visitor.html index 6fea8425c..5912b1ff4 100644 --- a/doc/bellman_visitor.html +++ b/doc/bellman_visitor.html @@ -1,17 +1,17 @@Boost Graph Library: bellman_visitor - -+ +
![]()
@@ -108,4 +108,4 @@See Also
- + diff --git a/doc/betweenness_centrality.html b/doc/betweenness_centrality.html index efa1095e0..0932eb21f 100644 --- a/doc/betweenness_centrality.html +++ b/doc/betweenness_centrality.html @@ -2,7 +2,7 @@Boost Graph Library: bfs_visitor - -+ +
![]()
@@ -38,10 +38,10 @@Example
// Construct graph G and obtain the source vertex s ... - boost::breadth_first_search(G, s, + boost::breadth_first_search(G, s, boost::make_bfs_visitor( std::make_pair(boost::record_distances(d, boost::on_tree_edge()), - std::make_pair(boost::record_predecessors(p.begin(), + std::make_pair(boost::record_predecessors(p.begin(), boost::on_tree_edge()), copy_graph(G_copy, boost::on_examine_edge())))) );@@ -125,4 +125,4 @@See Also
- + diff --git a/doc/bgl_named_params.html b/doc/bgl_named_params.html index 58d8459b3..e0da11699 100644 --- a/doc/bgl_named_params.html +++ b/doc/bgl_named_params.html @@ -1,17 +1,17 @@Boost Graph Library: Named Parameters - -+ +
![]()
@@ -38,7 +38,7 @@he or she has to resort to providing all the parameters.
- Since the list of parameters is long, it is easy to forget - the ordering. + the ordering.
@@ -54,7 +54,7 @@
- bool r = boost::bellman_ford_shortest_paths(g, int(N),
+ bool r = boost::bellman_ford_shortest_paths(g, int(N),
boost::weight_map(weight).
distance_map(&distance[0]).
predecessor_map(&parent[0]));
@@ -66,7 +66,7 @@
the one above.
- bool r = boost::bellman_ford_shortest_paths(g, int(N),
+ bool r = boost::bellman_ford_shortest_paths(g, int(N),
boost::predecessor_map(&parent[0]).
distance_map(&distance[0]).
weight_map(weight));
diff --git a/doc/bibliography.html b/doc/bibliography.html
index 4e59de852..b541abf62 100644
--- a/doc/bibliography.html
+++ b/doc/bibliography.html
@@ -1,17 +1,17 @@
Boost Graph Library: Bibliography
-
-
+
+
@@ -264,7 +264,7 @@ Bibliography
42
David Eppstein, Zvi Galil, and Giuseppe F. Italiano
Dynamic Graph Algorithms.
-Chapter 22, CRC Handbook of Algorithms and Theory of Computation, 1997.
+Chapter 22, CRC Handbook of Algorithms and Theory of Computation, 1997.
43
E. Cuthill and J. McKee
@@ -330,7 +330,7 @@ Bibliography
54
Ulrik Brandes
-A
+A
Faster Algorithm for Betweenness Centrality
Journal of Mathematical Sociology 25 (2):163-177, 2001.
@@ -347,7 +347,7 @@ Bibliography
57
T. Kamada and S. Kawai
An algorithm for drawing general undirected graphs.
-Information Processing Letters, 31, pp. 7-15, 1989.
+Information Processing Letters, 31, pp. 7-15, 1989.
58
T. Fruchterman and E. Reingold
@@ -454,7 +454,7 @@ Bibliography
Proceedings of the First Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 434-443, 1990.
-
+
@@ -464,4 +464,4 @@ Bibliography
-
+
diff --git a/doc/biconnected_components.html b/doc/biconnected_components.html
index 298b70089..894e984cc 100644
--- a/doc/biconnected_components.html
+++ b/doc/biconnected_components.html
@@ -1,21 +1,21 @@
Boost Graph Library: Biconnected Components and Articulation Points
-
-
+
+
@@ -25,7 +25,7 @@
biconnected_components
-and
+and
articulation_points
@@ -34,25 +34,25 @@
template <typename Graph, typename ComponentMap, typename OutputIterator,
typename P, typename T, typename R>
std::pair<std::size_t, OutputIterator>
-biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out,
+biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out,
const bgl_named_params<P, T, R>& params)
template <typename Graph, typename ComponentMap,
typename P, typename T, typename R>
std::size_t
-biconnected_components(const Graph& g, ComponentMap comp,
+biconnected_components(const Graph& g, ComponentMap comp,
const bgl_named_params<P, T, R>& params)
-template <typename Graph, typename OutputIterator,
+template <typename Graph, typename OutputIterator,
typename P, typename T, typename R>
-OutputIterator articulation_points(const Graph& g, OutputIterator out,
+OutputIterator articulation_points(const Graph& g, OutputIterator out,
const bgl_named_params<P, T, R>& params)
// non-named parameter version
template <typename Graph, typename ComponentMap, typename OutputIterator,
typename DiscoverTimeMap, typename LowPointMap>
std::pair<std::size_t, OutputIterator>
-biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out,
+biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out,
DiscoverTimeMap discover_time, LowPointMap lowpt);
template <typename Graph, typename ComponentMap, typename OutputIterator>
@@ -142,10 +142,10 @@ Parameters
Named Parameters
-IN: vertex_index_map(VertexIndexMap i_map)
+IN: vertex_index_map(VertexIndexMap i_map)
This maps each vertex to an integer in the range [0,
- num_vertices(g)). The type
+ num_vertices(g)). The type
VertexIndexMap must be a model of
Readable Property Map. The value type of the map must be an
integer type. The vertex descriptor type of the graph needs to be
@@ -192,9 +192,9 @@ Named Parameters
Python: Unsupported parameter.
-UTIL/OUT: predecessor_map(PredecessorMap p_map)
+UTIL/OUT: predecessor_map(PredecessorMap p_map)
- The predecessor map records the depth first search tree.
+ The predecessor map records the depth first search tree.
The PredecessorMap type
must be a Read/Write
@@ -241,7 +241,7 @@ Example
Notes
-[1]
+
[1]
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
@@ -260,4 +260,4 @@
Notes
-
+
diff --git a/doc/biconnected_components.w b/doc/biconnected_components.w
index d2eb21ffd..df6c3c2b3 100644
--- a/doc/biconnected_components.w
+++ b/doc/biconnected_components.w
@@ -5,7 +5,7 @@
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
-\usepackage{latexsym}
+\usepackage{latexsym}
\usepackage{jweb}
\usepackage{times}
\usepackage{graphicx}
@@ -358,7 +358,7 @@ int main()
-% \paragraph{Definition.} A \emph{palm tree} $P$ is a directed graph that
+% \paragraph{Definition.} A \emph{palm tree} $P$ is a directed graph that
% consists of two disjoint sets of edges, denoted by $v \rightarrow w$
% and $v \backedge w$ respectively, with the following properties:
diff --git a/doc/boyer_myrvold.html b/doc/boyer_myrvold.html
index a2792a30c..df4574f7c 100644
--- a/doc/boyer_myrvold.html
+++ b/doc/boyer_myrvold.html
@@ -1,39 +1,39 @@
Boost Graph Library: Boyer-Myrvold Planarity Testing/Embedding
-
-
+
+
Boyer-Myrvold Planarity Testing/Embedding
-A graph is planar if it can
-be drawn in two-dimensional space without any of its edges crossing. Such a
-drawing of a planar graph is called a
-plane drawing. Each
+A graph is planar if it can
+be drawn in two-dimensional space without any of its edges crossing. Such a
+drawing of a planar graph is called a
+plane drawing. Each
plane drawing belongs to an equivalence class called a planar embedding
-[1] that is defined by the clockwise ordering of adjacent
-edges around each vertex in the graph. A planar embedding is a convenient
-intermediate representation of an actual drawing of a planar graph, and many
-planar graph drawing algorithms are formulated as functions mapping a planar
+[1] that is defined by the clockwise ordering of adjacent
+edges around each vertex in the graph. A planar embedding is a convenient
+intermediate representation of an actual drawing of a planar graph, and many
+planar graph drawing algorithms are formulated as functions mapping a planar
embedding to a plane drawing.
-A planar graph (top left), along with a planar
-embedding of that graph (bottom left) can be used to create a plane drawing
-(right) by embedding edges around each vertex in the order in which they
+A planar graph (top left), along with a planar
+embedding of that graph (bottom left) can be used to create a plane drawing
+(right) by embedding edges around each vertex in the order in which they
appear in the planar embedding.
@@ -44,16 +44,16 @@ Boyer-Myrvold Planarity Testing/Embedding
-The function boyer_myrvold_planarity_test implements the planarity
-testing/embedding algorithm of Boyer and Myrvold
+The function boyer_myrvold_planarity_test implements the planarity
+testing/embedding algorithm of Boyer and Myrvold
[70].
-boyer_myrvold_planarity_test returns true if the input graph
+boyer_myrvold_planarity_test returns true if the input graph
is planar and false otherwise. As a side-effect of this test, a planar
-embedding can be constructed if the graph is planar or a minimal set of edges
-that form a Kuratowski
+embedding can be constructed if the graph is planar or a minimal set of edges
+that form a Kuratowski
subgraph can be found if the graph is not planar.
-boyer_myrvold_planarity_test uses named parameter arguments (courtesy
-of the Boost.Parameter
+boyer_myrvold_planarity_test uses named parameter arguments (courtesy
+of the Boost.Parameter
library) to specify what the function actually does. Some examples are:
@@ -65,8 +65,8 @@ Boyer-Myrvold Planarity Testing/Embedding
- Computing a planar embedding for a graph if it is planar, otherwise finding
a set of edges that forms an obstructing Kuratowski subgraph:
-if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g,
- boyer_myrvold_params::embedding = embedding_pmap,
+if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g,
+ boyer_myrvold_params::embedding = embedding_pmap,
boyer_myrvold_params::kuratowski_subgraph = out_itr
)
)
@@ -81,81 +81,81 @@ Boyer-Myrvold Planarity Testing/Embedding
-The parameters passed to boyer_myrvold_planarity_test in the examples
-above do more than just carry the data structures used for input and output -
-the algorithm is optimized at compile time based on which parameters are
-present. A complete list of parameters accepted and their interactions are
-described below.
+The parameters passed to boyer_myrvold_planarity_test in the examples
+above do more than just carry the data structures used for input and output -
+the algorithm is optimized at compile time based on which parameters are
+present. A complete list of parameters accepted and their interactions are
+described below.
boyer_myrvold_planarity_test accepts as input any undirected graph,
even those with self-loops and multiple edges.
-However, many planar graph drawing algorithms make additional restrictions
-on the structure of the input graph - for example, requiring that the input
+However, many planar graph drawing algorithms make additional restrictions
+on the structure of the input graph - for example, requiring that the input
graph is connected, biconnected, or even maximal planar (triangulated.)
-Fortunately, any planar graph on n vertices that lacks one of these
-properties can be augmented with additional edges so that it satisfies that
-property in O(n) time - the functions
+Fortunately, any planar graph on n vertices that lacks one of these
+properties can be augmented with additional edges so that it satisfies that
+property in O(n) time - the functions
make_connected,
-make_biconnected_planar,
-and make_maximal_planar
-exist for this purpose. If the graph drawing algorithm you're using requires,
-say, a biconnected graph, then you must make your input graph biconnected
+make_biconnected_planar,
+and make_maximal_planar
+exist for this purpose. If the graph drawing algorithm you're using requires,
+say, a biconnected graph, then you must make your input graph biconnected
before passing it into boyer_myrvold_planarity_test so that the
-computed planar embedding includes these additional edges. This may require
-more than one call to boyer_myrvold_planarity_test depending on the
-structure of the graph you begin with, since both
-make_biconnected_planar and make_maximal_planar require a
+computed planar embedding includes these additional edges. This may require
+more than one call to boyer_myrvold_planarity_test depending on the
+structure of the graph you begin with, since both
+make_biconnected_planar and make_maximal_planar require a
planar embedding of the existing graph as an input parameter.
The named parameters accepted by boyer_myrvold_planarity_test are:
-- graph : The input graph - this is the only required
+
- graph : The input graph - this is the only required
parameter.
-
- vertex_index_map : A mapping from vertices of the input
-graph to indexes in the range [0..num_vertices(g)). If this parameter
+
- vertex_index_map : A mapping from vertices of the input
+graph to indexes in the range [0..num_vertices(g)). If this parameter
is not provided, the vertex index map is assumed to be available as an interior
property of the graph, accessible by calling get(vertex_index, g).
- edge_index_map: A mapping from the edges of the input graph
-to indexes in the range [0..num_edges(g)). This parameter is only
-needed if the kuratowski_subgraph argument is provided. If the
+to indexes in the range [0..num_edges(g)). This parameter is only
+needed if the kuratowski_subgraph argument is provided. If the
kuratowski_subgraph argument is provided and this parameter is not
-provided, the EdgeIndexMap is assumed to be available as an interior property
+provided, the EdgeIndexMap is assumed to be available as an interior property
accessible by calling get(edge_index, g).
-
- embedding : If the graph is planar, this will be populated
-with a mapping from vertices to the clockwise order of neighbors in the planar
+
- embedding : If the graph is planar, this will be populated
+with a mapping from vertices to the clockwise order of neighbors in the planar
embedding.
- kuratowski_subgraph : If the graph is not planar, a minimal
-set of edges that form the obstructing Kuratowski subgraph will be written to
+set of edges that form the obstructing Kuratowski subgraph will be written to
this iterator.
-These named parameters all belong to the namespace
-boyer_myrvold_params. See below for more information on the concepts
-required for these arguments.
+These named parameters all belong to the namespace
+boyer_myrvold_params. See below for more information on the concepts
+required for these arguments.
Verifying the output
Whether or not the input graph is planar, boyer_myrvold_planarity_test
-can produce a certificate that can be automatically checked to verify that the
-function is working properly.
+can produce a certificate that can be automatically checked to verify that the
+function is working properly.
If the graph is planar, a planar embedding can be produced. The
-planar embedding can be verified by passing it to a plane drawing routine
+planar embedding can be verified by passing it to a plane drawing routine
(such as
-chrobak_payne_straight_line_drawing) and using the function
-is_straight_line_drawing
+chrobak_payne_straight_line_drawing
) and using the function
+is_straight_line_drawing
to verify that the resulting graph is planar.
-If the graph is not planar, a set of edges that forms a Kuratowski subgraph in
-the original graph can be produced. This set of edges can be passed to the
+If the graph is not planar, a set of edges that forms a Kuratowski subgraph in
+the original graph can be produced. This set of edges can be passed to the
function is_kuratowski_subgraph
- to verify that they can be contracted into a K5 or
-K3,3. boyer_myrvold_planarity_test chooses the set
-of edges forming the Kuratowski subgraph in such a way that the contraction to
-a K5 or K3,3 can be done by a simple
-deterministic process which is described in the documentation to
+ to verify that they can be contracted into a K5 or
+K3,3. boyer_myrvold_planarity_test chooses the set
+of edges forming the Kuratowski subgraph in such a way that the contraction to
+a K5 or K3,3 can be done by a simple
+deterministic process which is described in the documentation to
is_kuratowski_subgraph.
Where Defined
@@ -170,8 +170,8 @@ Parameters
IN: Graph& g
-Any undirected graph. The graph type must be a model of
-VertexAndEdgeListGraph and
+Any undirected graph. The graph type must be a model of
+VertexAndEdgeListGraph and
IncidenceGraph.
@@ -184,7 +184,7 @@ Parameters
IN OutputIterator kuratowski_subgraph
-An OutputIterator which accepts values of the type
+An OutputIterator which accepts values of the type
graph_traits<Graph>::edge_descriptor
@@ -192,7 +192,7 @@ Parameters
A Readable Property Map
- that maps vertices from g to distinct integers in the range
+ that maps vertices from g to distinct integers in the range
[0, num_vertices(g) )
Default: get(vertex_index,g)
@@ -201,21 +201,21 @@ Parameters
A Readable Property Map
- that maps edges from g to distinct integers in the range
+ that maps edges from g to distinct integers in the range
[0, num_edges(g) )
-Default: get(edge_index,g), but this parameter is only used if
+Default: get(edge_index,g), but this parameter is only used if
the kuratowski_subgraph_iterator is provided.
Complexity
-Assuming that both the vertex index and edge index supplied take time
-O(1) to return an index and there are O(n)
-total self-loops and parallel edges in the graph, most combinations of
-arguments given to
-boyer_myrvold_planarity_test result in an algorithm that runs in time
-O(n) for a graph with n vertices and m edges. The only
-exception is when Kuratowski subgraph isolation is requested for a dense graph
+Assuming that both the vertex index and edge index supplied take time
+O(1) to return an index and there are O(n)
+total self-loops and parallel edges in the graph, most combinations of
+arguments given to
+boyer_myrvold_planarity_test result in an algorithm that runs in time
+O(n) for a graph with n vertices and m edges. The only
+exception is when Kuratowski subgraph isolation is requested for a dense graph
(a graph with n = o(m)) - the running time will be O(n+m)
[2].
@@ -224,9 +224,9 @@ Examples
- A simple planarity test
-
- Isolating a Kuratowski
+
- Isolating a Kuratowski
Subgraph
-
- Using a planar embedding to
+
- Using a planar embedding to
create a straight line drawing
@@ -237,17 +237,17 @@ See Also
Notes
-[1] A planar embedding is also called a combinatorial
+[1] A planar embedding is also called a combinatorial
embedding.
-[2] The algorithm can still be made to run in time O(n)
-for this case, if needed. Euler's
+[2] The algorithm can still be made to run in time O(n)
+for this case, if needed. Euler's
formula implies that a planar graph with n vertices can have no more
-than 3n - 6 edges, which means that any non-planar graph on n
-vertices has a subgraph of only 3n - 5 edges that contains a Kuratowski
-subgraph. So, if you need to find a Kuratowski subgraph of a graph with more
-than 3n - 5 edges in time O(n), you can create a subgraph of the
-original graph consisting of any arbitrary 3n - 5 edges and pass that
+than 3n - 6 edges, which means that any non-planar graph on n
+vertices has a subgraph of only 3n - 5 edges that contains a Kuratowski
+subgraph. So, if you need to find a Kuratowski subgraph of a graph with more
+than 3n - 5 edges in time O(n), you can create a subgraph of the
+original graph consisting of any arbitrary 3n - 5 edges and pass that
graph to boyer_myrvold_planarity_test.
@@ -256,4 +256,4 @@
Notes
Copyright © 2007 Aaron Windsor (
aaron.windsor@gmail.com)
-
+
diff --git a/doc/breadth_first_search.html b/doc/breadth_first_search.html
index 000c13a5a..0608fc9ba 100644
--- a/doc/breadth_first_search.html
+++ b/doc/breadth_first_search.html
@@ -1,17 +1,17 @@
Boost Graph Library: Breadth-First Search
-
-
+
+
@@ -24,15 +24,15 @@
// named parameter version
template <class Graph, class P, class T, class R>
-void breadth_first_search(Graph& G,
- typename graph_traits<Graph>::vertex_descriptor s,
+void breadth_first_search(Graph& G,
+ typename graph_traits<Graph>::vertex_descriptor s,
const bgl_named_params<P, T, R>& params);
// non-named parameter version
-template <class Graph, class Buffer, class BFSVisitor,
+template <class Graph, class Buffer, class BFSVisitor,
class ColorMap>
-void breadth_first_search(const Graph& g,
- typename graph_traits<Graph>::vertex_descriptor s,
+void breadth_first_search(const Graph& g,
+ typename graph_traits<Graph>::vertex_descriptor s,
Buffer& Q, BFSVisitor vis, ColorMap color);
@@ -70,25 +70,25 @@
BFS(G, s)
for each vertex u in V[G]
- color[u] := WHITE
- d[u] := infinity
- p[u] := u
+ color[u] := WHITE
+ d[u] := infinity
+ p[u] := u
end for
- color[s] := GRAY
- d[s] := 0
+ color[s] := GRAY
+ d[s] := 0
ENQUEUE(Q, s)
- while (Q != Ø)
+ while (Q != Ø)
u := DEQUEUE(Q)
for each vertex v in Adj[u]
if (color[v] = WHITE)
- color[v] := GRAY
- d[v] := d[u] + 1
- p[v] := u
+ color[v] := GRAY
+ d[v] := d[u] + 1
+ p[v] := u
ENQUEUE(Q, v)
else
- if (color[v] = GRAY)
+ if (color[v] = GRAY)
...
- else
+ else
...
end for
color[u] := BLACK
@@ -99,29 +99,29 @@
-initialize vertex u
+initialize vertex u
-discover vertex s
+discover vertex s
-examine vertex u
+examine vertex u
examine edge (u,v)
-(u,v) is a tree edge
+(u,v) is a tree edge
-discover vertex v
+discover vertex v
(u,v) is a non-tree edge
-(u,v) has a gray target
+(u,v) has a gray target
-(u,v) has a black target
+(u,v) has a black target
-finish vertex u
+finish vertex u
@@ -244,7 +244,7 @@ Named Parameters
Python: The buffer must derive from the Buffer type for the graph.
-
+
@@ -252,7 +252,7 @@
-The time complexity is O(E + V).
+The time complexity is O(E + V).
@@ -260,13 +260,13 @@
Visitor Event Points
- vis.initialize_vertex(v, g) is invoked on every vertex
- before the start of the search.
+ before the start of the search.
- vis.examine_vertex(u, g)r is invoked in each
vertex as it is removed from the queue.
- vis.examine_edge(e, g) is invoked on every out-edge
- of each vertex immediately after the vertex is removed from the queue.
+ of each vertex immediately after the vertex is removed from the queue.
- vis.tree_edge(e, g) is invoked (in addition to
examine_edge()) if the edge is a tree edge. The
@@ -275,20 +275,20 @@
Visitor Event Points
- vis.discover_vertex(u, g) is invoked the first time the
algorithm encounters vertex u. All vertices closer to the
source vertex have been discovered, and vertices further from the
- source have not yet been discovered.
+ source have not yet been discovered.
- vis.non_tree_edge(e, g) is invoked (in addition to
- examine_edge()) if the edge is not a tree edge.
+ examine_edge()) if the edge is not a tree edge.
- vis.gray_target(e, g) is invoked (in addition to
non_tree_edge()) if the target vertex is colored gray at the
time of examination. The color gray indicates that
- the vertex is currently in the queue.
+ the vertex is currently in the queue.
- vis.black_target(e, g) is invoked (in addition to
non_tree_edge()) if the target vertex is colored black at the
time of examination. The color black indicates that the
- vertex is no longer in the queue.
+ vertex is no longer in the queue.
- vis.finish_vertex(u, g) is invoked after all of the out
edges of u have been examined and all of the adjacent vertices
@@ -319,7 +319,7 @@
See Also
Notes
-[1]
+
[1]
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
@@ -335,4 +335,4 @@
Notes
-
+
diff --git a/doc/breadth_first_visit.html b/doc/breadth_first_visit.html
index 96bfc3a31..e3feaa92d 100644
--- a/doc/breadth_first_visit.html
+++ b/doc/breadth_first_visit.html
@@ -1,17 +1,17 @@
Boost Graph Library: Breadth-First Visit
-
-
+
+
@@ -22,14 +22,14 @@
template <class IncidenceGraph, class P, class T, class R>
- void breadth_first_visit(IncidenceGraph& G,
- typename graph_traits<IncidenceGraph>::vertex_descriptor s,
+ void breadth_first_visit(IncidenceGraph& G,
+ typename graph_traits<IncidenceGraph>::vertex_descriptor s,
const bgl_named_params<P, T, R>& params);
template <class IncidenceGraph, class Buffer, class BFSVisitor, class ColorMap>
void breadth_first_visit
- (const IncidenceGraph& g,
- typename graph_traits<IncidenceGraph>::vertex_descriptor s,
+ (const IncidenceGraph& g,
+ typename graph_traits<IncidenceGraph>::vertex_descriptor s,
Buffer& Q, BFSVisitor vis, ColorMap color)
@@ -110,7 +110,7 @@ Named Parameters
Python: The buffer must derive from the Buffer type for the graph.
-
+
@@ -118,7 +118,7 @@
-The time complexity is O(E).
+The time complexity is O(E).
@@ -129,7 +129,7 @@
Visitor Event Points
vertex as it is removed from the queue.
vis.examine_edge(e, g) is invoked on every out-edge
- of each vertex immediately after the vertex is removed from the queue.
+ of each vertex immediately after the vertex is removed from the queue.
vis.tree_edge(e, g) is invoked (in addition to
examine_edge()) if the edge is a tree edge. The
@@ -138,20 +138,20 @@ Visitor Event Points
vis.discover_vertex(u, g) is invoked the first time the
algorithm encounters vertex u. All vertices closer to the
source vertex have been discovered, and vertices further from the
- source have not yet been discovered.
+ source have not yet been discovered.
vis.non_tree_edge(e, g) is invoked (in addition to
- examine_edge()) if the edge is not a tree edge.
+ examine_edge()) if the edge is not a tree edge.
vis.gray_target(e, g) is invoked (in addition to
non_tree_edge()) if the target vertex is colored gray at the
time of examination. The color gray indicates that
- the vertex is currently in the queue.
+ the vertex is currently in the queue.
vis.black_target(e, g) is invoked (in addition to
non_tree_edge()) if the target vertex is colored black at the
time of examination. The color black indicates that the
- vertex is no longer in the queue.
+ vertex is no longer in the queue.
vis.finish_vertex(u, g) is invoked after all of the out
edges of u have been examined and all of the adjacent vertices
@@ -167,7 +167,7 @@ See Also
Notes
-[1]
+
[1]
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
@@ -183,4 +183,4 @@
Notes
-
+
diff --git a/doc/challenge.html b/doc/challenge.html
index 89a34dec6..ba43bf656 100644
--- a/doc/challenge.html
+++ b/doc/challenge.html
@@ -1,17 +1,17 @@
Challenge
-
-
+
+
@@ -43,12 +43,12 @@ Boost Graph Library Challenge and To-Do Items
Construct a set of planar graph algorithms.
- Is the graph planar?
- - "Walk around the block" and similar open and closed neighborhood
-traversals. Note that edge traversals need to resolve to particular ends
+
- "Walk around the block" and similar open and closed neighborhood
+traversals. Note that edge traversals need to resolve to particular ends
and sides (see below), not just to the edge as a whole.
- - Given a point, find the nearest vertex, edge, or bounded polygon.
+
- Given a point, find the nearest vertex, edge, or bounded polygon.
Again, edges are viewed as having left and right sides.
- - Given a line segment, find intersecting vertices, edges, or bounded
+
- Given a line segment, find intersecting vertices, edges, or bounded
polygons.
- Given a polygon, find intersecting whatever...
- Various minimum bounding rectangle and clipping problems.
@@ -117,4 +117,4 @@ Boost Graph Library Challenge and To-Do Items
-
+
diff --git a/doc/circle_layout.html b/doc/circle_layout.html
index e1b539352..57f91cb9c 100644
--- a/doc/circle_layout.html
+++ b/doc/circle_layout.html
@@ -1,14 +1,14 @@
Function template circle_graph_layout 
Home Libraries People FAQ More
Function template circle_graph_layout
boost::circle_graph_layout — Layout the graph with the vertices at the points of a regular n-polygon.
Synopsis
-template<typename VertexListGraph, typename PositionMap, typename Radius>
- void circle_graph_layout(const VertexListGraph & g, PositionMap position,
- Radius radius);
Where Defined
boost/graph/circle_layout.hppDescription
The distance from the center of the polygon to each point is determined by the radius parameter. The position parameter must be an Lvalue Property Map whose value type is a class type containing x and y members that will be set to the x and y coordinates.
+template<typename VertexListGraph, typename PositionMap, typename Radius>
+ void circle_graph_layout(const VertexListGraph & g, PositionMap position,
+ Radius radius);
Where Defined
boost/graph/circle_layout.hppDescription
The distance from the center of the polygon to each point is determined by the radius parameter. The position parameter must be an Lvalue Property Map whose value type is a class type containing x and y members that will be set to the x and y coordinates.
Parameters
IN: const VertexListGraph& g
diff --git a/doc/compressed_sparse_row.html b/doc/compressed_sparse_row.html
index 9519f9b0c..37ff84930 100644
--- a/doc/compressed_sparse_row.html
+++ b/doc/compressed_sparse_row.html
@@ -2,7 +2,7 @@
Boost Graph Library: Connected Components
-
-
+
+
@@ -154,4 +154,4 @@ Example
-
+
diff --git a/doc/constructing_algorithms.html b/doc/constructing_algorithms.html
index a7b7f4ca4..d173ae197 100644
--- a/doc/constructing_algorithms.html
+++ b/doc/constructing_algorithms.html
@@ -1,17 +1,17 @@
Boost Graph Library: Constructing Graph Algorithms
-
-
+
+
@@ -113,7 +113,7 @@ Constructing graph algorithms with BGL
namespace boost {
template <class VertexListGraph, class Order, class Color>
typename graph_traits<VertexListGraph>::vertices_size_type
- sequential_vertex_color_ting(const VertexListGraph& G,
+ sequential_vertex_color_ting(const VertexListGraph& G,
Order order, Color color)
{
typedef graph_traits<VertexListGraph> GraphTraits;
@@ -127,27 +127,27 @@ Constructing graph algorithms with BGL
BOOST_CONCEPT_ASSERT(( IntegerConcept<ColorType> ));
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<Order, size_type> ));
BOOST_STATIC_ASSERT((is_same<OrderType, vertex_descriptor>::value));
-
+
size_type max_color = 0;
const size_type V = num_vertices(G);
- std::vector<size_type>
+ std::vector<size_type>
mark(V, numeric_limits_max(max_color));
-
+
typename GraphTraits::vertex_iterator v, vend;
for (boost::tie(v, vend) = vertices(G); v != vend; ++v)
color[*v] = V - 1; // which means "not colored"
-
+
for (size_type i = 0; i < V; i++) {
vertex_descriptor current = order[i];
// mark all the colors of the adjacent vertices
typename GraphTraits::adjacency_iterator ai, aend;
for (boost::tie(ai, aend) = adjacent_vertices(current, G); ai != aend; ++ai)
- mark[color[*ai]] = i;
+ mark[color[*ai]] = i;
// find the smallest color unused by the adjacent vertices
size_type smallest_color = 0;
- while (smallest_color < max_color && mark[smallest_color] == i)
+ while (smallest_color < max_color && mark[smallest_color] == i)
++smallest_color;
// if all the colors are used up, increase the number of colors
@@ -180,4 +180,4 @@ Constructing graph algorithms with BGL
-
+
diff --git a/doc/copy_graph.html b/doc/copy_graph.html
index 590429a04..76483bb4d 100644
--- a/doc/copy_graph.html
+++ b/doc/copy_graph.html
@@ -1,24 +1,24 @@
Boost Graph Library: Copy Graph
-
-
+
+
copy_graph
-template <class VertexListGraph, class MutableGraph>
+template <class VertexListGraph, class MutableGraph>
void copy_graph(const VertexListGraph& G, MutableGraph& G_copy,
const bgl_named_params<P, T, R>& params = all defaults)
@@ -113,4 +113,4 @@ Complexity
-
+
diff --git a/doc/cuthill_mckee_ordering.html b/doc/cuthill_mckee_ordering.html
index 5765c31ce..41c0c734c 100644
--- a/doc/cuthill_mckee_ordering.html
+++ b/doc/cuthill_mckee_ordering.html
@@ -1,19 +1,19 @@
-
+
Boost Graph Library: Cuthill-Mckee Ordering
-
-
+
+
@@ -46,25 +46,25 @@
OutputIterator
cuthill_mckee_ordering(const IncidenceGraph& g,
typename graph_traits<IncidenceGraph>::vertex_descriptor s,
- OutputIterator inverse_permutation,
+ OutputIterator inverse_permutation,
ColorMap color, DegreeMap degree)
(2)
template <class VertexListGraph, class OutputIterator>
OutputIterator
- cuthill_mckee_ordering(const VertexListGraph& g, OutputIterator inverse_permutation);
+ cuthill_mckee_ordering(const VertexListGraph& g, OutputIterator inverse_permutation);
template <class VertexListGraph, class OutputIterator, class VertexIndexMap>
OutputIterator
- cuthill_mckee_ordering(const VertexListGraph& g, OutputIterator inverse_permutation,
- VertexIndexMap index_map);
-
- template <class VertexListGraph, class OutputIterator,
+ cuthill_mckee_ordering(const VertexListGraph& g, OutputIterator inverse_permutation,
+ VertexIndexMap index_map);
+
+ template <class VertexListGraph, class OutputIterator,
class ColorMap, class DegreeMap>
OutputIterator
- cuthill_mckee_ordering(const VertexListGraph& g, OutputIterator inverse_permutation,
+ cuthill_mckee_ordering(const VertexListGraph& g, OutputIterator inverse_permutation,
ColorMap color, DegreeMap degree)
-
+
(3)
template <class IncidenceGraph, class OutputIterator,
class ColorMap, class DegreeMap>
@@ -72,7 +72,7 @@
cuthill_mckee_ordering(const IncidenceGraph& g,
std::deque< typename
graph_traits<IncidenceGraph>::vertex_descriptor > vertex_queue,
- OutputIterator inverse_permutation,
+ OutputIterator inverse_permutation,
ColorMap color, DegreeMap degree)
@@ -92,10 +92,10 @@
Version 1 of the algorithm lets the user choose the ``starting
vertex'', version 2 finds a good starting vertex using the
-pseudo-peripheral pair heuristic (among each component), while version 3
-contains the starting nodes for each vertex in the deque. The choice of the
-``starting vertex'' can have a significant effect on the quality of the
-ordering. For versions 2 and 3, find_starting_vertex will be called
+pseudo-peripheral pair heuristic (among each component), while version 3
+contains the starting nodes for each vertex in the deque. The choice of the
+``starting vertex'' can have a significant effect on the quality of the
+ordering. For versions 2 and 3, find_starting_vertex will be called
for each component in the graph, increasing run time significantly.
@@ -140,7 +140,7 @@ Parameters
-- IncidenceGraph& g (IN)
+ - IncidenceGraph& g (IN)
An undirected graph. The graph's type must be a model of IncidenceGraph.
Python: The parameter is named graph.
@@ -149,13 +149,13 @@ Parameters
The starting vertex.
Python: Unsupported parameter.
- - OutputIterator inverse_permutation  (OUT)
+ - OutputIterator inverse_permutation  (OUT)
The new vertex ordering. The vertices are written to the output
iterator in their new order.
Python: This parameter is unused in Python. The new vertex
ordering is returned as a Python list.
-
+
- ColorMap color_map  (WORK)
Used internally to keep track of the progress of the algorithm
(to avoid visiting the same vertex twice).
@@ -171,13 +171,13 @@ Parameters
-- VertexListGraph& g (IN)
+ - VertexListGraph& g (IN)
An undirected graph. The graph's type must be a model of VertexListGraph and IncidenceGraph.
Python: The parameter is named graph.
-
- OutputIterator inverse_permutation  (OUT)
+ OutputIterator inverse_permutation  (OUT)
The new vertex ordering. The vertices are written to the
output iterator in their new order.
Python: This parameter is unused in Python. The new vertex
@@ -198,7 +198,7 @@ Parameters
-- IncidenceGraph& g (IN)
+ - IncidenceGraph& g (IN)
An undirected graph. The graph's type must be a model of IncidenceGraph.
Python: The parameter is named graph.
@@ -207,13 +207,13 @@ Parameters
The deque containing the starting vertices for each component.
Python: Unsupported parameter.
- - OutputIterator inverse_permutation  (OUT)
+ - OutputIterator inverse_permutation  (OUT)
The new vertex ordering. The vertices are written to the output
iterator in their new order.
Python: This parameter is unused in Python. The new vertex
ordering is returned as a Python list.
-
+
- ColorMap color_map  (WORK)
Used internally to keep track of the progress of the algorithm
(to avoid visiting the same vertex twice).
@@ -245,4 +245,4 @@ See Also
-
+
diff --git a/doc/cycle_canceling.html b/doc/cycle_canceling.html
index 25a97dc8d..cd7f0433e 100644
--- a/doc/cycle_canceling.html
+++ b/doc/cycle_canceling.html
@@ -1,17 +1,17 @@
Boost Graph Library: Cycle Canceling for Min Cost Max Flow
-
-
+
+
@@ -23,25 +23,25 @@
// named parameter version
template <class Graph, class P, class T, class R>
void cycle_canceling(
- Graph &g,
+ Graph &g,
const bgl_named_params<P, T, R> & params = all defaults)
// non-named parameter version
template <class Graph, class Pred, class Distance, class Reversed, class ResidualCapacity, class Weight>
-void cycle_canceling(const Graph & g, Weight weight, Reversed rev, ResidualCapacity residual_capacity, Pred pred, Distance distance)
+void cycle_canceling(const Graph & g, Weight weight, Reversed rev, ResidualCapacity residual_capacity, Pred pred, Distance distance)
The cycle_canceling() function calculates the minimum cost flow of a network with given flow. See Section Network
-Flow Algorithms for a description of maximum flow.
+Flow Algorithms for a description of maximum flow.
For given flow values f(u,v) function minimizes flow cost in such a way, that for each v in V the
sum u in V f(v,u) is preserved. Particularly if the input flow was the maximum flow, the function produces min cost max flow.
-
+
The function calculates the flow values f(u,v) for all (u,v) in
E, which are returned in the form of the residual capacity
-r(u,v) = c(u,v) - f(u,v).
+r(u,v) = c(u,v) - f(u,v).
There are several special requirements on the input graph and property
@@ -51,12 +51,12 @@
input graph should be Gin = (V,{E U
ET}). The ReverseEdgeMap argument rev
must map each edge in the original graph to its reverse edge, that is
-(u,v) -> (v,u) for all (u,v) in E.
+(u,v) -> (v,u) for all (u,v) in E.
The WeightMap has to map each edge from ET to -weight of its reversed edge.
-Note that edges from E can have negative weights.
+Note that edges from E can have negative weights.
-If weights in the graph are nonnegative, the
-successive_shortest_path_nonnegative_weights()
+If weights in the graph are nonnegative, the
+successive_shortest_path_nonnegative_weights()
might be better choice for min cost max flow.
@@ -70,7 +70,7 @@
Note that, although we mention capacity in the problem description, the actual algorithm doesn't have to now it.
-
+
In order to find the cost of the result flow use:
find_flow_cost().
@@ -92,10 +92,10 @@
Parameters
(u,v) in the graph, the reverse edge (v,u) must also
be in the graph.
-
+
Named Parameters
-
+
IN/OUT: residual_capacity_map(ResidualCapacityEdgeMap res)
This maps edges to their residual capacity. The type must be a model
@@ -142,7 +142,7 @@ Named Parameters
using the i_map for the index map.
-UTIL: distance_map(DistanceMap d_map)
+UTIL: distance_map(DistanceMap d_map)
The shortest path weight from the source vertex s to each
vertex in the graph g is recorded in this property map. The
@@ -150,7 +150,7 @@ Named Parameters
shortest path. The type DistanceMap must be a model of Read/Write
Property Map. The vertex descriptor type of the graph needs to
- be usable as the key type of the distance map.
+ be usable as the key type of the distance map.
Default:
@@ -178,8 +178,8 @@ Named Parameters
Complexity
-In the integer capacity and weight case, if C is the initial cost of the flow, then the complexity is O(C * |V| * |E|),
-where O(|E|* |V|) is the complexity of the bellman ford shortest paths algorithm and C is upper bound on number of iteration.
+In the integer capacity and weight case, if C is the initial cost of the flow, then the complexity is O(C * |V| * |E|),
+where O(|E|* |V|) is the complexity of the bellman ford shortest paths algorithm and C is upper bound on number of iteration.
In many real world cases number of iterations is much smaller than C.
@@ -203,7 +203,7 @@ See Also
-
+
Boost Graph Library: Directed Acyclic Graph Shortest Paths
-
-
+
+
@@ -30,21 +30,21 @@
const bgl_named_params<Param,Tag,Rest>& params)
// non-named parameter version
-template <class VertexListGraph, class DijkstraVisitor,
- class DistanceMap, class WeightMap, class ColorMap,
+template <class VertexListGraph, class DijkstraVisitor,
+ class DistanceMap, class WeightMap, class ColorMap,
class PredecessorMap,
- class Compare, class Combine,
+ class Compare, class Combine,
class DistInf, class DistZero>
void dag_shortest_paths(const VertexListGraph& g,
- typename graph_traits<VertexListGraph>::vertex_descriptor s,
+ typename graph_traits<VertexListGraph>::vertex_descriptor s,
DistanceMap distance, WeightMap weight, ColorMap color,
- PredecessorMap pred, DijkstraVisitor vis,
+ PredecessorMap pred, DijkstraVisitor vis,
Compare compare, Combine combine, DistInf inf, DistZero zero)
This algorithm [8] solves
-the single-source shortest-paths problem on a weighted, directed
+the single-source shortest-paths problem on a weighted, directed
acyclic graph (DAG). This algorithm is more efficient for DAG's
than either the Dijkstra or Bellman-Ford algorithm.
Use breadth-first search instead of this algorithm
@@ -74,7 +74,7 @@
Where Defined
Parameters
-IN: const VertexListGraph& g
+IN: const VertexListGraph& g
The graph object on which the algorithm will be applied.
The type VertexListGraph must be a model of \concept{VertexListGraph}.
@@ -82,7 +82,7 @@ Parameters
Python: The parameter is named graph.
-IN: vertex_descriptor s
+IN: vertex_descriptor s
The source vertex. All distance will be calculated from this vertex,
and the shortest paths tree will be rooted at this vertex.
@@ -92,7 +92,7 @@ Parameters
Named Parameters
-IN: weight_map(WeightMap w_map)
+IN: weight_map(WeightMap w_map)
The weight or ``length'' of each edge in the graph.
The type WeightMap must be a model of
@@ -106,7 +106,7 @@ Named Parameters
-IN: vertex_index_map(VertexIndexMap i_map)
+IN: vertex_index_map(VertexIndexMap i_map)
This maps each vertex to an integer in the range [0,
num_vertices(g)). This is necessary for efficient updates of the
@@ -124,7 +124,7 @@ Named Parameters
Python: Unsupported parameter.
-OUT: predecessor_map(PredecessorMap p_map)
+OUT: predecessor_map(PredecessorMap p_map)
The predecessor map records the edges in the minimum spanning
tree. Upon completion of the algorithm, the edges (p[u],u)
@@ -139,7 +139,7 @@ Named Parameters
Python: Must be a vertex_vertex_map for the graph.
-UTIL/OUT: distance_map(DistanceMap d_map)
+UTIL/OUT: distance_map(DistanceMap d_map)
The shortest path weight from the source vertex s to each
vertex in the graph g is recorded in this property map. The
@@ -147,7 +147,7 @@ Named Parameters
shortest path. The type DistanceMap must be a model of Read/Write
Property Map. The vertex descriptor type of the graph needs to
- be usable as the key type of the distance map.
+ be usable as the key type of the distance map.
The value type of the distance map is the element type of a Monoid formed with the combine
@@ -166,7 +166,7 @@ Named Parameters
Python: Must be a vertex_double_map for the graph.
-IN: distance_compare(CompareFunction cmp)
+IN: distance_compare(CompareFunction cmp)
This function is use to compare distances to determine which vertex
is closer to the source vertex. The CompareFunction type
@@ -182,7 +182,7 @@ Named Parameters
Python: Unsupported parameter.
-IN: distance_combine(CombineFunction cmb)
+IN: distance_combine(CombineFunction cmb)
This function is used to combine distances to compute the distance
of a path. The CombineFunction type must be a model of Named Parameters
Python: Unsupported parameter.
-IN: distance_inf(D inf)
+IN: distance_inf(D inf)
The inf object must be the greatest value of any D object.
That is, compare(d, inf) == true for any d != inf.
@@ -209,7 +209,7 @@ Named Parameters
Python: Unsupported parameter.
-IN: distance_zero(D zero)
+IN: distance_zero(D zero)
The zero value must be the identity element for the
Monoid formed by the distance values
@@ -220,7 +220,7 @@ Named Parameters
Python: Unsupported parameter.
-UTIL/OUT: color_map(ColorMap c_map)
+UTIL/OUT: color_map(ColorMap c_map)
This is used during the execution of the algorithm to mark the
vertices. The vertices start out white and become gray when they are
@@ -242,13 +242,13 @@ Named Parameters
the graph.
-
-OUT: visitor(DijkstraVisitor v)
+
+OUT: visitor(DijkstraVisitor v)
Use this to specify actions that you would like to happen
during certain event points within the algorithm.
The type DijkstraVisitor must be a model of the
- Dijkstra Visitor concept.
+ Dijkstra Visitor concept.
The visitor object is passed by value [1].
Default: dijkstra_visitor<null_visitor>
@@ -272,21 +272,21 @@ Visitor Event Points
is invoked on each vertex in the graph before the start of the
algorithm.
- vis.examine_vertex(u, g)
- is invoked on a vertex as it is added to set S.
+ is invoked on a vertex as it is added to set S.
At this point we know that (p[u],u)
- is a shortest-paths tree edge so
- d[u] = delta(s,u) = d[p[u]] + w(p[u],u). Also, the distances
+ is a shortest-paths tree edge so
+ d[u] = delta(s,u) = d[p[u]] + w(p[u],u). Also, the distances
of the examined vertices is monotonically increasing
- d[u1] <= d[u2] <= d[un].
+ d[u1] <= d[u2] <= d[un].
- vis.examine_edge(e, g)
is invoked on each out-edge of a vertex immediately after it has
- been added to set S.
+ been added to set S.
- vis.edge_relaxed(e, g)
is invoked on edge (u,v) if d[u] + w(u,v) < d[v].
The edge (u,v) that participated in the last
- relaxation for vertex v is an edge in the shortest paths tree.
+ relaxation for vertex v is an edge in the shortest paths tree.
- vis.discover_vertex(v, g)
- is invoked on vertex v when the edge
+ is invoked on vertex v when the edge
(u,v) is examined and v is WHITE. Since
a vertex is colored GRAY when it is discovered,
each reacable vertex is discovered exactly once.
@@ -306,7 +306,7 @@
Example
Notes
-[1]
+
[1]
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
@@ -322,5 +322,5 @@
Notes
-
+
diff --git a/doc/depth_first_search.html b/doc/depth_first_search.html
index 547b94e3f..a376de3f1 100644
--- a/doc/depth_first_search.html
+++ b/doc/depth_first_search.html
@@ -1,17 +1,17 @@
Boost Graph Library: Depth-First Search
-
-
+
+
@@ -31,7 +31,7 @@
DFSVisitor
, class ColorMap>
-void depth_first_search(const Graph& g, DFSVisitor vis, ColorMap color,
+void depth_first_search(const Graph& g, DFSVisitor vis, ColorMap color,
typename graph_traits<Graph>::vertex_descriptor start)
@@ -84,33 +84,33 @@
DFS(G)
- for each vertex u in V
+ for each vertex u in V
color[u] := WHITE
- p[u] = u
+ p[u] = u
end for
time := 0
if there is a starting vertex s
call DFS-VISIT(G, s)
- for each vertex u in V
+ for each vertex u in V
if color[u] = WHITE
call DFS-VISIT(G, u)
end for
return (p,d_time,f_time)
-DFS-VISIT(G, u)
+DFS-VISIT(G, u)
color[u] := GRAY
- d_time[u] := time := time + 1
- for each v in Adj[u]
+ d_time[u] := time := time + 1
+ for each v in Adj[u]
if (color[v] = WHITE)
- p[v] = u
+ p[v] = u
call DFS-VISIT(G, v)
- else if (color[v] = GRAY)
+ else if (color[v] = GRAY)
...
- else if (color[v] = BLACK)
+ else if (color[v] = BLACK)
...
...
end for
color[u] := BLACK
- f_time[u] := time := time + 1
+ f_time[u] := time := time + 1
@@ -252,27 +252,27 @@ Visitor Event Points
- vis.start_vertex(s, g) is invoked on the source
vertex once before the start of the search.
-
+
- vis.discover_vertex(u, g) is invoked when a vertex
is encountered for the first time.
-
+
- vis.examine_edge(e, g) is invoked on every out-edge
of each vertex after it is discovered.
- vis.tree_edge(e, g) is invoked on each edge as it
becomes a member of the edges that form the search tree. If you
wish to record predecessors, do so at this event point.
-
+
- vis.back_edge(e, g) is invoked on the back edges in
the graph.
-
+
- vis.forward_or_cross_edge(e, g) is invoked on
forward or cross edges in the graph. In an undirected graph this
method is never called.
-
- vis.finish_edge(e, g) is invoked on the non-tree edges in
- the graph as well as on each tree edge after its target vertex is finished.
-
+
- vis.finish_edge(e, g) is invoked on the non-tree edges in
+ the graph as well as on each tree edge after its target vertex is finished.
+
- vis.finish_vertex(u, g) is invoked on a vertex after
all of its out edges have been added to the search tree and all of
the adjacent vertices have been discovered (but before their
@@ -295,7 +295,7 @@
See Also
Notes
-[1]
+
[1]
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
@@ -317,4 +317,4 @@
Notes
-
+
diff --git a/doc/depth_first_visit.html b/doc/depth_first_visit.html
index 95514e088..81f73ba90 100644
--- a/doc/depth_first_visit.html
+++ b/doc/depth_first_visit.html
@@ -1,17 +1,17 @@
Boost Graph Library: Depth-First Visit
-
-
+
+
@@ -25,13 +25,13 @@
template <class IncidenceGraph, class DFSVisitor, class ColorMap>
void depth_first_visit(IncidenceGraph& g,
- typename graph_traits<IncidenceGraph>::vertex_descriptor s,
+ typename graph_traits<IncidenceGraph>::vertex_descriptor s,
DFSVisitor& vis, ColorMap color)
-template <class IncidenceGraph, class DFSVisitor, class ColorMap,
+template <class IncidenceGraph, class DFSVisitor, class ColorMap,
class TerminatorFunc>
void depth_first_visit(IncidenceGraph& g,
- typename graph_traits<IncidenceGraph>::vertex_descriptor s,
+ typename graph_traits<IncidenceGraph>::vertex_descriptor s,
DFSVisitor& vis, ColorMap color, TerminatorFunc func = TerminatorFunc())
@@ -41,7 +41,7 @@
href="./graph_theory_review.html#sec:dfs-algorithm">depth-first
pattern
. The main purpose of the function is for the
implementation of depth_first_search() though sometimes it is
-useful on its own.
+useful on its own.
The DFSVisitor supplied by the user determines what
@@ -124,7 +124,7 @@
Complexity
Notes
-[1]
+
[1]
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
@@ -141,4 +141,4 @@
Notes
-
+
diff --git a/doc/dfs_visitor.html b/doc/dfs_visitor.html
index c9ee5114d..840acd335 100644
--- a/doc/dfs_visitor.html
+++ b/doc/dfs_visitor.html
@@ -1,17 +1,17 @@
Boost Graph Library: dfs_visitor
-
-
+
+
@@ -108,4 +108,4 @@ See Also
-
+
diff --git a/doc/dijkstra_shortest_paths.html b/doc/dijkstra_shortest_paths.html
index 2f312f8b5..2cd3978f7 100644
--- a/doc/dijkstra_shortest_paths.html
+++ b/doc/dijkstra_shortest_paths.html
@@ -1,17 +1,17 @@
Boost Graph Library: Dijkstra's Shortest Paths
-
-
+
+
@@ -29,14 +29,14 @@
const bgl_named_params<P, T, R>& params);
// non-named parameter version
-template <typename Graph, typename DijkstraVisitor,
+template <typename Graph, typename DijkstraVisitor,
typename PredecessorMap, typename DistanceMap,
- typename WeightMap, typename VertexIndexMap, typename CompareFunction, typename CombineFunction,
+ typename WeightMap, typename VertexIndexMap, typename CompareFunction, typename CombineFunction,
typename DistInf, typename DistZero, typename ColorMap = default>
void dijkstra_shortest_paths
(const Graph& g,
- typename graph_traits<Graph>::vertex_descriptor s,
- PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
+ typename graph_traits<Graph>::vertex_descriptor s,
+ PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
VertexIndexMap index_map,
CompareFunction compare, CombineFunction combine, DistInf inf, DistZero zero,
DijkstraVisitor vis, ColorMap color = default)
@@ -123,12 +123,12 @@
DIJKSTRA(G, s, w)
for each vertex u in V (This loop is not run in dijkstra_shortest_paths_no_init)
- d[u] := infinity
- p[u] := u
+ d[u] := infinity
+ p[u] := u
color[u] := WHITE
end for
- color[s] := GRAY
- d[s] := 0
+ color[s] := GRAY
+ d[s] := 0
INSERT(Q, s)
while (Q != Ø)
u := EXTRACT-MIN(Q)
@@ -136,10 +136,10 @@
for each vertex v in Adj[u]
if (w(u,v) + d[u] < d[v])
d[v] := w(u,v) + d[u]
- p[v] := u
- if (color[v] = WHITE)
+ p[v] := u
+ if (color[v] = WHITE)
color[v] := GRAY
- INSERT(Q, v)
+ INSERT(Q, v)
else if (color[v] = GRAY)
DECREASE-KEY(Q, v)
else
@@ -188,17 +188,17 @@ Where Defined
Parameters
-IN: const Graph& g
+IN: const Graph& g
The graph object on which the algorithm will be applied.
- The type Graph must be a model of
+ The type Graph must be a model of
Vertex List Graph
and Incidence Graph.
Python: The parameter is named graph.
-IN: vertex_descriptor s
+IN: vertex_descriptor s
The source vertex. All distance will be calculated from this vertex,
and the shortest paths tree will be rooted at this vertex.
@@ -208,11 +208,11 @@ Parameters
Named Parameters
-IN: weight_map(WeightMap w_map)
+IN: weight_map(WeightMap w_map)
The weight or ``length'' of each edge in the graph. The weights
must all be non-negative, and the algorithm will throw a
- negative_edge
+ negative_edge
exception is one of the edges is negative.
The type WeightMap must be a model of
Readable Property Map. The edge descriptor type of
@@ -225,13 +225,13 @@ Named Parameters
Python default: graph.get_edge_double_map("weight")
-IN: vertex_index_map(VertexIndexMap i_map)
+IN: vertex_index_map(VertexIndexMap i_map)
This maps each vertex to an integer in the range [0,
num_vertices(g)). This is necessary for efficient updates of the
heap data structure [61] when an edge is relaxed.
- The type
+ The type
VertexIndexMap must be a model of
Readable Property Map. The value type of the map must be an
integer type. The vertex descriptor type of the graph needs to be
@@ -246,10 +246,10 @@ Named Parameters
Python: Unsupported parameter.
-OUT: predecessor_map(PredecessorMap p_map)
+OUT: predecessor_map(PredecessorMap p_map)
The predecessor map records the edges in the shortest path tree, the tree computed
- by the traversal of the graph. Upon completion of the algorithm, the edges
+ by the traversal of the graph. Upon completion of the algorithm, the edges
(p[u],u) for all u in V are in the tree. The shortest path
from vertex s to each vertex v in the graph consists of the
vertices v, p[v], p[p[v]], and so on until s is
@@ -266,7 +266,7 @@ Named Parameters
Python: Must be a vertex_vertex_map for the graph.
-UTIL/OUT: distance_map(DistanceMap d_map)
+UTIL/OUT: distance_map(DistanceMap d_map)
The shortest path weight from the source vertex s to each
vertex in the graph g is recorded in this property map. The
@@ -274,7 +274,7 @@ Named Parameters
shortest path. The type DistanceMap must be a model of Read/Write
Property Map. The vertex descriptor type of the graph needs to
- be usable as the key type of the distance map.
+ be usable as the key type of the distance map.
The value type of the distance map is the element type of a Monoid formed with the combine
@@ -293,7 +293,7 @@ Named Parameters
Python: Must be a vertex_double_map for the graph.
-IN: distance_compare(CompareFunction cmp)
+IN: distance_compare(CompareFunction cmp)
This function is use to compare distances to determine which vertex
is closer to the source vertex. The CompareFunction type
@@ -309,7 +309,7 @@ Named Parameters
Python: Unsupported parameter.
-IN: distance_combine(CombineFunction cmb)
+IN: distance_combine(CombineFunction cmb)
This function is used to combine distances to compute the distance
of a path. The CombineFunction type must be a model of Named Parameters
Python: Unsupported parameter.
-IN: distance_inf(D inf)
+IN: distance_inf(D inf)
The inf object must be the greatest value of any D object.
That is, compare(d, inf) == true for any d != inf.
@@ -338,7 +338,7 @@ Named Parameters
Python: Unsupported parameter.
-IN: distance_zero(D zero)
+IN: distance_zero(D zero)
The zero value must be the identity element for the
Monoid formed by the distance values
@@ -350,7 +350,7 @@ Named Parameters
Python: Unsupported parameter.
-UTIL/OUT: color_map(ColorMap c_map)
+UTIL/OUT: color_map(ColorMap c_map)
This is used during the execution of the algorithm to mark the
vertices. The vertices start out white and become gray when they are
@@ -371,13 +371,13 @@ Named Parameters
Python: The color map must be a vertex_color_map for
the graph.
-
-OUT: visitor(DijkstraVisitor v)
+
+OUT: visitor(DijkstraVisitor v)
Use this to specify actions that you would like to happen
during certain event points within the algorithm.
The type DijkstraVisitor must be a model of the
- Dijkstra Visitor concept.
+ Dijkstra Visitor concept.
The visitor object is passed by value [2].
Default: dijkstra_visitor<null_visitor>
@@ -404,19 +404,19 @@ Visitor Event Points
- vis.examine_vertex(u, g)
is invoked on a vertex as it is removed from the priority queue
and added to set S. At this point we know that (p[u],u)
- is a shortest-paths tree edge so
- d[u] = delta(s,u) = d[p[u]] + w(p[u],u). Also, the distances
+ is a shortest-paths tree edge so
+ d[u] = delta(s,u) = d[p[u]] + w(p[u],u). Also, the distances
of the examined vertices is monotonically increasing
- d[u1] <= d[u2] <= d[un].
+ d[u1] <= d[u2] <= d[un].
- vis.examine_edge(e, g)
is invoked on each out-edge of a vertex immediately after it has
- been added to set S.
+ been added to set S.
- vis.edge_relaxed(e, g)
is invoked on edge (u,v) if d[u] + w(u,v) < d[v].
The edge (u,v) that participated in the last
- relaxation for vertex v is an edge in the shortest paths tree.
+ relaxation for vertex v is an edge in the shortest paths tree.
- vis.discover_vertex(v, g)
- is invoked on vertex v when the edge
+ is invoked on vertex v when the edge
(u,v) is examined and v is WHITE. Since
a vertex is colored GRAY when it is discovered,
each reachable vertex is discovered exactly once. This
@@ -445,7 +445,7 @@
Notes
vertices in V - S that are discovered and therefore have a
distance less than infinity.
-[2]
+
[2]
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
@@ -461,4 +461,4 @@
Notes
-
+
diff --git a/doc/dijkstra_shortest_paths_no_color_map.html b/doc/dijkstra_shortest_paths_no_color_map.html
index 05c3aec51..07432082d 100644
--- a/doc/dijkstra_shortest_paths_no_color_map.html
+++ b/doc/dijkstra_shortest_paths_no_color_map.html
@@ -1,17 +1,17 @@
Boost Graph Library: Dijkstra's Shortest Paths (No Color Map)
-
-
+
+
@@ -27,29 +27,29 @@
(const Graph& graph,
typename graph_traits<Graph>::vertex_descriptor start_vertex,
const bgl_named_params& params);
-
+
// non-named parameter version
-template <typename Graph, typename DijkstraVisitor,
+template <typename Graph, typename DijkstraVisitor,
typename PredecessorMap, typename DistanceMap,
- typename WeightMap, typename VertexIndexMap, typename DistanceCompare, typename DistanceWeightCombine,
+ typename WeightMap, typename VertexIndexMap, typename DistanceCompare, typename DistanceWeightCombine,
typename DistanceInfinity, typename DistanceZero>
void dijkstra_shortest_paths_no_color_map
(const Graph& graph,
- typename graph_traits<Graph>::vertex_descriptor start_vertex,
- PredecessorMap predecessor_map, DistanceMap distance_map, WeightMap weight_map,
+ typename graph_traits<Graph>::vertex_descriptor start_vertex,
+ PredecessorMap predecessor_map, DistanceMap distance_map, WeightMap weight_map,
VertexIndexMap index_map,
DistanceCompare distance_compare, DistanceWeightCombine distance_weight_combine,
DistanceInfinity distance_infinity, DistanceZero distance_zero);
// version that does not initialize the property maps
-template <typename Graph, typename DijkstraVisitor,
+template <typename Graph, typename DijkstraVisitor,
typename PredecessorMap, typename DistanceMap,
- typename WeightMap, typename VertexIndexMap, typename DistanceCompare, typename DistanceWeightCombine,
+ typename WeightMap, typename VertexIndexMap, typename DistanceCompare, typename DistanceWeightCombine,
typename DistanceInfinity, typename DistanceZero>
void dijkstra_shortest_paths_no_color_map_no_init
(const Graph& graph,
- typename graph_traits<Graph>::vertex_descriptor start_vertex,
- PredecessorMap predecessor_map, DistanceMap distance_map, WeightMap weight_map,
+ typename graph_traits<Graph>::vertex_descriptor start_vertex,
+ PredecessorMap predecessor_map, DistanceMap distance_map, WeightMap weight_map,
VertexIndexMap index_map,
DistanceCompare distance_compare, DistanceWeightCombine distance_weight_combine,
DistanceInfinity distance_infinity, DistanceZero distance_zero);
@@ -116,16 +116,16 @@
DIJKSTRA(G, s, w)
- d[s] := 0
+ d[s] := 0
INSERT(Q, s)
while (Q != Ø)
u := EXTRACT-MIN(Q)
for each vertex v in Adj[u]
if (w(u,v) + d[u] < d[v])
d[v] := w(u,v) + d[u]
- p[v] := u
- if (d[v] was originally infinity)
- INSERT(Q, v)
+ p[v] := u
+ if (d[v] was originally infinity)
+ INSERT(Q, v)
else
DECREASE-KEY(Q, v)
else
@@ -164,15 +164,15 @@ Where Defined
Parameters
-IN: const Graph& graph
+IN: const Graph& graph
The graph object on which the algorithm will be applied.
- The type Graph must be a model of
+ The type Graph must be a model of
Vertex List Graph
and Incidence Graph.
-IN: vertex_descriptor start_vertex
+IN: vertex_descriptor start_vertex
The source vertex. All distance will be calculated from this vertex,
and the shortest paths tree will be rooted at this vertex.
@@ -180,11 +180,11 @@ Parameters
Named Parameters
-IN: weight_map(WeightMap weight_map)
+IN: weight_map(WeightMap weight_map)
The weight or ``length'' of each edge in the graph. The weights
must all be non-negative and non-infinite [3]. The algorithm will throw a
- negative_edge
+ negative_edge
exception is one of the edges is negative.
The type WeightMap must be a model of
Readable Property Map. The edge descriptor type of
@@ -194,13 +194,13 @@ Named Parameters
Default: get(edge_weight, graph)
-IN: index_map(VertexIndexMap index_map)
+IN: index_map(VertexIndexMap index_map)
This maps each vertex to an integer in the range [0,
num_vertices(graph)). This is necessary for efficient updates of the
heap data structure [61] when an edge is relaxed.
- The type
+ The type
VertexIndexMap must be a model of
Readable Property Map. The value type of the map must be an
integer type. The vertex descriptor type of the graph needs to be
@@ -213,7 +213,7 @@ Named Parameters
-OUT: predecessor_map(PredecessorMap predecessor_map)
+OUT: predecessor_map(PredecessorMap predecessor_map)
The predecessor map records the edges in the minimum spanning
tree. Upon completion of the algorithm, the edges (p[u],u)
@@ -229,7 +229,7 @@ Named Parameters
Python: Must be a vertex_vertex_map for the graph.
-UTIL/OUT: distance_map(DistanceMap distance_map)
+UTIL/OUT: distance_map(DistanceMap distance_map)
The shortest path weight from the source vertex start_vertex to each
vertex in the graph graph is recorded in this property map. The
@@ -237,7 +237,7 @@ Named Parameters
shortest path. The type DistanceMap must be a model of Read/Write
Property Map. The vertex descriptor type of the graph needs to
- be usable as the key type of the distance map.
+ be usable as the key type of the distance map.
The value type of the distance map is the element type of a Monoid formed with the distance_weight_combine
@@ -254,7 +254,7 @@ Named Parameters
map.
-IN: distance_compare(CompareFunction distance_compare)
+IN: distance_compare(CompareFunction distance_compare)
This function is use to compare distances to determine which vertex
is closer to the source vertex. The DistanceCompareFunction type
@@ -268,7 +268,7 @@ Named Parameters
property_traits<DistanceMap>::value_type
-IN: distance_combine(CombineFunction distance_weight_combine)
+IN: distance_combine(CombineFunction distance_weight_combine)
This function is used to combine distances to compute the distance
of a path. The DistanceWeightCombineFunction type must be a model of Named Parameters
D=typename property_traits<DistanceMap>::value_type
-IN: distance_inf(D distance_infinity)
+IN: distance_inf(D distance_infinity)
The distance_infinity object must be the greatest value of any D object.
That is, distance_compare(d, distance_infinity) == true for any d != distance_infinity.
@@ -293,7 +293,7 @@ Named Parameters
Default: std::numeric_limits<D>::max()
-IN: distance_zero(D distance_zero)
+IN: distance_zero(D distance_zero)
The distance_zero value must be the identity element for the
Monoid formed by the distance values
@@ -302,13 +302,13 @@ Named Parameters
Default: D()with
D=typename property_traits<DistanceMap>::value_type
-
-OUT: visitor(DijkstraVisitor v)
+
+OUT: visitor(DijkstraVisitor v)
Use this to specify actions that you would like to happen
during certain event points within the algorithm.
The type DijkstraVisitor must be a model of the
- Dijkstra Visitor concept.
+ Dijkstra Visitor concept.
The visitor object is passed by value [2].
Default: dijkstra_visitor<null_visitor>
@@ -330,19 +330,19 @@ Visitor Event Points
- vis.examine_vertex(u, g)
is invoked on a vertex as it is removed from the priority queue
and added to set S. At this point we know that (p[u],u)
- is a shortest-paths tree edge so
- d[u] = delta(s,u) = d[p[u]] + w(p[u],u). Also, the distances
+ is a shortest-paths tree edge so
+ d[u] = delta(s,u) = d[p[u]] + w(p[u],u). Also, the distances
of the examined vertices is monotonically increasing
- d[u1] <= d[u2] <= d[un].
+ d[u1] <= d[u2] <= d[un].
- vis.examine_edge(e, g)
is invoked on each out-edge of a vertex immediately after it has
- been added to set S.
+ been added to set S.
- vis.edge_relaxed(e, g)
is invoked on edge (u,v) if d[u] + w(u,v) < d[v].
The edge (u,v) that participated in the last
- relaxation for vertex v is an edge in the shortest paths tree.
+ relaxation for vertex v is an edge in the shortest paths tree.
- vis.discover_vertex(v, g)
- is invoked on vertex v when the edge
+ is invoked on vertex v when the edge
(u,v) is examined and v has not yet been discovered (i.e. its distance was infinity before relaxation was attempted on the edge). This
is also when the vertex is inserted into the priority queue.
- vis.edge_not_relaxed(e, g)
@@ -370,17 +370,17 @@
Notes
vertices in V - S that are discovered and therefore have a
distance less than infinity.
-[2]
+
[2]
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
passed in. Therefore you may want the visitor to hold this state by
pointer or reference.
-
-
[3]
+
+
[3]
The algorithm will not work correctly if any of the edge weights are equal to infinity since the infinite distance value is used to determine if a vertex has been discovered.
-
-
[4]
+
+
[4]
Calls to the visitor events occur in the same order as dijkstra_shortest_paths (i.e. discover_vertex(u) will always be called after examine_vertex(u) for an undiscovered vertex u). However, the vertices of the graph given to dijkstra_shortest_paths_no_color_map will not necessarily be visited in the same order as dijkstra_shortest_paths.
@@ -391,4 +391,4 @@
Notes
Trustees of Indiana University
-
+
diff --git a/doc/dijkstra_visitor.html b/doc/dijkstra_visitor.html
index 5ad9db1de..ac4b3cb3a 100644
--- a/doc/dijkstra_visitor.html
+++ b/doc/dijkstra_visitor.html
@@ -1,17 +1,17 @@
Boost Graph Library: dijkstra_visitor
-
-
+
+
@@ -37,7 +37,7 @@ Example
boost::dijkstra_shortest_paths
- (G, vertex(a, G),
+ (G, vertex(a, G),
distance_map(make_iterator_property_map(distance.begin(), vertex_id, distance[0])).
predecessor_map(make_iterator_property_map(parent.begin(), vertex_id, parent[0])).
visitor(make_dijkstra_visitor(copy_graph(G_copy, on_examine_edge()))));
@@ -122,4 +122,4 @@ See Also
-
+
diff --git a/doc/directed_graph.html b/doc/directed_graph.html
index c20b23830..a410153e8 100644
--- a/doc/directed_graph.html
+++ b/doc/directed_graph.html
@@ -1,17 +1,17 @@
Boost Graph Library: Directed Graph
-
-
+
+
@@ -93,4 +93,4 @@ Where Defined
-
+
diff --git a/doc/disjoint_sets.html b/doc/disjoint_sets.html
index 34cce558d..eaebe45a4 100644
--- a/doc/disjoint_sets.html
+++ b/doc/disjoint_sets.html
@@ -73,7 +73,7 @@ Example
...
disjoint_sets<Rank, Parent, FindCompress> dsets(rank, p);
-
+
for (ui = vertices(G).first; ui != vertices(G).second; ++ui)
dsets.make_set(*ui);
...
@@ -282,7 +282,7 @@
-
Revised
+
Revised
01
December, 2006
diff --git a/doc/disjoint_sets_biblio.html b/doc/disjoint_sets_biblio.html
index ec9e88324..96132347c 100644
--- a/doc/disjoint_sets_biblio.html
+++ b/doc/disjoint_sets_biblio.html
@@ -37,7 +37,7 @@ Bibliography
"../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
height="31" width="88">
- Revised
+
Revised
01
December, 2006
diff --git a/doc/distance_recorder.html b/doc/distance_recorder.html
index 9786371f4..50daaa447 100644
--- a/doc/distance_recorder.html
+++ b/doc/distance_recorder.html
@@ -1,17 +1,17 @@
Boost Graph Library: distance_recorder
-
-
+
+
@@ -124,7 +124,7 @@ Member Functions
void operator()(Edge e, const Graph& g);
-Given edge e = (u,v), this records the distance of v as
+Given edge e = (u,v), this records the distance of v as
one plus the distance of u.
@@ -173,7 +173,7 @@ See Also
-
+
Boost Graph Library: Edge List Class
-
-
+
+
@@ -52,7 +52,7 @@ Example
E(x,y), E(x,v),
E(y,v), E(y,z),
E(z,u), E(z,x) };
-
+
int weight[] = { -4, 8, 5,
-2,
9, -3,
@@ -61,16 +61,16 @@ Example
typedef boost::edge_list<E*> Graph;
Graph g(edges, edges + sizeof(edges) / sizeof(E));
-
+
std::vector<int> distance(N, std::numeric_limits<short>::max());
std::vector<int> parent(N,-1);
-
+
distance[z] = 0;
parent[z] = z;
bool r = boost::bellman_ford_shortest_paths(g, int(N), weight,
distance.begin(),
parent.begin());
- if (r)
+ if (r)
for (int i = 0; i < N; ++i)
std::cout << name[i] << ": " << distance[i]
<< " " << name[parent[i]] << std::endl;
@@ -145,7 +145,7 @@ Associated Types
The type for the edge descriptors associated with the
-edge_list.
+edge_list.
@@ -218,4 +218,4 @@ Non-Member Functions
-
+
diff --git a/doc/edge_predecessor_recorder.html b/doc/edge_predecessor_recorder.html
index e9bee01dc..f4b0be765 100644
--- a/doc/edge_predecessor_recorder.html
+++ b/doc/edge_predecessor_recorder.html
@@ -1,17 +1,17 @@
Boost Graph Library: edge_predecessor_recorder
-
-
+
+
@@ -188,7 +188,7 @@ See Also
-
+
Boost Graph Library: Edmonds-Karp Maximum Flow
-
-
+
+
@@ -23,20 +23,20 @@
// named parameter version
template <class Graph, class P, class T, class R>
typename detail::edge_capacity_value<Graph, P, T, R>::value_type
-edmonds_karp_max_flow(Graph& g,
+edmonds_karp_max_flow(Graph& g,
typename graph_traits<Graph>::vertex_descriptor src,
typename graph_traits<Graph>::vertex_descriptor sink,
const bgl_named_params<P, T, R>& params = all defaults)
// non-named parameter version
-template <class Graph,
+template <class Graph,
class CapacityEdgeMap, class ResidualCapacityEdgeMap,
class ReverseEdgeMap, class ColorMap, class PredEdgeMap>
typename property_traits<CapacityEdgeMap>::value_type
-edmonds_karp_max_flow(Graph& g,
+edmonds_karp_max_flow(Graph& g,
typename graph_traits<Graph>::vertex_descriptor src,
typename graph_traits<Graph>::vertex_descriptor sink,
- CapacityEdgeMap cap, ResidualCapacityEdgeMap res, ReverseEdgeMap rev,
+ CapacityEdgeMap cap, ResidualCapacityEdgeMap res, ReverseEdgeMap rev,
ColorMap color, PredEdgeMap pred)
@@ -48,7 +48,7 @@
maximum flow will be the return value of the function. The function
also calculates the flow values f(u,v) for all (u,v) in
E, which are returned in the form of the residual capacity
-r(u,v) = c(u,v) - f(u,v).
+r(u,v) = c(u,v) - f(u,v).
There are several special requirements on the input graph and property
@@ -112,12 +112,12 @@
Parameters
The source vertex for the flow network graph.
-
+
IN: vertex_descriptor sink
The sink vertex for the flow network graph.
-
+
Named Parameters
@@ -129,7 +129,7 @@ Named Parameters
key type of the map must be the graph's edge descriptor type.
Default: get(edge_capacity, g)
-
+
OUT: residual_capacity_map(ResidualCapacityEdgeMap res)
This maps edges to their residual capacity. The type must be a model
@@ -228,7 +228,7 @@ See Also
-
+
Boost Graph Library: Exceptions
-
-
+
+
diff --git a/doc/faq.html b/doc/faq.html
index c77fca5db..53c9c38f6 100644
--- a/doc/faq.html
+++ b/doc/faq.html
@@ -1,17 +1,17 @@
Boost Graph Library: FAQ
-
-
+
+
@@ -76,8 +76,8 @@ Frequently Asked Questions
weren't other strong reasons, it was enough for us to choose free
functions.
-
-
+
+
Our religious reason for choosing free functions is to send the message
that BGL is a generic library, and not a traditional object-oriented
library. OO was hip in the 80s and 90s, but its time we moved beyond!
@@ -124,13 +124,13 @@
Frequently Asked Questions
not being found, such as:
../../../boost/concept_check.hpp:209: no match for
-`boost::detail::error_property_not_found & ==
+`boost::detail::error_property_not_found & ==
boost::detail::error_property_not_found &'
or a message such as:
../../..\boost/graph/depth_first_search.hpp(78) : error C2664: 'white'
-: cannot convert parameter 1 from
+: cannot convert parameter 1 from
'struct boost::detail::error_property_not_found'
to 'enum boost::default_color_type'
diff --git a/doc/figs/adj_list.fig b/doc/figs/adj_list.fig
index ebe19a3b2..82bd57e47 100644
--- a/doc/figs/adj_list.fig
+++ b/doc/figs/adj_list.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/adj_matrix.fig b/doc/figs/adj_matrix.fig
index a0664312e..5f8985e16 100644
--- a/doc/figs/adj_matrix.fig
+++ b/doc/figs/adj_matrix.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/analogy.fig b/doc/figs/analogy.fig
index 079ad97bc..dfc0e95fc 100644
--- a/doc/figs/analogy.fig
+++ b/doc/figs/analogy.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/back_edges.fig b/doc/figs/back_edges.fig
index f36892e81..842435104 100644
--- a/doc/figs/back_edges.fig
+++ b/doc/figs/back_edges.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/bfs_example.fig b/doc/figs/bfs_example.fig
index 4adf2a91f..ad1dec960 100644
--- a/doc/figs/bfs_example.fig
+++ b/doc/figs/bfs_example.fig
@@ -2,7 +2,7 @@
Portrait
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/bfs_family.fig b/doc/figs/bfs_family.fig
index f3de67c68..ad40d897f 100644
--- a/doc/figs/bfs_family.fig
+++ b/doc/figs/bfs_family.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/bfs_visitor.fig b/doc/figs/bfs_visitor.fig
index cb85d86b1..0996cf83f 100644
--- a/doc/figs/bfs_visitor.fig
+++ b/doc/figs/bfs_visitor.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/concepts.fig b/doc/figs/concepts.fig
index d976f733a..97b2f9bd9 100644
--- a/doc/figs/concepts.fig
+++ b/doc/figs/concepts.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/dfs.fig b/doc/figs/dfs.fig
index aff4b2b8d..45feb4e9c 100644
--- a/doc/figs/dfs.fig
+++ b/doc/figs/dfs.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/dfs_example.fig b/doc/figs/dfs_example.fig
index ebd3cdfcb..021adae9e 100644
--- a/doc/figs/dfs_example.fig
+++ b/doc/figs/dfs_example.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/dfs_family.fig b/doc/figs/dfs_family.fig
index aa3958ac1..851eb868c 100644
--- a/doc/figs/dfs_family.fig
+++ b/doc/figs/dfs_family.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/dfs_visitor.fig b/doc/figs/dfs_visitor.fig
index d4d351a66..0d2a284c6 100644
--- a/doc/figs/dfs_visitor.fig
+++ b/doc/figs/dfs_visitor.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/digraph.fig b/doc/figs/digraph.fig
index d6fc204a5..a56b4cca3 100644
--- a/doc/figs/digraph.fig
+++ b/doc/figs/digraph.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/disjoint_set_family.fig b/doc/figs/disjoint_set_family.fig
index 309904282..0a71d0017 100644
--- a/doc/figs/disjoint_set_family.fig
+++ b/doc/figs/disjoint_set_family.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/edge_list.fig b/doc/figs/edge_list.fig
index dc3759754..cce549ce0 100644
--- a/doc/figs/edge_list.fig
+++ b/doc/figs/edge_list.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/file_dep.fig b/doc/figs/file_dep.fig
index 1259102a8..edd41f1f8 100644
--- a/doc/figs/file_dep.fig
+++ b/doc/figs/file_dep.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/forward_or_cross_edges.fig b/doc/figs/forward_or_cross_edges.fig
index d88245a79..b7dc619ee 100644
--- a/doc/figs/forward_or_cross_edges.fig
+++ b/doc/figs/forward_or_cross_edges.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/graph_search.fig b/doc/figs/graph_search.fig
index ef66e059a..ffc67b99c 100644
--- a/doc/figs/graph_search.fig
+++ b/doc/figs/graph_search.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/knights_tour.fig b/doc/figs/knights_tour.fig
index 5035bcf4a..d9a4e1213 100644
--- a/doc/figs/knights_tour.fig
+++ b/doc/figs/knights_tour.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/quick_start.fig b/doc/figs/quick_start.fig
index 23226637f..e71c7aed4 100644
--- a/doc/figs/quick_start.fig
+++ b/doc/figs/quick_start.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/search_states.fig b/doc/figs/search_states.fig
index f44776f5f..b3109807a 100644
--- a/doc/figs/search_states.fig
+++ b/doc/figs/search_states.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/tree_edges.fig b/doc/figs/tree_edges.fig
index 6143bc8b0..747c91330 100644
--- a/doc/figs/tree_edges.fig
+++ b/doc/figs/tree_edges.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/undigraph.fig b/doc/figs/undigraph.fig
index 776037611..d2e0d691b 100644
--- a/doc/figs/undigraph.fig
+++ b/doc/figs/undigraph.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/figs/visitor.fig b/doc/figs/visitor.fig
index d4d351a66..0d2a284c6 100644
--- a/doc/figs/visitor.fig
+++ b/doc/figs/visitor.fig
@@ -2,7 +2,7 @@
Landscape
Center
Inches
-Letter
+Letter
100.00
Single
-2
diff --git a/doc/file_dependency_example.html b/doc/file_dependency_example.html
index f5def38c5..bbf1d03eb 100644
--- a/doc/file_dependency_example.html
+++ b/doc/file_dependency_example.html
@@ -1,17 +1,17 @@
File Dependency Example
-
-
+
+
@@ -108,9 +108,9 @@ Graph Setup
- enum files_e { dax_h, yow_h, boz_h, zow_h, foo_cpp,
+ enum files_e { dax_h, yow_h, boz_h, zow_h, foo_cpp,
foo_o, bar_cpp, bar_o, libfoobar_a,
- zig_cpp, zig_o, zag_cpp, zag_o,
+ zig_cpp, zig_o, zag_cpp, zag_o,
libzigzag_a, killerapp, N };
const char* name[] = { "dax.h", "yow.h", "boz.h", "zow.h", "foo.cpp",
"foo.o", "bar.cpp", "bar.o", "libfoobar.a",
@@ -122,7 +122,7 @@ Graph Setup
Edge(dax_h, foo_cpp), Edge(dax_h, bar_cpp), Edge(dax_h, yow_h),
Edge(yow_h, bar_cpp), Edge(yow_h, zag_cpp),
Edge(boz_h, bar_cpp), Edge(boz_h, zig_cpp), Edge(boz_h, zag_cpp),
- Edge(zow_h, foo_cpp),
+ Edge(zow_h, foo_cpp),
Edge(foo_cpp, foo_o),
Edge(foo_o, libfoobar_a),
Edge(bar_cpp, bar_o),
@@ -136,7 +136,7 @@ Graph Setup
};
using namespace boost;
- typedef adjacency_list<vecS, vecS, bidirectionalS,
+ typedef adjacency_list<vecS, vecS, bidirectionalS,
property<vertex_color_t, default_color_type>
> Graph;
Graph g(used_by, used_by + sizeof(used_by) / sizeof(Edge), N);
@@ -175,7 +175,7 @@ Compilation Order (All Files)
typedef std::list<Vertex> MakeOrder;
MakeOrder make_order;
boost::topological_sort(g, std::front_inserter(make_order));
-
+
std::cout << "make ordering: ";
for (MakeOrder::iterator i = make_order.begin();
i != make_order.end(); ++i)
@@ -229,7 +229,7 @@
zero.
- for (i = make_order.begin(); i != make_order.end(); ++i) {
+ for (i = make_order.begin(); i != make_order.end(); ++i) {
if (in_degree (*i, g) > 0) {
Graph::in_edge_iterator j, j_end;
int maxdist = 0;
@@ -253,8 +253,8 @@
The output is:
- parallel make ordering,
- vertices with same group number
+ parallel make ordering,
+ vertices with same group number
can be made in parallel
time_slot[dax.h] = 0
time_slot[yow.h] = 1
@@ -289,7 +289,7 @@
href="./depth_first_search.html">depth-first search, and if the
search runs into an already discovered vertex (of the current search
tree), then there is a cycle. The BGL graph search algorithms (which
-includes
+includes
depth_first_search()) are all extensible via the
visitor mechanism. A visitor is similar to a function object,
but it has several methods instead of just the one
@@ -304,7 +304,7 @@
method, which is the DFSVisitor method
that is called when DFS explores an edge to an already discovered
vertex. A call to this method indicates the existence of a
-cycle. Inheriting from dfs_visitor<>
+cycle. Inheriting from dfs_visitor<>
provides the visitor with empty versions of the other visitor methods.
Once our visitor is created, we can construct and object and pass it
to the BGL algorithm. Visitor objects are passed by value inside of
@@ -315,7 +315,7 @@
struct cycle_detector : public dfs_visitor<>
{
- cycle_detector( bool& has_cycle)
+ cycle_detector( bool& has_cycle)
: _has_cycle(has_cycle) { }
template <class Edge, class Graph>
@@ -360,4 +360,4 @@
-
+
diff --git a/doc/filtered_graph.html b/doc/filtered_graph.html
index 2b4b9675a..66527b0e9 100644
--- a/doc/filtered_graph.html
+++ b/doc/filtered_graph.html
@@ -1,17 +1,17 @@
Boost Graph Library: Filtered Graph
-
-
+
+
@@ -71,7 +71,7 @@ Example
int main()
{
using namespace boost;
-
+
typedef adjacency_list<vecS, vecS, directedS,
no_property, property<edge_weight_t, int> > Graph;
typedef property_map<Graph, edge_weight_t>::type EdgeWeightMap;
@@ -85,7 +85,7 @@ Example
add_edge(C, E, 0, g);
add_edge(D, B, 3, g);
add_edge(E, C, 0, g);
-
+
positive_edge_weight<EdgeWeightMap> filter(get(edge_weight, g));
filtered_graph<Graph, positive_edge_weight<EdgeWeightMap> >
fg(g, filter);
@@ -95,19 +95,19 @@ Example
std::cout << "filtered out-edges:" << std::endl;
print_graph(fg, name);
-
+
return 0;
}
The output is:
-filtered edge set: (A,B) (C,D) (D,B)
+filtered edge set: (A,B) (C,D) (D,B)
filtered out-edges:
-A --> B
-B -->
-C --> D
-D --> B
-E -->
+A --> B
+B -->
+C --> D
+D --> B
+E -->
@@ -274,7 +274,7 @@
Associated Types
and
property_map<filtered_graph, Property>::const_type
-The property map type for vertex or edge properties in the graph.
+The property map type for vertex or edge properties in the graph.
The same property maps from the adapted graph are available
in the filtered graph.
@@ -405,7 +405,7 @@ Structure Access
degree_size_type
in_degree(vertex_descriptor u, const filtered_graph& g)
-Returns the number of edges entering vertex u.
+Returns the number of edges entering vertex u.
@@ -413,7 +413,7 @@ Structure Access
vertices_size_type
num_vertices(const filtered_graph& g)
-Returns the number of vertices in the underlying graph [2].
+Returns the number of vertices in the underlying graph [2].
@@ -514,7 +514,7 @@ Notes
calculate, and the second is that it would interact badly with the
underlying vertex/edge index mappings. The index mapping would no
longer fall in the range [0,num_vertices(g)) (resp. [0,
-num_edges(g))) which is assumed in many of the algorithms.
+num_edges(g))) which is assumed in many of the algorithms.
@@ -532,4 +532,4 @@ Notes
-
+
diff --git a/doc/find_flow_cost.html b/doc/find_flow_cost.html
index 7f839cf90..63c0274be 100644
--- a/doc/find_flow_cost.html
+++ b/doc/find_flow_cost.html
@@ -1,17 +1,17 @@
Boost Graph Library: Find Flow Cost
-
-
+
+
@@ -29,19 +29,19 @@
// non-named parameter version
template<class Graph, class Capacity, class ResidualCapacity, class Weight>
typename property_traits<typename property_map < Graph, edge_capacity_t >::type>::value_type
-find_flow_cost(const Graph & g, Capacity capacity, ResidualCapacity residual_capacity, Weight weight)
+find_flow_cost(const Graph & g, Capacity capacity, ResidualCapacity residual_capacity, Weight weight)
The find_flow_cost() function calculates the minimum cost maximum flow value of a network and given flow. See Section Network
-Flow Algorithms for a description of maximum flow.
+Flow Algorithms for a description of maximum flow.
The function calculates the cost from the flow values f(u,v) for (u,v) in
E, which are passed in the form of the residual capacity
-r(u,v) = c(u,v) - f(u,v).
+r(u,v) = c(u,v) - f(u,v).
-In order to compute the min cost max flow use :
+In order to compute the min cost max flow use :
successive_shortest_path_nonnegative_weights() or
cycle_canceling().
@@ -73,7 +73,7 @@
Named Parameters
key type of the map must be the graph's edge descriptor type.
Default: get(edge_capacity, g)
-
+
IN: residual_capacity_map(ResidualCapacityEdgeMap res)
This maps edges to their residual capacity. The type must be a model
@@ -85,7 +85,7 @@ Named Parameters
-IN: weight_map(WeightMap w_map)
+IN: weight_map(WeightMap w_map)
The weight or ``cost'' of each edge in the graph.
The type WeightMap must be a model of
@@ -98,7 +98,7 @@ Named Parameters
Complexity
-The complexity is O(|E|),
+The complexity is O(|E|),
Example
@@ -119,7 +119,7 @@ See Also
-
+
Floyd-Warshall All Pairs Shortest Paths
-
-
+
+
@@ -62,7 +62,7 @@
This algorithm should be used to compute shortest paths between
every pair of vertices for dense graphs. For sparse graphs, use johnson_all_pairs_shortest_paths.
+href="johnson_all_pairs_shortest.html">johnson_all_pairs_shortest_paths
.
Where Defined
@@ -81,14 +81,14 @@ Parameters
OUT: DistanceMatrix& d
The length of the shortest path between each pair of vertices
-u,v are
+u,v are
stored in the matrix at location D[u][v]. The
-DistanceMatrix must be
+DistanceMatrix must be
of type {M, I, V} where I is of type
vertex_descriptor and V is the
type of the weight_map. The set of types must be a model of
BasicMatrix, with the exceptions that
-it isn't required to
+it isn't required to
run in constant time, and it must be mutable. The matrix must be
properly initialized when it is passed to the function
floyd_warshall_initialized_all_pairs_shortest_paths. If the
@@ -102,7 +102,7 @@ Named Parameters
The weight of length of each edge in the graph. The WeightMap
must be a model of Readable Property
-Map. The edge descriptor
+Map. The edge descriptor
type of the graph needs to be usable as the key type for the weight
map. The value_type of the weight map must be the type of the
DistanceMatrix, and must always either be part of the
@@ -164,4 +164,4 @@ Complexity
-
+
diff --git a/doc/fruchterman_reingold.html b/doc/fruchterman_reingold.html
index 738d253f5..a47f35cd7 100644
--- a/doc/fruchterman_reingold.html
+++ b/doc/fruchterman_reingold.html
@@ -1,7 +1,7 @@
Graph Coloring Example
-
-
+
+
@@ -112,11 +112,11 @@ Graph Coloring
namespace boost {
- template <class VertexListGraph, class Order, class Degree,
+ template <class VertexListGraph, class Order, class Degree,
class Marker, class BucketSorter>
- void
- smallest_last_ordering(const VertexListGraph& G, Order order,
- Degree degree, Marker marker,
+ void
+ smallest_last_ordering(const VertexListGraph& G, Order order,
+ Degree degree, Marker marker,
BucketSorter& degree_buckets) {
typedef typename graph_traits<VertexListGraph> GraphTraits;
@@ -125,43 +125,43 @@ Graph Coloring
typedef size_t size_type;
const size_type num = num_vertices(G);
-
+
typename GraphTraits::vertex_iterator v, vend;
for (boost::tie(v, vend) = vertices(G); v != vend; ++v) {
put(marker, *v, num);
put(degree, *v, out_degree(*v, G));
degree_buckets.push(*v);
}
-
+
size_type minimum_degree = 1;
size_type current_order = num - 1;
-
+
while ( 1 ) {
typedef typename BucketSorter::stack MDStack;
MDStack minimum_degree_stack = degree_buckets[minimum_degree];
while (minimum_degree_stack.empty())
minimum_degree_stack = degree_buckets[++minimum_degree];
-
+
Vertex node = minimum_degree_stack.top();
put(order, current_order, node);
-
+
if ( current_order == 0 ) //find all vertices
break;
-
+
minimum_degree_stack.pop();
put(marker, node, 0); //node has been ordered.
-
+
typename GraphTraits::adjacency_iterator v, vend;
for (boost::tie(v,vend) = adjacent_vertices(node, G); v != vend; ++v)
-
+
if ( get(marker, *v) > current_order ) { //*v is unordered vertex
put(marker, *v, current_order); //mark the columns adjacent to node
-
+
//It is possible minimum degree goes down
//Here we keep tracking it.
- put(degree, *v, get(degree, *v) - 1);
- minimum_degree = std::min(minimum_degree, get(degree, *v));
-
+ put(degree, *v, get(degree, *v) - 1);
+ minimum_degree = std::min(minimum_degree, get(degree, *v));
+
//update the position of *v in the bucket sorter
degree_buckets.update(*v);
}
@@ -188,4 +188,4 @@ Graph Coloring
-
+
diff --git a/doc/graph_concepts.html b/doc/graph_concepts.html
index 64898b24d..413ab5297 100644
--- a/doc/graph_concepts.html
+++ b/doc/graph_concepts.html
@@ -1,17 +1,17 @@
Boost Graph Concepts
-
-
+
+
@@ -130,30 +130,30 @@ Notation
Table 1:
Summary of the graph concepts.
-
+
Expression
Return Type or Description
-
+
Graph
-
+
boost::graph_traits<G>::vertex_descriptor
The type for
vertex representative objects.
-
+
boost::graph_traits<G>::edge_descriptor
The type for
edge representative objects.
-
+
boost::graph_traits<G>::directed_category
Directed or undirected?
-
+
boost::graph_traits<G>::edge_parallel_category
Allow parallel edges?
@@ -163,201 +163,201 @@ Notation
the graph can be visited.
-
+
IncidenceGraph refines Graph
-
+
boost::graph_traits<G>::out_edge_iterator
Iterate through
the out-edges.
-
+
boost::graph_traits<G>::degree_size_type
The integer type for
vertex degree.
-
+
out_edges(v, g)
std::pair<out_edge_iterator, out_edge_iterator>
-
+
source(e, g)
vertex_descriptor
-
+
target(e, g)
vertex_descriptor
-
+
out_degree(v, g)
degree_size_type
-
+
BidirectionalGraph refines
IncidenceGraph
-
+
boost::graph_traits<G>::in_edge_iterator
Iterate through the in-edges.
-
+
in_edges(v, g)
std::pair<in_edge_iterator, in_edge_iterator>
-
+
in_degree(v, g)
degree_size_type
-
+
degree(e, g)
degree_size_type
-
+
AdjacencyGraph refines Graph
-
+
boost::graph_traits<G>::adjacency_iterator
Iterate through
adjacent vertices.
-
+
adjacent_vertices(v, g)
std::pair<adjacency_iterator, adjacency_iterator>
-
+
VertexListGraph refines
Graph
-
+
boost::graph_traits<G>::vertex_iterator
Iterate through the
graph's vertex set.
-
+
boost::graph_traits<G>::vertices_size_type
The unsigned integer type for
number of vertices in the graph.
-
+
vertices(g)
std::pair<vertex_iterator, vertex_iterator>
-
+
num_vertices(g)
vertices_size_type
-
+
EdgeListGraph refines Graph
-
+
boost::graph_traits<G>::edge_iterator
Iterate through the graph's
edge set.
-
+
boost::graph_traits<G>::edges_size_type
The unsigned integer type for
number of edges in the graph.
-
+
edges(g)
std::pair<edge_iterator, edge_iterator>
-
+
num_edges(g)
edges_size_type
-
+
source(e, g)
vertex_descriptor
-
+
target(e, g)
vertex_descriptor
-
+
AdjacencyMatrix refines Graph
-
+
edge(u, v, g)
std::pair<edge_descriptor, bool>
-
+
MutableGraph refines
Graph
-
+
add_vertex(g)
vertex_descriptor
-
+
clear_vertex(v, g)
void
-
+
remove_vertex(v, g)
void
-
+
add_edge(u, v, g)
std::pair<edge_descriptor, bool>
-
+
remove_edge(u, v, g)
void
-
+
remove_edge(e, g)
void
-
+
remove_edge(e_iter, g)
void
-
+
MutablePropertyGraph refines
Graph
-
+
add_vertex(vp, g)
vertex_descriptor
-
+
add_edge(u, v, ep, g)
std::pair<edge_descriptor,
bool>
-
+
PropertyGraph refines Graph
-
+
boost::property_map<G, Property>::type
Type for a mutable property map.
-
+
boost::property_map<G, Property>::const_type
Type for a non-mutable property map.
-
+
get(property, g)
Function to get a property map.
-
+
get(property, g, x)
Get property value for vertex or edge x.
-
+
put(property, g, x, v)
Set property value for vertex or edge
@@ -406,10 +406,10 @@
std::cout << "the edges incident to v: ";
boost::graph_traits<UndirectedGraph>::out_edge_iterator e, e_end;
- boost::graph_traits<UndirectedGraph>::vertex_descriptor
+ boost::graph_traits<UndirectedGraph>::vertex_descriptor
s = vertex(0, undigraph);
for (boost::tie(e, e_end) = out_edges(s, undigraph); e != e_end; ++e)
- std::cout << "(" << source(*e, undigraph)
+ std::cout << "(" << source(*e, undigraph)
<< "," << target(*e, undigraph) << ")" << endl;
@@ -495,4 +495,4 @@
-
+
diff --git a/doc/graph_theory_review.html b/doc/graph_theory_review.html
index 6fec7b73b..d48957275 100644
--- a/doc/graph_theory_review.html
+++ b/doc/graph_theory_review.html
@@ -2,17 +2,17 @@
Boost Graph Library: Graph Theory Review
-
-
+
+
@@ -352,7 +352,7 @@
- order of discovery: s r w v t x u y
+ order of discovery: s r w v t x u y
order of finish: s r w v t x u y
@@ -452,7 +452,7 @@ Minimum Spanning Tree Problem
HREF="bibliography.html#kruskal56">18]
for solving the minimum spanning tree problem. This is a greedy
algorithm to calculate the minimum spanning tree for an undirected
-graph with weighted edges.
+graph with weighted edges.
This is Prim's algorithm [Directed Graphs
-
+
diff --git a/doc/graph_traits.html b/doc/graph_traits.html
index 4c336e3ab..ab3fa12dc 100644
--- a/doc/graph_traits.html
+++ b/doc/graph_traits.html
@@ -1,17 +1,17 @@
Boost Graph Library: Graph Traits
-
-
+
+
@@ -197,12 +197,12 @@ Members
The ways in which the vertices in the graph can be traversed.
-The traversal category tags are:
+The traversal category tags are:
incidence_graph_tag, adjacency_graph_tag,
bidirectional_graph_tag, vertex_list_graph_tag,
edge_list_graph_tag, vertex_and_edge_list_graph_tag,
adjacency_matrix_tag. You can also create your own
-tag which should inherit from one of the above.
+tag which should inherit from one of the above.
@@ -253,4 +253,4 @@ Members
-
+
diff --git a/doc/grid_graph.html b/doc/grid_graph.html
index 2a7b509de..261dd57cf 100644
--- a/doc/grid_graph.html
+++ b/doc/grid_graph.html
@@ -1,7 +1,7 @@
@@ -48,7 +48,7 @@
- Grid Graph Member Functions
- Overview
+ Overview
A grid_graph represents a multi-dimensional,
rectangular grid of vertices with user-defined dimension lengths
@@ -130,7 +130,7 @@
Example
Figure 2: A 3x3 two-dimensional, wrapped grid graph
-
+
Indexing
@@ -243,7 +243,7 @@ Member Functions
// dimension is unwrapped, previous will stop at the beginning vertex in the dimension.
Traits::vertex_descriptor previous(Traits::vertex_descriptor vertex,
std::size_t dimension,
- Traits::vertices_size_type distance = 1);
+ Traits::vertices_size_type distance = 1);
Example
@@ -301,4 +301,4 @@ Example
Copyright © 2009 Trustees of Indiana University
-
+
diff --git a/doc/gursoy_atun_layout.html b/doc/gursoy_atun_layout.html
index f65cf5efd..1c180a35e 100644
--- a/doc/gursoy_atun_layout.html
+++ b/doc/gursoy_atun_layout.html
@@ -1,7 +1,7 @@
Boost Graph Library: History
-
-
+
+
@@ -121,7 +121,7 @@ Changes by version
- Bundled properties now work with adjacency list I/O.
- floyd_warshall_all_pairs_shortest_paths now properly uses its compare, inf, and zero parameters.
- johnson_all_pairs_shortest_paths now supports compare, combine, inf, and zero.
- - Fixed a bug in smallest_last_vertex_ordering.hpp which could cause a vertex to be moved to the wrong bucket during an BucketSorter update.
+
- Fixed a bug in smallest_last_vertex_ordering.hpp which could cause a vertex to be moved to the wrong bucket during an BucketSorter update.
@@ -153,7 +153,7 @@ Changes by version
- dijkstra_shortest_paths now uses a relaxed heap [61] as its priority queue, improving its complexity to O(V log V) and improving real-world performance for larger graphs.
read_graphviz now has a new, Spirit-based parser that works for all graph types and supports arbitrary properties on the graph, from Ron Garcia. The old, Bison-based GraphViz reader has been deprecated and will be removed in a future Boost release.
-
+
write_graphviz now
supports output of dynamic properties (as read in through the
@@ -164,7 +164,7 @@ Changes by version
has been recast as an invocation of
breadth_first_search and now supports graphs with
multiple components.
-
+
- subgraph now supports
bundled
properties.
get_property now refers to the
@@ -205,7 +205,7 @@ Changes by version
-
+
Boost Graph Library: incident
-
-
+
+
@@ -76,4 +76,4 @@ Example
-
+
diff --git a/doc/incremental_components.html b/doc/incremental_components.html
index a6be2b077..181791be3 100644
--- a/doc/incremental_components.html
+++ b/doc/incremental_components.html
@@ -1,7 +1,7 @@
-
-
+
+
@@ -54,22 +54,22 @@ Incremental Connected Components
-- initialize_incremental_components(g, ds)
+
- initialize_incremental_components(g, ds)
Basic initialization of the disjoint-sets structure. Each
vertex in the graph g is in its own set.
-- incremental_components(g, ds)
+
- incremental_components(g, ds)
The connected components are calculated based on the edges in the graph
g and the information is embedded in ds.
-- ds.find_set(v)
+
- ds.find_set(v)
Extracts the component information for vertex v from the
disjoint-sets.
-- ds.union_set(u, v)
+
- ds.union_set(u, v)
Update the disjoint-sets structure when edge (u,v) is added to the graph.
@@ -103,7 +103,7 @@ Example
using namespace boost;
-int main(int argc, char* argv[])
+int main(int argc, char* argv[])
{
typedef adjacency_list Graph;
typedef graph_traits::vertex_descriptor Vertex;
@@ -137,11 +137,11 @@ Example
boost::tie(edge, flag) = add_edge(2, 5, graph);
ds.union_set(2,5);
-
+
std::cout << "An undirected graph:" << std::endl;
print_graph(graph, get(boost::vertex_index, graph));
std::cout << std::endl;
-
+
BOOST_FOREACH(Vertex current_vertex, vertices(graph)) {
std::cout << "representative[" << current_vertex << "] = " <<
ds.find_set(current_vertex) << std::endl;
@@ -199,7 +199,7 @@
-template <class VertexListGraph, class DisjointSets>
+template <class VertexListGraph, class DisjointSets>
void initialize_incremental_components(VertexListGraph& G, DisjointSets& ds)
@@ -350,7 +350,7 @@ Where Defined
Members
-
+
@@ -392,7 +392,7 @@ Members
Returns an iterator past the end of the component indices (size()).
-
+
std::pair<component_iterator, component_iterator> operator[size_type index] const
@@ -400,7 +400,7 @@ Members
-
+
@@ -417,4 +417,4 @@ Members
-
+
diff --git a/doc/index.html b/doc/index.html
index 61bc71b15..3a7b9d89a 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -3,7 +3,7 @@
Boost Graph Library: is_kuratowski_subgraph
-
-
+
+
@@ -24,47 +24,47 @@ is_kuratowski_subgraph
-is_kuratowski_subgraph(g, begin, end) returns true exactly
-when the sequence of edges defined by the range [begin, end) forms a
- Kuratowski subgraph in
-the graph g. If you need to verify that an arbitrary graph has a
-K5 or K3,3 minor, you should use the
+is_kuratowski_subgraph(g, begin, end) returns true exactly
+when the sequence of edges defined by the range [begin, end) forms a
+ Kuratowski subgraph in
+the graph g. If you need to verify that an arbitrary graph has a
+K5 or K3,3 minor, you should use the
function boyer_myrvold_planarity_test
to isolate such a minor instead of this function. is_kuratowski_subgraph
- exists to aid in testing and verification of the function
-boyer_myrvold_planarity_test, and for that reason, it expects its
-input to be a restricted set of edges forming a Kuratowski subgraph, as
+ exists to aid in testing and verification of the function
+boyer_myrvold_planarity_test, and for that reason, it expects its
+input to be a restricted set of edges forming a Kuratowski subgraph, as
described in detail below.
-is_kuratowski_subgraph creates a temporary graph out of the sequence
-of edges given and repeatedly contracts edges until it ends up with a graph
-with either all edges of degree 3 or all edges of degree 4. The final
+is_kuratowski_subgraph creates a temporary graph out of the sequence
+of edges given and repeatedly contracts edges until it ends up with a graph
+with either all edges of degree 3 or all edges of degree 4. The final
contracted graph is then checked against K5 or
-K3,3 using the Boost Graph Library's
+K3,3 using the Boost Graph Library's
isomorphism
function. The contraction process starts by choosing edges adjacent to a vertex
-of degree 1 and contracting those. When none are left, it moves on to edges
+of degree 1 and contracting those. When none are left, it moves on to edges
adjacent to a vertex of degree 2. If only degree 3 vertices are left after this
-stage, the graph is checked against K3,3. Otherwise, if
-there's at least one degree 4 vertex, edges adjacent to degree 3 vertices are
+stage, the graph is checked against K3,3. Otherwise, if
+there's at least one degree 4 vertex, edges adjacent to degree 3 vertices are
contracted as neeeded and the final graph is compared to K5.
-In order for this process to be deterministic, we make the following two
+In order for this process to be deterministic, we make the following two
restrictions on the input graph given to is_kuratowski_subgraph:
-- No edge contraction needed to produce a kuratowski subgraph results in
-multiple edges between the same pair of vertices (No edge {a,b} will be
-contracted at any point in the contraction process if a and b
+
- No edge contraction needed to produce a kuratowski subgraph results in
+multiple edges between the same pair of vertices (No edge {a,b} will be
+contracted at any point in the contraction process if a and b
share a common neighbor.)
-
- If the graph contracts to a K5, once the graph has
-been contracted to only vertices of degree at least 3, no cycles exist that
+
- If the graph contracts to a K5, once the graph has
+been contracted to only vertices of degree at least 3, no cycles exist that
contain solely degree 3 vertices.
-The second restriction is needed both to discriminate between targeting a
-K5 or a K3,3 and to determinstically
-contract the vertices of degree 4 once the K5 has been
+The second restriction is needed both to discriminate between targeting a
+K5 or a K3,3 and to determinstically
+contract the vertices of degree 4 once the K5 has been
targeted. The Kuratowski subgraph output by the function
-boyer_myrvold_planarity_test is
+boyer_myrvold_planarity_test is
guaranteed to meet both of the above requirements.
@@ -84,14 +84,14 @@ Where Defined
IN: Graph& g
-An undirected graph with no self-loops or parallel edges. The graph type must
+An undirected graph with no self-loops or parallel edges. The graph type must
be a model of Vertex List Graph.
-IN: ForwardIterator
+IN: ForwardIterator
-A ForwardIterator with value_type
+A ForwardIterator with value_type
graph_traits<Graph>::edge_descriptor.
@@ -99,7 +99,7 @@ Where Defined
A Readable Property Map
- that maps vertices from g to distinct integers in the range
+ that maps vertices from g to distinct integers in the range
[0, num_vertices(g) )
Default: get(vertex_index,g)
@@ -122,5 +122,5 @@ Example
Copyright © 2007 Aaron Windsor (
aaron.windsor@gmail.com)
-
+
diff --git a/doc/is_straight_line_drawing.html b/doc/is_straight_line_drawing.html
index 8e8321b1c..0df33ac71 100644
--- a/doc/is_straight_line_drawing.html
+++ b/doc/is_straight_line_drawing.html
@@ -1,17 +1,17 @@
Boost Graph Library: is_straight_line_drawing
-
-
+
+
@@ -24,11 +24,11 @@ is_straight_line_drawing
-If drawing is a property map modeling the PositionMap
-concept, is_straight_line_drawing returns true exactly when no two of
+If drawing is a property map modeling the PositionMap
+concept, is_straight_line_drawing returns true exactly when no two of
the line segments induced by edges in the graph under drawing
intersect. This function works correctly in the presence of self-loops and
-parallel edges, and can be used to verify the output of the function
+parallel edges, and can be used to verify the output of the function
chrobak_payne_straight_line_embedding.
@@ -53,15 +53,15 @@
Parameters
href="EdgeListGraph.html">Edge List Graph
-IN: PositionMap
+IN: PositionMap
-A Readable LValue Property
+A Readable LValue Property
Map that models the Position Map concept. The Position Map concept requires
that the value mapped to be an object that has members x and
y. For example, if p models PositionMap and v
is a vertex in the graph, p[v].x and p[v].y are valid
-expressions. The type of x and y must be implicitly
+expressions. The type of x and y must be implicitly
convertable to std::size_t.
@@ -90,4 +90,4 @@ See Also
Copyright © 2007 Aaron Windsor (aaron.windsor@gmail.com)
-
+
diff --git a/doc/isomorphism-impl-v2.w b/doc/isomorphism-impl-v2.w
index 3cf608789..1fd53b8dd 100644
--- a/doc/isomorphism-impl-v2.w
+++ b/doc/isomorphism-impl-v2.w
@@ -172,7 +172,7 @@ if (iter != ordered_edges.end()) {
} else {
@
}
-} else
+} else
return true;
return false;
} // match()
@@ -236,7 +236,7 @@ M\=ATCH($k$, $v$) $\equiv$ \\
\>$in_k \leftarrow \forall (j,k) \in E_1[k] - E_1[k-1] \Big( (f(j),v) \in E_2[S \union \{ v \}] - E_2[S] \Big)$ \\
\>$out_v \leftarrow \forall (v,u) \in E_2[S \union \{ v \}] - E_2[S] \Big( (k,f^{-1}(u)) \in E_1[k] - E_1[k-1] \Big)$ \\
\>$in_v \leftarrow \forall (u,v) \in E_2[S \union \{ v \}] - E_2[S] \Big( (f^{-1}(u),k) \in E_1[k] - E_1[k-1] \Big)$ \\
-\>\textbf{return} $out_k \Land in_k \Land out_v \Land in_v$
+\>\textbf{return} $out_k \Land in_k \Land out_v \Land in_v$
\end{tabbing}
The problem with the exhaustive backtracking algorithm is that there
@@ -324,11 +324,11 @@ requirements on type template parameters are described below in the
@d Isomorphism function interface
@{
-template
-bool isomorphism(const Graph1& G1, const Graph2& G2, IsoMapping f,
- Invariant1 invariant1, Invariant2 invariant2,
+bool isomorphism(const Graph1& G1, const Graph2& G2, IsoMapping f,
+ Invariant1 invariant1, Invariant2 invariant2,
std::size_t max_invariant,
IndexMap1 index_map1, IndexMap2 index_map2)
@}
@@ -351,9 +351,9 @@ of global variables (non-reentrant, etc.).
{
@
@
- detail::isomorphism_algo
- algo(G1, G2, f, invariant1, invariant2, max_invariant,
+ detail::isomorphism_algo
+ algo(G1, G2, f, invariant1, invariant2, max_invariant,
index_map1, index_map2);
return algo.test_isomorphism();
}
@@ -563,7 +563,7 @@ target&1&2&3&1&2&3&5&6&4
The backtracking algorithm will scan through the edge array from left
to right to extend isomorphic subgraphs, and move back to the right
-when a match fails. We will want to
+when a match fails. We will want to
@@ -575,7 +575,7 @@ when a match fails. We will want to
For example, suppose we have already matched the vertices
-\{0,1,2\}, and
+\{0,1,2\}, and
@@ -648,7 +648,7 @@ class is as follows. EXPLAIN ficticious edges
@{
struct record_dfs_order : default_dfs_visitor
{
- record_dfs_order(std::vector& v, std::vector& e)
+ record_dfs_order(std::vector& v, std::vector& e)
: vertices(v), edges(e) { }
void start_vertex(vertex1_t v, const Graph1&) const {
@@ -778,7 +778,7 @@ public:
+ get(m_in_degree_map, v);
}
// The largest possible vertex invariant number
- size_type max() const {
+ size_type max() const {
return num_vertices(m_g) * num_vertices(m_g) + num_vertices(m_g);
}
private:
@@ -886,7 +886,7 @@ BGL_FORALL_ADJACENT_T(f[u], y, G2, Graph2)
bool verify = false;
assert(f_assigned[u] == true);
BGL_FORALL_ADJACENT_T(f[u], y, G2, Graph2) {
- if (y == f[v]) {
+ if (y == f[v]) {
verify = true;
break;
}
@@ -929,7 +929,7 @@ namespace boost {
namespace detail {
@
-
+
template
void compute_in_degree(const Graph& g, InDegreeMap in_degree_map)
{
@@ -950,12 +950,12 @@ void compute_in_degree(const Graph& g, InDegreeMap in_degree_map)
@
namespace detail {
-
-template
-bool isomorphism_impl(const Graph1& G1, const Graph2& G2,
+bool isomorphism_impl(const Graph1& G1, const Graph2& G2,
IsoMapping f, IndexMap1 index_map1, IndexMap2 index_map2,
const bgl_named_params& params)
{
@@ -977,9 +977,9 @@ bool isomorphism_impl(const Graph1& G1, const Graph2& G2,
choose_param(get_param(params, vertex_invariant2_t()), invariant2),
choose_param(get_param(params, vertex_max_invariant_t()), invariant2.max()),
index_map1, index_map2
- );
-}
-
+ );
+}
+
} // namespace detail
@@ -993,7 +993,7 @@ bool isomorphism(const Graph1& g1,
typename std::vector::size_type n = num_vertices(g1);
std::vector f(n);
return detail::isomorphism_impl
- (g1, g2,
+ (g1, g2,
choose_param(get_param(params, vertex_isomorphism_t()),
make_safe_iterator_property_map(f.begin(), f.size(),
choose_const_pmap(get_param(params, vertex_index1),
@@ -1023,7 +1023,7 @@ inline bool verify_isomorphism(const Graph1& g1, const Graph2& g2, IsoMap iso_ma
{
if (num_vertices(g1) != num_vertices(g2) || num_edges(g1) != num_edges(g2))
return false;
-
+
for (typename graph_traits::edge_iterator e1 = edges(g1).first;
e1 != edges(g1).second; ++e1) {
bool found_edge = false;
@@ -1034,11 +1034,11 @@ inline bool verify_isomorphism(const Graph1& g1, const Graph2& g2, IsoMap iso_ma
found_edge = true;
}
}
-
+
if (!found_edge)
return false;
}
-
+
return true;
}
diff --git a/doc/isomorphism-impl-v3.w b/doc/isomorphism-impl-v3.w
index 95e87eac4..16740adce 100644
--- a/doc/isomorphism-impl-v3.w
+++ b/doc/isomorphism-impl-v3.w
@@ -241,7 +241,7 @@ public:
+ get(m_in_degree_map, v);
}
// The largest possible vertex invariant number
- size_type max() const {
+ size_type max() const {
return num_vertices(m_g) * num_vertices(m_g) + num_vertices(m_g);
}
private:
@@ -302,7 +302,7 @@ bool match(edge_iter iter, int dfs_num_k)
else {
@
}
- } else
+ } else
return true;
return false;
}
@@ -355,7 +355,7 @@ counting, using \code{boost::bind} to create the predicate functor.
@d Count out-edges of $f(k)$ in $G_2[S]$
@{
-num_edges_on_k -=
+num_edges_on_k -=
count_if(adjacent_vertices(f[k], G2), make_indirect_pmap(in_S));
@}
@@ -397,7 +397,7 @@ BGL_FORALL_ADJ_T(f[i], v, G2, Graph2)
}
@}
-\paragraph{Case 3: both $i$ and $j$ are in $G_1[k]$.}
+\paragraph{Case 3: both $i$ and $j$ are in $G_1[k]$.}
Our goal is to check whether $(f(i),f(j)) \in E_2[S]$. If $f(j)$ is
in $Adj[f(i)]$ then we have a match for the edge $(i,j)$, and can
increment the counter for the number of edges incident on $k$ in
@@ -440,11 +440,11 @@ The requirements on the template parameters are described below in the
@d Isomorphism function interface
@{
-template
-bool isomorphism(const Graph1& G1, const Graph2& G2, IsoMapping f,
- Invariant1 invariant1, Invariant2 invariant2,
+bool isomorphism(const Graph1& G1, const Graph2& G2, IsoMapping f,
+ Invariant1 invariant1, Invariant2 invariant2,
std::size_t max_invariant, EdgeCompare edge_compare,
IndexMap1 index_map1, IndexMap2 index_map2)
@}
@@ -468,8 +468,8 @@ of global variables (non-reentrant, etc.).
@
@
detail::isomorphism_algo
- algo(G1, G2, f, invariant1, invariant2, max_invariant,
+ Invariant2, EdgeCompare, IndexMap1, IndexMap2>
+ algo(G1, G2, f, invariant1, invariant2, max_invariant,
edge_compare,
index_map1, index_map2);
return algo.test_isomorphism();
@@ -696,7 +696,7 @@ class is as follows.
@{
struct record_dfs_order : default_dfs_visitor
{
- record_dfs_order(std::vector& v, std::vector& e)
+ record_dfs_order(std::vector& v, std::vector& e)
: vertices(v), edges(e) { }
void discover_vertex(vertex1_t v, const Graph1&) const {
@@ -732,7 +732,7 @@ struct edge_cmp {
vertex1_t u2 = dfs_num[source(e2,G1)], v2 = dfs_num[target(e2,G1)];
int m1 = max(u1, v1);
int m2 = max(u2, v2);
- // lexicographical comparison
+ // lexicographical comparison
return make_pair(m1, make_pair(u1, v1))
< make_pair(m2, make_pair(u2, v2));
}
@@ -774,7 +774,7 @@ IndexMap2 index_map2;
std::vector dfs_vertices;
typedef typename std::vector::iterator vertex_iter;
std::vector dfs_num_vec;
-typedef safe_iterator_property_map::iterator,
+typedef safe_iterator_property_map::iterator,
IndexMap1> DFSNumMap;
DFSNumMap dfs_num;
std::vector ordered_edges;
@@ -791,7 +791,7 @@ int num_edges_on_k;
@d Isomorphism algorithm constructor
@{
isomorphism_algo(const Graph1& G1, const Graph2& G2, IsoMapping f,
- Invariant1 invariant1, Invariant2 invariant2,
+ Invariant1 invariant1, Invariant2 invariant2,
std::size_t max_invariant,
EdgeCompare edge_compare,
IndexMap1 index_map1, IndexMap2 index_map2)
@@ -836,7 +836,7 @@ namespace boost {
namespace detail {
@
-
+
template
void compute_in_degree(const Graph& g, InDegreeMap in_degree_map)
{
@@ -862,23 +862,23 @@ struct default_edge_compare {
template
bool operator()(Edge1 e1, Edge2 e2) const { return true; }
};
-
-template
-bool isomorphism_impl(const Graph1& G1, const Graph2& G2,
+bool isomorphism_impl(const Graph1& G1, const Graph2& G2,
IsoMapping f, IndexMap1 index_map1, IndexMap2 index_map2,
const bgl_named_params& params)
{
std::vector in_degree1_vec(num_vertices(G1));
- typedef safe_iterator_property_map::iterator,
+ typedef safe_iterator_property_map::iterator,
IndexMap1> InDeg1;
InDeg1 in_degree1(in_degree1_vec.begin(), in_degree1_vec.size(), index_map1);
compute_in_degree(G1, in_degree1);
std::vector in_degree2_vec(num_vertices(G2));
- typedef safe_iterator_property_map::iterator,
+ typedef safe_iterator_property_map::iterator,
IndexMap2> InDeg2;
InDeg2 in_degree2(in_degree2_vec.begin(), in_degree2_vec.size(), index_map2);
compute_in_degree(G2, in_degree2);
@@ -890,13 +890,13 @@ bool isomorphism_impl(const Graph1& G1, const Graph2& G2,
return isomorphism(G1, G2, f,
choose_param(get_param(params, vertex_invariant1_t()), invariant1),
choose_param(get_param(params, vertex_invariant2_t()), invariant2),
- choose_param(get_param(params, vertex_max_invariant_t()),
+ choose_param(get_param(params, vertex_max_invariant_t()),
invariant2.max()),
choose_param(get_param(params, edge_compare_t()), edge_cmp),
index_map1, index_map2
- );
-}
-
+ );
+}
+
} // namespace detail
@@ -910,7 +910,7 @@ bool isomorphism(const Graph1& g1,
typename std::vector::size_type n = num_vertices(g1);
std::vector f(n);
return detail::isomorphism_impl
- (g1, g2,
+ (g1, g2,
choose_param(get_param(params, vertex_isomorphism_t()),
make_safe_iterator_property_map(f.begin(), f.size(),
choose_const_pmap(get_param(params, vertex_index1),
@@ -943,7 +943,7 @@ inline bool verify_isomorphism(const Graph1& g1, const Graph2& g2, IsoMap iso_ma
if (num_vertices(g1) != num_vertices(g2) || num_edges(g1) != num_edges(g2))
return false;
#endif
-
+
for (typename graph_traits::edge_iterator e1 = edges(g1).first;
e1 != edges(g1).second; ++e1) {
bool found_edge = false;
@@ -954,11 +954,11 @@ inline bool verify_isomorphism(const Graph1& g1, const Graph2& g2, IsoMap iso_ma
found_edge = true;
}
}
-
+
if (!found_edge)
return false;
}
-
+
return true;
}
diff --git a/doc/isomorphism-impl.w b/doc/isomorphism-impl.w
index 868760c45..48c086a3e 100644
--- a/doc/isomorphism-impl.w
+++ b/doc/isomorphism-impl.w
@@ -152,7 +152,7 @@ in-edges $(u,v)$ of $v$ where $u \in S$.
M\=ATCH($k$, $v$) $\equiv$ \\
\>$out \leftarrow \forall (k,j) \in E_1[k] - E_1[k-1] \Big( (v,f(j)) \in E_2[S \union \{ v \}] - E_2[S] \Big)$ \\
\>$in \leftarrow \forall (j,k) \in E_1[k] - E_1[k-1] \Big( (f(j),v) \in E_2[S \union \{ v \}] - E_2[S] \Big)$ \\
-\>\textbf{return} $out \Land in$
+\>\textbf{return} $out \Land in$
\end{tabbing}
The problem with the exhaustive backtracking algorithm is that there
@@ -192,7 +192,7 @@ help rule out vertices.
M\=A\=T\=C\=H-INVAR($k$, $v$) $\equiv$ \\
\>$out \leftarrow \forall (k,j) \in E_1[k] - E_1[k-1] \Big( (v,f(j)) \in E_2[S \union \{ v \}] - E_2[S] \Land i(v) = i(k) \Big)$ \\
\>$in \leftarrow \forall (j,k) \in E_1[k] - E_1[k-1] \Big( (f(j),v) \in E_2[S \union \{ v \}] - E_2[S] \Land i(v) = i(k) \Big)$ \\
-\>\textbf{return} $out \Land in$
+\>\textbf{return} $out \Land in$
\end{tabbing}
\section{Vertex Order}
@@ -240,12 +240,12 @@ below in the section ``Concept checking''.
@d Isomorphism Function Interface
@{
-template
-bool isomorphism(const Graph1& g1, const Graph2& g2,
- IndexMapping f,
+bool isomorphism(const Graph1& g1, const Graph2& g2,
+ IndexMapping f,
VertexInvariant1 invariant1, VertexInvariant2 invariant2,
IndexMap1 index_map1, IndexMap2 index_map2)
@}
@@ -358,7 +358,7 @@ public:
+ get(m_in_degree_map, v);
}
// The largest possible vertex invariant number
- result_type max() const {
+ result_type max() const {
return num_vertices(m_g) * num_vertices(m_g) + num_vertices(m_g);
}
private:
@@ -414,7 +414,7 @@ invariants, and then check to see if they are equal.
invar_vec2_t invar2_tmp(invar2_vec);
std::sort(invar1_tmp.begin(), invar1_tmp.end());
std::sort(invar2_tmp.begin(), invar2_tmp.end());
- if (! std::equal(invar1_tmp.begin(), invar1_tmp.end(),
+ if (! std::equal(invar1_tmp.begin(), invar1_tmp.end(),
invar2_tmp.begin()))
return false;
}
@@ -428,7 +428,7 @@ graph to record the multiplicity.
@d Compute invariant multiplicity
@{
std::vector invar_mult(invariant1.max(), 0);
-for (tie(i1, i1_end) = vertices(g1); i1 != i1_end; ++i1)
+for (tie(i1, i1_end) = vertices(g1); i1 != i1_end; ++i1)
++invar_mult[invar1[*i1]];
@}
@@ -516,12 +516,12 @@ the order in which DFS discovers the vertices.
std::vector color_vec(num_vertices(g1));
for (typename std::vector::iterator ui = g1_vertices.begin();
ui != g1_vertices.end(); ++ui) {
- if (color_vec[get(index_map1, *ui)]
+ if (color_vec[get(index_map1, *ui)]
== color_traits::white()) {
depth_first_visit
- (g1, *ui, detail::record_dfs_order(perm,
- index_map1),
- make_iterator_property_map(&color_vec[0], index_map1,
+ (g1, *ui, detail::record_dfs_order(perm,
+ index_map1),
+ make_iterator_property_map(&color_vec[0], index_map1,
color_vec[0]));
}
}
@@ -540,13 +540,13 @@ namespace detail {
typedef typename graph_traits::vertices_size_type size_type;
typedef typename graph_traits::vertex_descriptor vertex;
- record_dfs_order(std::vector& dfs_order, IndexMap1 index)
+ record_dfs_order(std::vector& dfs_order, IndexMap1 index)
: dfs_order(dfs_order), index(index) { }
void discover_vertex(vertex v, const Graph1& g) const {
dfs_order.push_back(get(index, v));
}
- std::vector& dfs_order;
+ std::vector& dfs_order;
IndexMap1 index;
};
} // namespace detail
@@ -570,7 +570,7 @@ typedef typename graph_traits::edge_descriptor edge1_t;
std::vector edge_set;
std::copy(edges(g1).first, edges(g1).second, std::back_inserter(edge_set));
-std::sort(edge_set.begin(), edge_set.end(),
+std::sort(edge_set.begin(), edge_set.end(),
detail::edge_ordering
(make_iterator_property_map(perm.begin(), index_map1, perm[0]), g1));
@}
@@ -587,7 +587,7 @@ namespace detail {
template
std::size_t edge_order(const typename graph_traits::edge_descriptor e,
VertexIndexMap index_map, const Graph& g) {
- return std::max(get(index_map, source(e, g)), get(index_map, target(e, g)));
+ return std::max(get(index_map, source(e, g)), get(index_map, target(e, g)));
}
template
@@ -627,7 +627,7 @@ std::vector not_in_S_vec(num_vertices(g2), true);
iterator_property_map
not_in_S(¬_in_S_vec[0], index_map2);
-return detail::isomorph(g1_vertices.begin(), g1_vertices.end(),
+return detail::isomorph(g1_vertices.begin(), g1_vertices.end(),
edge_set.begin(), edge_set.end(), g1, g2,
make_iterator_property_map(perm.begin(), index_map1, perm[0]),
index_map2, f, invar1, invar2, not_in_S);
@@ -646,7 +646,7 @@ The mapping is recorded in the parameter \code{f}.
@d Signature for the recursive isomorph function
@{
template
bool isomorph(VertexIter k_iter, VertexIter last,
EdgeIter edge_iter, EdgeIter edge_iter_end,
@@ -686,7 +686,7 @@ vertex1_t k = *k_iter;
@d Return true if matching is complete
@{
-if (k_iter == last)
+if (k_iter == last)
return true;
@}
@@ -720,7 +720,7 @@ bool some_edges = false;
for (; edge_iter != edge_iter_end; ++edge_iter) {
if (get(index_map1, k) != edge_order(*edge_iter, index_map1, g1))
- break;
+ break;
if (k == source(*edge_iter, g1)) { // (k,j)
@
if (some_edges == false) {
@@ -807,8 +807,8 @@ digraph G {
ratio="fill"
subgraph cluster0 { label="G_1"
- k -> j_1
- k -> j_2
+ k -> j_1
+ k -> j_2
k -> j_3
}
@@ -952,8 +952,8 @@ mapping into the mapping from the previous calling function.
for (std::size_t j = 0; j < potential_matches.size(); ++j) {
my_f[k] = potential_matches[j];
@
- if (isomorph(boost::next(k_iter), last, edge_iter, edge_iter_end, g1, g2,
- index_map1, index_map2,
+ if (isomorph(boost::next(k_iter), last, edge_iter, edge_iter_end, g1, g2,
+ index_map1, index_map2,
my_f, invar1, invar2, my_not_in_S)) {
for (tie(i1, i1_end) = vertices(g1); i1 != i1_end; ++i1)
put(f, *i1, my_f[*i1]);
@@ -994,7 +994,7 @@ code parts into namespace \code{boost}.
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
-// See http://www.boost.org/libs/graph/doc/isomorphism-impl.pdf
+// See http://www.boost.org/libs/graph/doc/isomorphism-impl.pdf
// for a description of the implementation of the isomorphism function
// defined in this header file.
@@ -1061,11 +1061,11 @@ namespace boost {
}
- template
- bool isomorphism_impl(const Graph1& g1, const Graph2& g2,
- IndexMapping f,
+ bool isomorphism_impl(const Graph1& g1, const Graph2& g2,
+ IndexMapping f,
IndexMap1 index_map1, IndexMap2 index_map2,
const bgl_named_params& params)
{
@@ -1073,22 +1073,22 @@ namespace boost {
// Compute the in-degrees
std::vector in_degree_vec1(num_vertices(g1), 0);
- typedef iterator_property_map InDegreeMap1;
InDegreeMap1 in_degree_map1(&in_degree_vec1[0], index_map1);
detail::compute_in_degree(g1, in_degree_map1);
- degree_vertex_invariant
+ degree_vertex_invariant
default_invar1(in_degree_map1, g1);
std::vector in_degree_vec2(num_vertices(g2), 0);
- typedef iterator_property_map InDegreeMap2;
InDegreeMap2 in_degree_map2(&in_degree_vec2[0], index_map2);
detail::compute_in_degree(g2, in_degree_map2);
degree_vertex_invariant
default_invar2(in_degree_map2, g2);
- return isomorphism(g1, g2, f,
+ return isomorphism(g1, g2, f,
choose_param(get_param(params, vertex_invariant_t()), default_invar1),
choose_param(get_param(params, vertex_invariant_t()), default_invar2),
index_map1, index_map2);
@@ -1109,9 +1109,9 @@ namespace boost {
std::vector f(n);
vertex2_t x;
return detail::isomorphism_impl
- (g1, g2,
+ (g1, g2,
choose_param(get_param(params, vertex_isomorphism_t()),
- make_iterator_property_map(f.begin(),
+ make_iterator_property_map(f.begin(),
choose_const_pmap(get_param(params, vertex_index1),
g1, vertex_index), x)),
choose_const_pmap(get_param(params, vertex_index1),
@@ -1132,7 +1132,7 @@ namespace boost {
// Compute the in-degrees
std::vector in_degree_vec1(num_vertices(g1), 0);
typedef typename property_map::const_type IndexMap1;
- typedef iterator_property_map InDegreeMap1;
InDegreeMap1 in_degree_map1(&in_degree_vec1[0], get(vertex_index, g1));
detail::compute_in_degree(g1, in_degree_map1);
@@ -1141,11 +1141,11 @@ namespace boost {
std::vector in_degree_vec2(num_vertices(g2), 0);
typedef typename property_map::const_type IndexMap2;
- typedef iterator_property_map InDegreeMap2;
InDegreeMap2 in_degree_map2(&in_degree_vec2[0], get(vertex_index, g2));
detail::compute_in_degree(g2, in_degree_map2);
- degree_vertex_invariant
+ degree_vertex_invariant
invariant2(in_degree_map, g2);
return isomorphism
@@ -1159,7 +1159,7 @@ namespace boost {
// concepts modeled, but since we're verifying an O(n^(lg n)) algorithm,
// O(n^4) won't hurt us.
template
- inline bool verify_isomorphism(const Graph1& g1, const Graph2& g2,
+ inline bool verify_isomorphism(const Graph1& g1, const Graph2& g2,
IsoMap iso_map)
{
if (num_vertices(g1) != num_vertices(g2) || num_edges(g1) != num_edges(g2))
diff --git a/doc/isomorphism.html b/doc/isomorphism.html
index c1a2dd2b5..e0a4ca860 100644
--- a/doc/isomorphism.html
+++ b/doc/isomorphism.html
@@ -1,17 +1,17 @@
Boost Graph Library: Isomorphism
-
-
+
+
@@ -28,8 +28,8 @@
const bgl_named_params<P,T,R>& params = all defaults)
// non-named parameter version
-template <typename Graph1, typename Graph2, typename IsoMap,
- typename VertexInvariant1, typename VertexInvariant2,
+template <typename Graph1, typename Graph2, typename IsoMap,
+ typename VertexInvariant1, typename VertexInvariant2,
typename V1Map, typename V2Map>
bool isomorphism(const Graph1& g1, const Graph2& g2,
IsoMap f, VertexInvariant1 invariant2, VertexInvariant2 invariant2,
@@ -124,13 +124,13 @@ Named Parameters
IN: vertex_max_invariant(std::size_t max_invariant)
-An upper bound on the possible values returned from either
+An upper bound on the possible values returned from either
vertex_invariant1 or vertex_invariant2.
Default: vertex_invariant2.max(). The default
-vertex_invariant2 parameter, an instance of
+vertex_invariant2 parameter, an instance of
degree_vertex_invariant, defines this function to
-return num_vertices(g2) * (num_vertices(g2)+1).
+return num_vertices(g2) * (num_vertices(g2)+1).
Python: Unsupported parameter.
@@ -190,4 +190,4 @@ Example
-
+
diff --git a/doc/johnson_all_pairs_shortest.html b/doc/johnson_all_pairs_shortest.html
index 7303915cf..b78f0f62a 100644
--- a/doc/johnson_all_pairs_shortest.html
+++ b/doc/johnson_all_pairs_shortest.html
@@ -1,17 +1,17 @@
Johnson All Pairs Shortest Paths
-
-
+
+
@@ -22,12 +22,12 @@
// named parameter version
template <class VertexAndEdgeListGraph, class DistanceMatrix,
- class VertexID, class Weight, class BinaryPredicate,
+ class VertexID, class Weight, class BinaryPredicate,
class BinaryFunction, class Infinity, class DistanceZero>
bool
- johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph& g1,
+ johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph& g1,
DistanceMatrix& D,
- VertexID id1, Weight w1, const BinaryPredicate& compare,
+ VertexID id1, Weight w1, const BinaryPredicate& compare,
const BinaryFunction& combine, const Infinity& inf,
DistanceZero zero);
@@ -39,7 +39,7 @@
template <typename Graph, typename DistanceMatrix,
typename VertexIndex, typename WeightMap, typename DT>
bool
-johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph& g1,
+johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph& g1,
DistanceMatrix& D,
VertexIndex i_map, WeightMap w_map, DT zero)
@@ -86,7 +86,7 @@ Parameters
Named Parameters
-IN: weight_map(WeightMap w_map)
+IN: weight_map(WeightMap w_map)
The weight or "length" of each edge in the graph.
The type WeightMap must be a model of
@@ -96,12 +96,12 @@ Named Parameters
Default: get(edge_weight, g)
-UTIL: weight_map2(WeightMap2 w2_map)
+UTIL: weight_map2(WeightMap2 w2_map)
This parameter is no longer needed, and will be ignored.
-IN: vertex_index_map(VertexIndexMap i_map)
+IN: vertex_index_map(VertexIndexMap i_map)
This maps each vertex to an integer in the range [0,
num_vertices(g)). This is necessary for efficient updates of the
@@ -119,12 +119,12 @@ Named Parameters
-UTIL: distance_map(DistanceMap d_map)
+UTIL: distance_map(DistanceMap d_map)
This parameter is no longer needed, and will be ignored.
-IN: distance_compare(CompareFunction cmp)
+IN: distance_compare(CompareFunction cmp)
This function is use to compare distances to determine
which vertex is closer to the source vertex.
@@ -136,7 +136,7 @@ Named Parameters
DT=typename property_traits<WeightMap>::value_type
-IN: distance_combine(CombineFunction cmb)
+IN: distance_combine(CombineFunction cmb)
This function is used to combine distances to compute the distance
of a path. The CombineFunction type must be a model of Named Parameters
DT=typename property_traits<WeightMap>::value_type
-IN: distance_inf(DT inf)
+IN: distance_inf(DT inf)
This value is used to initialize the distance for each
- vertex before the start of the algorithm.
+ vertex before the start of the algorithm.
The type DT must be the value type of the WeightMap.
Default: std::numeric_limits::max()
-IN: distance_zero(DT zero)
+IN: distance_zero(DT zero)
This value is used to initialize the distance for the source
vertex before the start of the algorithm. The type DT
@@ -163,7 +163,7 @@ Named Parameters
Default: 0
-UTIL/OUT: color_map(ColorMap c_map)
+UTIL/OUT: color_map(ColorMap c_map)
This is used during the execution of the algorithm to mark the
vertices. The vertices start out white and become gray when they are
@@ -208,4 +208,4 @@ Example
-
+
diff --git a/doc/jwebfrob.pl b/doc/jwebfrob.pl
index 81006b330..0ad4d2625 100644
--- a/doc/jwebfrob.pl
+++ b/doc/jwebfrob.pl
@@ -38,7 +38,7 @@
$thispage = $4;
if ($thispage ne $lastpage) {
-
+
$counter = 1;
print $saved_empty;
diff --git a/doc/kamada_kawai_spring_layout.html b/doc/kamada_kawai_spring_layout.html
index 60e4ce06b..abc3ce662 100644
--- a/doc/kamada_kawai_spring_layout.html
+++ b/doc/kamada_kawai_spring_layout.html
@@ -2,7 +2,7 @@
Kevin Bacon Example
-
-
+
+
@@ -91,7 +91,7 @@ Input File and Graph Setup
using namespace boost;
- typedef adjacency_list<vecS, vecS, undirectedS,
+ typedef adjacency_list<vecS, vecS, undirectedS,
property<vertex_name_t, string>,
property<edge_name_t, string > >
> Graph;
@@ -149,7 +149,7 @@ Input File and Graph Setup
- NameVertexMap::iterator pos;
+ NameVertexMap::iterator pos;
bool inserted;
Vertex u, v;
@@ -173,7 +173,7 @@ Input File and Graph Setup
std::string movie_name = *i++;
-
+
boost::tie(pos, inserted) = actors.insert(std::make_pair(*i, Vertex()));
if (inserted) {
v = add_vertex(g);
@@ -185,7 +185,7 @@ Input File and Graph Setup
The final step is to add an edge connecting the two actors, and record
-the name of the connecting movie.
+the name of the connecting movie.
@@ -270,7 +270,7 @@ Apply the Breadth-First Search
graph_traits<Graph>::vertex_iterator i, end;
for (boost::tie(i, end) = vertices(g); i != end; ++i)
- std::cout << actor_name[*i] << "'s bacon number is "
+ std::cout << actor_name[*i] << "'s bacon number is "
<< bacon_number[*i] << std::endl;
@@ -290,7 +290,7 @@ Apply the Breadth-First Search
Denise Richards's bacon number is 1
Kevin Bacon's bacon number is 0
Patrick Stewart's bacon number is 2
-Steve Martin's bacon number is 1
+Steve Martin's bacon number is 1
...
@@ -306,7 +306,7 @@ Apply the Breadth-First Search
-
+
-
-
-
+
+
+
Boost Graph Library: King Ordering
-
-
+
+
@@ -46,7 +46,7 @@
OutputIterator
king_ordering(const IncidenceGraph& g,
typename graph_traits<Graph>::vertex_descriptor s,
- OutputIterator inverse_permutation,
+ OutputIterator inverse_permutation,
ColorMap color, DegreeMap degree, VertexIndexMap index_map);
(2)
@@ -59,12 +59,12 @@
king_ordering(const IncidenceGraph& g, OutputIterator inverse_permutation,
VertexIndexMap index_map);
- template <class VertexListGraph, class OutputIterator,
+ template <class VertexListGraph, class OutputIterator,
class ColorMap, class DegreeMap, class VertexIndexMap>
OutputIterator
- king_ordering(const VertexListGraph& G, OutputIterator inverse_permutation,
+ king_ordering(const VertexListGraph& G, OutputIterator inverse_permutation,
ColorMap color, DegreeMap degree, VertexIndexMap index_map);
-
+
(3)
template <class IncidenceGraph, class OutputIterator,
class ColorMap, class DegreeMap, class VertexIndexMap>
@@ -72,7 +72,7 @@
king_ordering(const IncidenceGraph& g,
std::deque< typename
graph_traits<Graph>::vertex_descriptor > vertex_queue,
- OutputIterator permutation,
+ OutputIterator permutation,
ColorMap color, DegreeMap degree, VertexIndexMap index_map);
@@ -85,13 +85,13 @@
works by a local minimization of the i-th bandwidths. The vertices are
basically assigned a breadth-first search order, except that at each
step, the adjacent vertices are placed in the queue in order of
-increasing pseudo-degree, where pseudo-degree is defined as the number of
+increasing pseudo-degree, where pseudo-degree is defined as the number of
outgoing edges with white endpoints (vertices yet to be examined).
Version 1 of the algorithm lets the user choose the ``starting
vertex'', version 2 finds a good starting vertex using the
-pseudo-peripheral pair heuristic (among each component), while version 3
+pseudo-peripheral pair heuristic (among each component), while version 3
contains the starting nodes for each vertex in the deque. The choice of the ``starting
vertex'' can have a significant effect on the quality of the ordering.
@@ -124,7 +124,7 @@ Parameters
-- IncidenceGraph& g (IN)
+ - IncidenceGraph& g (IN)
An undirected graph. The graph's type must be a model of IncidenceGraph.
Python: The parameter is named graph.
@@ -133,14 +133,14 @@ Parameters
The starting vertex.
Python: Unsupported parameter.
- - OutputIterator permutation  (OUT)
+ - OutputIterator permutation  (OUT)
The new vertex ordering. The vertices are written to the output
iterator in their new order.
Python: This parameter is unused in Python. The new vertex
ordering is returned as a Python list.
-
+
- ColorMap color_map  (WORK)
Used internally to keep track of the progress of the algorithm
(to avoid visiting the same vertex twice).
@@ -157,13 +157,13 @@ Parameters
-- VertexListGraph& g (IN)
+ - VertexListGraph& g (IN)
An undirected graph. The graph's type must be a model of VertexListGraph.
Python: The name of this parameter is graph.
-
- OutputIterator permutation  (OUT)
+ OutputIterator permutation  (OUT)
The new vertex ordering. The vertices are written to the
output iterator in their new order.
Python: This parameter is unused in Python. The new vertex
@@ -184,7 +184,7 @@ Parameters
-- IncidenceGraph& g (IN)
+ - IncidenceGraph& g (IN)
An undirected graph. The graph's type must be a model of IncidenceGraph.
Python: The parameter is named graph.
@@ -194,10 +194,10 @@ Parameters
Python: This parameter is unused in Python. The new vertex
ordering is returned as a Python list.
- - OutputIterator permutation  (OUT)
+ - OutputIterator permutation  (OUT)
The new vertex ordering. The vertices are written to the output
- iterator in their new order.
+ iterator in their new order.
Python: This parameter is unused in Python. The new vertex
ordering is returned as a Python list.
@@ -232,4 +232,4 @@ See Also
-
+
diff --git a/doc/known_problems.html b/doc/known_problems.html
index 9684e510e..c236af6ed 100644
--- a/doc/known_problems.html
+++ b/doc/known_problems.html
@@ -1,7 +1,7 @@
Boost Graph Library: Kruskal Minimum Spanning Tree
-
-
+
+
@@ -24,7 +24,7 @@
template <class Graph, class OutputIterator, class P, class T, class R>
OutputIterator
-kruskal_minimum_spanning_tree(Graph& g, OutputIterator tree_edges,
+kruskal_minimum_spanning_tree(Graph& g, OutputIterator tree_edges,
const bgl_named_params<P, T, R>& params = all defaults);
@@ -56,15 +56,15 @@
-KRUSKAL-MST(G, w)
- T := Ø
- for each vertex u in V
- MAKE-SET(DS, u)
+KRUSKAL-MST(G, w)
+ T := Ø
+ for each vertex u in V
+ MAKE-SET(DS, u)
end for
- for each edge (u,v) in E in order of nondecreasing weight
- if FIND-SET(DS, u) != FIND-SET(DS, v)
- UNION-SET(DS, u, v)
- T := T U {(u,v)}
+ for each edge (u,v) in E in order of nondecreasing weight
+ if FIND-SET(DS, u) != FIND-SET(DS, v)
+ UNION-SET(DS, u, v)
+ T := T U {(u,v)}
end for
return T
@@ -79,7 +79,7 @@ Where Defined
Parameters
-IN: const Graph& g
+IN: const Graph& g
An undirected graph. The graph type must be a model of
Vertex List Graph
@@ -102,7 +102,7 @@ Parameters
Named Parameters
-IN: weight_map(WeightMap w_map)
+IN: weight_map(WeightMap w_map)
The weight or ``length'' of
each edge in the graph. The WeightMap type must be a model
@@ -116,7 +116,7 @@ Named Parameters
Python default: graph.get_edge_double_map("weight")
-UTIL: rank_map(RankMap r_map)
+UTIL: rank_map(RankMap r_map)
This is used by the disjoint sets data structure.
The type RankMap must be a model of Named Parameters
Python: Unsupported parameter.
-UTIL: predecessor_map(PredecessorMap p_map)
+UTIL: predecessor_map(PredecessorMap p_map)
This is used by the disjoint sets data structure, and is not
used for storing predecessors in the spanning tree. The predecessors
@@ -153,7 +153,7 @@ Named Parameters
Python: Unsupported parameter.
-IN: vertex_index_map(VertexIndexMap i_map)
+IN: vertex_index_map(VertexIndexMap i_map)
This maps each vertex to an integer in the range [0,
num_vertices(g)). This is only necessary if the default is used
@@ -196,4 +196,4 @@ Example
-
+
diff --git a/doc/layout_tolerance.html b/doc/layout_tolerance.html
index e0613ab85..5aa5512fd 100644
--- a/doc/layout_tolerance.html
+++ b/doc/layout_tolerance.html
@@ -1,21 +1,21 @@
-Struct template layout_tolerance 
Home Libraries People FAQ More
Struct template layout_tolerance
boost::layout_tolerance — Determines when to terminate layout of a particular graph based on a given relative tolerance.
Synopsis
template<typename T = double>
+Struct template layout_tolerance

Home Libraries People FAQ More
Struct template layout_tolerance
boost::layout_tolerance — Determines when to terminate layout of a particular graph based on a given relative tolerance.
Synopsis
template<typename T = double>
struct layout_tolerance {
// construct/copy/destruct
layout_tolerance(const T & = T(0.001));
// public member functions
- template<typename Graph>
- bool operator()(T,
- typename boost::graph_traits< Graph >::vertex_descriptor,
+ template<typename Graph>
+ bool operator()(T,
+ typename boost::graph_traits< Graph >::vertex_descriptor,
const Graph &, bool) ;
-};
Where Defined
boost/graph/kamada_kawai_spring_layout.hpp
diff --git a/doc/leda_conversion.html b/doc/leda_conversion.html
index 585260825..c9e0e3254 100644
--- a/doc/leda_conversion.html
+++ b/doc/leda_conversion.html
@@ -1,17 +1,17 @@
Boost Graph Library: Converting Existing Graphs to BGL
-
-
+
+
@@ -21,7 +21,7 @@ How to Convert Existing Graphs to BGL
Though the main goal of BGL is to aid the development of new
applications and graph algorithms, there are quite a few existing codes
-that could benefit from using BGL algorithms. One way to use the BGL
+that could benefit from using BGL algorithms. One way to use the BGL
algorithms with existing graph data structures is to copy data from
the older graph format into a BGL graph which could then be used in
the BGL algorithms. The problem with this approach is that it can be
@@ -179,7 +179,7 @@
How to Convert Existing Graphs to BGL
struct graph_traits< GRAPH<vtype,etype> > {
// ...
typedef iterator_adaptor<edge,
- out_edge_iterator_policies,
+ out_edge_iterator_policies,
iterator<std::bidirectional_iterator_tag,edge>
> out_edge_iterator;
// ...
@@ -205,9 +205,9 @@ How to Convert Existing Graphs to BGL
template <class vtype, class etype>
inline std::pair<
typename graph_traits< GRAPH<vtype,etype> >::out_edge_iterator,
- typename graph_traits< GRAPH<vtype,etype> >::out_edge_iterator >
+ typename graph_traits< GRAPH<vtype,etype> >::out_edge_iterator >
out_edges(
- typename graph_traits< GRAPH<vtype,etype> >::vertex_descriptor u,
+ typename graph_traits< GRAPH<vtype,etype> >::vertex_descriptor u,
const GRAPH<vtype,etype>& g)
{
typedef typename graph_traits< GRAPH<vtype,etype> >
@@ -260,4 +260,4 @@ How to Convert Existing Graphs to BGL
-
+
diff --git a/doc/lengauer_tarjan_dominator.htm b/doc/lengauer_tarjan_dominator.htm
index 23a009632..2f1e61b5f 100644
--- a/doc/lengauer_tarjan_dominator.htm
+++ b/doc/lengauer_tarjan_dominator.htm
@@ -1,17 +1,17 @@
Boost Graph Library: Lengauer-Tarjan Dominator Tree Algorithm
-
-
+
+
@@ -131,7 +131,7 @@ Parameters
IN: IndexMap indexMap
This maps each vertex to an integer in the range [0, num_vertices(g)).
- The type
+ The type
VertexIndexMap must be a model of
Readable Property Map. The value type of the map must be an
integer type. The vertex descriptor type of the graph needs to be
@@ -179,5 +179,5 @@ Example
-
+
diff --git a/doc/lgrind.sty b/doc/lgrind.sty
index b5129527e..3257be4d0 100644
--- a/doc/lgrind.sty
+++ b/doc/lgrind.sty
@@ -5,14 +5,14 @@
%% The original source files were:
%%
%% lgrind.dtx (with options: `package')
-%%
+%%
%% LGrind is used to format source code of different programming
%% languages for LaTeX.
-%%
+%%
%% LGrind is a major adaptation of Jerry Leichter's tgrind for LaTeX,
%% which was a notable improvement upon Van Jacobsen's tgrind for
%% plain TeX, which was adapted from vgrind, a troff prettyprinter.
-%%
+%%
%% Author: Michael Piefel, piefel@cs.tu-berlin.de
%% Based on Van Jacobson's ``tgrindmac'', a macro package for TeX.
%% Modified, 1987 by Jerry Leichter. Put '@' in all internal names.
diff --git a/doc/make_biconnected_planar.html b/doc/make_biconnected_planar.html
index 99195555d..f86c06bed 100644
--- a/doc/make_biconnected_planar.html
+++ b/doc/make_biconnected_planar.html
@@ -1,17 +1,17 @@
Boost Graph Library: make_biconnected_planar
-
-
+
+
@@ -26,28 +26,28 @@ make_biconnected_planar
-A graph G is biconnected if, for every pair of vertices u,v in
-G, there is a cycle containing both u and v.
-Alternatively, a graph is biconnected if it is connected and cannot be made
-disconnected by removing any single vertex. make_biconnected_planar
-takes a connected
+A graph G is biconnected if, for every pair of vertices u,v in
+G, there is a cycle containing both u and v.
+Alternatively, a graph is biconnected if it is connected and cannot be made
+disconnected by removing any single vertex. make_biconnected_planar
+takes a connected
planar graph g as input and adds zero
or more edges to make g biconnected while preserving planarity.
-The default behavior of make_biconnected_planar is to modify the
-graph g by calling add_edge(u,v,g) for every pair of
-vertices (u,v) where an edge needs to be added to make g
-biconnected. This behavior can be overriden by providing a vistor as the
-AddEdgeVisitor parameter. The only requirement for an
-AddEdgeVisitor is that it define a member function with the
+The default behavior of make_biconnected_planar is to modify the
+graph g by calling add_edge(u,v,g) for every pair of
+vertices (u,v) where an edge needs to be added to make g
+biconnected. This behavior can be overriden by providing a vistor as the
+AddEdgeVisitor parameter. The only requirement for an
+AddEdgeVisitor is that it define a member function with the
following signature:
template <typename Graph, typename Vertex>
void visit_vertex_pair(Vertex u, Vertex v, Graph& g);
This event point can also be used as a hook to update the underlying edge
-index map automatically as edges are added. See the
-documentation for the AddEdgeVisitor
+index map automatically as edges are added. See the
+documentation for the AddEdgeVisitor
concept for more information.
Where Defined
@@ -78,7 +78,7 @@ Parameters
A Readable Property Map
- that maps edges from g to distinct integers in the range
+ that maps edges from g to distinct integers in the range
[0, num_edges(g) )
Default: get(edge_index,g)
@@ -88,14 +88,14 @@ Parameters
A model of AddEdgeVisitor
.
-Default: default_add_edge_visitor, a class defines
+Default: default_add_edge_visitor, a class defines
visit_vertex_pair to dispatch its calls to add_edge.
Complexity
-On a planar graph with n vertices, make_biconnected_planar
+On a planar graph with n vertices, make_biconnected_planar
runs in time O(n)
Example
@@ -114,4 +114,4 @@ See Also
Copyright © 2007 Aaron Windsor (
aaron.windsor@gmail.com)
-
+
diff --git a/doc/make_connected.html b/doc/make_connected.html
index 24d6f5240..0f18e10ec 100644
--- a/doc/make_connected.html
+++ b/doc/make_connected.html
@@ -1,17 +1,17 @@
Boost Graph Library: make_connected
-
-
+
+
@@ -26,30 +26,30 @@ make_connected
-A undirected graph G is connected if, for every pair of vertices
-u,v in G, there is a path from u to v.
-make_connected adds the minimum number of edges needed to make the
-input graph connected. The algorithm first identifies all of the
+A undirected graph G is connected if, for every pair of vertices
+u,v in G, there is a path from u to v.
+make_connected adds the minimum number of edges needed to make the
+input graph connected. The algorithm first identifies all of the
connected components in the graph,
then adds edges to connect those components together in a path. For example, if
-a graph contains three connected components A, B, and C,
-make_connected will add two edges. The two edges added might consist
-of one connecting a vertex in A with a vertex in B and one
+a graph contains three connected components A, B, and C,
+make_connected will add two edges. The two edges added might consist
+of one connecting a vertex in A with a vertex in B and one
connecting a vertex in B with a vertex in C.
-The default behavior of make_connected is to modify the graph
-g by calling add_edge(u,v,g) for every pair of vertices
-(u,v) where an edge needs to be added to connect g. This
-behavior can be overriden by providing a vistor as the AddEdgeVisitor
-parameter. The only requirement for an AddEdgeVisitor is that it
+The default behavior of make_connected is to modify the graph
+g by calling add_edge(u,v,g) for every pair of vertices
+(u,v) where an edge needs to be added to connect g. This
+behavior can be overriden by providing a vistor as the AddEdgeVisitor
+parameter. The only requirement for an AddEdgeVisitor is that it
define a member function with the following signature:
template <typename Graph, typename Vertex>
void visit_vertex_pair(Vertex u, Vertex v, Graph& g);
This event point can also be used as a hook to update the underlying edge
-index map automatically as edges are added. See the
-documentation for the AddEdgeVisitor
+index map automatically as edges are added. See the
+documentation for the AddEdgeVisitor
concept for more information.
@@ -75,7 +75,7 @@ Parameters
A Readable Property Map
- that maps vertices from g to distinct integers in the range
+ that maps vertices from g to distinct integers in the range
[0, num_vertices(g) )
Default: get(vertex_index,g)
@@ -85,7 +85,7 @@ Parameters
A model of AddEdgeVisitor
.
-Default: default_add_edge_visitor, a class defines
+Default: default_add_edge_visitor, a class defines
visit_vertex_pair to dispatch
its calls to add_edge.
@@ -94,7 +94,7 @@ Parameters
Complexity
-On a graph with n vertices and m edges, make_connected
+On a graph with n vertices and m edges, make_connected
runs in time O(n + m)
Example
@@ -113,4 +113,4 @@ See Also
Copyright © 2007 Aaron Windsor (
aaron.windsor@gmail.com)
-
+
diff --git a/doc/make_maximal_planar.html b/doc/make_maximal_planar.html
index 523ce7216..e635e583c 100644
--- a/doc/make_maximal_planar.html
+++ b/doc/make_maximal_planar.html
@@ -1,17 +1,17 @@
Boost Graph Library: make_maximal_planar
-
-
+
+
@@ -25,30 +25,30 @@ make_maximal_planar
-A planar graph G is
-maximal planar if no additional edges (except parallel edges and
-self-loops) can be added to G without creating a non-planar graph. By
+A planar graph G is
+maximal planar if no additional edges (except parallel edges and
+self-loops) can be added to G without creating a non-planar graph. By
Euler's formula, a maximal
planar graph on n vertices (n > 2) always has 3n - 6 edges
- and
-2n - 4 faces. The input graph to make_maximal_planar must be a
-biconnected planar graph with at
+ and
+2n - 4 faces. The input graph to make_maximal_planar must be a
+biconnected planar graph with at
least 3 vertices.
-The default behavior of make_maximal_planar is to modify the graph
-g by calling add_edge(u,v,g) for every pair of vertices
+The default behavior of make_maximal_planar is to modify the graph
+g by calling add_edge(u,v,g) for every pair of vertices
(u,v) where an edge needs to be added to make g maximal planar.
-This behavior can be overriden by providing a vistor as the
-AddEdgeVisitor parameter. The only requirement for an
-AddEdgeVisitor is that it define a member function with the following
+This behavior can be overriden by providing a vistor as the
+AddEdgeVisitor parameter. The only requirement for an
+AddEdgeVisitor is that it define a member function with the following
signature:
template <typename Graph, typename Vertex>
void visit_vertex_pair(Vertex u, Vertex v, Graph& g);
This event point can also be used as a hook to update the underlying edge
-index map automatically as edges are added. See the
-documentation for the AddEdgeVisitor
+index map automatically as edges are added. See the
+documentation for the AddEdgeVisitor
concept for more information.
Where Defined
@@ -73,7 +73,7 @@ Parameters
A Readable Property Map
- that models the PlanarEmbedding
+ that models the PlanarEmbedding
concept.
@@ -81,7 +81,7 @@ Parameters
A Readable Property Map
- that maps vertices from g to distinct integers in the range
+ that maps vertices from g to distinct integers in the range
[0, num_vertices(g) )
Default: get(vertex_index,g)
@@ -90,7 +90,7 @@ Parameters
A Readable Property Map
- that maps edges from g to distinct integers in the range
+ that maps edges from g to distinct integers in the range
[0, num_edges(g) )
Default: get(edge_index,g)
@@ -99,14 +99,14 @@ Parameters
A model of AddEdgeVisitor.
-Default: default_add_edge_visitor, a class defines
+Default: default_add_edge_visitor, a class defines
visit_vertex_pair to dispatch its calls to add_edge.
Complexity
-On a graph with n vertices and m edges,
+On a graph with n vertices and m edges,
make_maximal_planar runs in time O(n + m)
Example
@@ -125,4 +125,4 @@ See Also
Copyright © 2007 Aaron Windsor (
aaron.windsor@gmail.com)
-
+
diff --git a/doc/math.sty b/doc/math.sty
index f09b29e7f..b5c8c3eb5 100644
--- a/doc/math.sty
+++ b/doc/math.sty
@@ -49,7 +49,7 @@
\newcommand{\onlyif}{\Rightarrow}
\newcommand{\thus}{\Longrightarrow}
\newcommand{\contradicts}{\rightarrow\leftarrow}
-\newcommand{\Union}{\bigcup}
+\newcommand{\Union}{\bigcup}
\newcommand{\union}{\cup}
\newcommand{\Intersect}{\bigcap}
\newcommand{\intersect}{\cap}
diff --git a/doc/maximum_adjacency_search.html b/doc/maximum_adjacency_search.html
index 4d3d410be..74aedc625 100644
--- a/doc/maximum_adjacency_search.html
+++ b/doc/maximum_adjacency_search.html
@@ -61,7 +61,7 @@
MAS(G)
- for each vertex u in V
+ for each vertex u in V
reach_count[u] := 0
end for
// for the starting vertex s
@@ -240,9 +240,9 @@ References
- David Matula (1993).
A linear time 2 + epsilon approximation algorightm for edge connectivity
-- Cai, Weiqing and Matula, David W.
-Partitioning by maximum adjacency search of graphs.
-Partitioning Data Sets: Dimacs Workshop, April 19-21, 1993.
+
- Cai, Weiqing and Matula, David W.
+Partitioning by maximum adjacency search of graphs.
+Partitioning Data Sets: Dimacs Workshop, April 19-21, 1993.
Vol 19. Page 55. 1995. Amer Mathematical Society
}
@@ -266,7 +266,7 @@ Visitor Event Points
Notes
-[1]
+
[1]
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
@@ -281,4 +281,4 @@
Notes
-
+
diff --git a/doc/maximum_matching.html b/doc/maximum_matching.html
index fa54cb045..d0d3adf49 100644
--- a/doc/maximum_matching.html
+++ b/doc/maximum_matching.html
@@ -1,10 +1,10 @@
Boost Graph Library: Maximum Cardinality Matching
@@ -30,9 +30,9 @@
A matching is a subset of the edges
of a graph such that no two edges share a common vertex.
Two different matchings in the same graph are illustrated below (edges in the
-matching are colored blue.) The matching on the left is a maximal matching,
-meaning that its size can't be increased by adding edges. The matching on the
-right is a maximum cardinality matching, meaning that is has maximum size
+matching are colored blue.) The matching on the left is a maximal matching,
+meaning that its size can't be increased by adding edges. The matching on the
+right is a maximum cardinality matching, meaning that is has maximum size
over all matchings in the graph.
@@ -46,28 +46,28 @@
-Both edmonds_maximum_cardinality_matching and
+Both edmonds_maximum_cardinality_matching and
checked_edmonds_maximum_cardinality_matching find the
maximum cardinality matching in any undirected graph. The matching is returned in a
-MateMap, which is a
-ReadWritePropertyMap
+MateMap, which is a
+ReadWritePropertyMap
that maps vertices to vertices. In the mapping returned, each vertex is either mapped
to the vertex it's matched to, or to graph_traits<Graph>::null_vertex() if it
doesn't participate in the matching. If no VertexIndexMap is provided, both functions
assume that the VertexIndexMap is provided as an internal graph property accessible
-by calling get(vertex_index,g). The only difference between
-edmonds_maximum_cardinality_matching and
-checked_edmonds_maximum_cardinality_matching is that as a final step,
-the latter algorithm runs a simple verification on the matching computed and
+by calling get(vertex_index,g). The only difference between
+edmonds_maximum_cardinality_matching and
+checked_edmonds_maximum_cardinality_matching is that as a final step,
+the latter algorithm runs a simple verification on the matching computed and
returns true if and only if the matching is indeed
a maximum cardinality matching.
Given a matching M, any vertex that isn't covered by an edge in M is called free. Any
-simple path containing exactly 2n + 1 edges that starts and ends at free vertices and contains
-n edges from M is called an alternating path. Given an alternating path p, all matching and
+simple path containing exactly 2n + 1 edges that starts and ends at free vertices and contains
+n edges from M is called an alternating path. Given an alternating path p, all matching and
non-matching edges on p can be swapped, resulting in a new matching that's larger than the
-original matching by exactly one edge. This method of incrementally increasing the size of matching, along
+original matching by exactly one edge. This method of incrementally increasing the size of matching, along
with the following fact, forms the basis of Edmonds' matching algorithm:
@@ -82,16 +82,16 @@
- Verify that the matching found is a maximum cardinality matching.
-If you use checked_edmonds_maximum_cardinality_matching or
+If you use checked_edmonds_maximum_cardinality_matching or
edmonds_maximum_cardinality_matching, all three of these
steps are chosen for you, but it's easy to plug in different algorithms for these three steps
-using a generic matching function discussed below - in fact, both checked_edmonds_maximum_cardinality_matching
-and edmonds_maximum_cardinality_matching are just inlined specializations of this function.
+using a generic matching function discussed below - in fact, both checked_edmonds_maximum_cardinality_matching
+and edmonds_maximum_cardinality_matching are just inlined specializations of this function.
-When quoting time bounds for algorithms, we assume that VertexIndexMap is a property map
-that allows for constant-time mapping between vertices and indices (which is easily achieved if,
-for instance, the vertices are stored in contiguous memory.) We use n and m to represent the size
+When quoting time bounds for algorithms, we assume that VertexIndexMap is a property map
+that allows for constant-time mapping between vertices and indices (which is easily achieved if,
+for instance, the vertices are stored in contiguous memory.) We use n and m to represent the size
of the vertex and edge sets, respectively, of the input graph.
Algorithms for Creating an Initial Matching
@@ -103,21 +103,21 @@ Algorithms for Creating an Initial Matching
guaranteed to contain at least half of the edges that a maximum matching has. Takes time O(m log n).
- extra_greedy_matching: Sorts the edges in increasing order of the degree of the vertices
contained in each edge, then constructs a greedy matching from those edges. Also a maximal matching, and can
-sometimes be much closer to the maximum cardinality matching than a simple greedy_matching.
-Takes time O(m log n), but the constants involved make this a slower algorithm than
+sometimes be much closer to the maximum cardinality matching than a simple greedy_matching.
+Takes time O(m log n), but the constants involved make this a slower algorithm than
greedy_matching.
Algorithms for Finding an Augmenting Path
-- edmonds_augmenting_path_finder: Finds an augmenting path in time O(m alpha(m,n)),
-where alpha(m,n) is an inverse of the Ackerman function. alpha(m,n) is one of the slowest
-growing functions that occurs naturally in computer science; essentially, alpha(m,n) ≤ 4 for any
-graph that we'd ever hope to run this algorithm on. Since we arrive at a maximum cardinality matching after
+
- edmonds_augmenting_path_finder: Finds an augmenting path in time O(m alpha(m,n)),
+where alpha(m,n) is an inverse of the Ackerman function. alpha(m,n) is one of the slowest
+growing functions that occurs naturally in computer science; essentially, alpha(m,n) ≤ 4 for any
+graph that we'd ever hope to run this algorithm on. Since we arrive at a maximum cardinality matching after
augmenting O(n) matchings, the entire algorithm takes time O(mn alpha(m,n)). Edmonds' original
-algorithm appeared in [64], but our implementation of
-Edmonds' algorithm closely follows Tarjan's
+algorithm appeared in [64], but our implementation of
+Edmonds' algorithm closely follows Tarjan's
description of the algorithm from [27].
- no_augmenting_path_finder: Can be used if no augmentation of the initial matching is desired.
@@ -125,34 +125,34 @@ Algorithms for Finding an Augmenting Path
Verification Algorithms
-- maximum_cardinality_matching_verifier: Returns true if and only if the matching found is a
-maximum cardinality matching. Takes time O(m alpha(m,n)), which is on the order of a single iteration
+
- maximum_cardinality_matching_verifier: Returns true if and only if the matching found is a
+maximum cardinality matching. Takes time O(m alpha(m,n)), which is on the order of a single iteration
of Edmonds' algorithm.
- no_matching_verifier: Always returns true
-Why is a verification algorithm needed? Edmonds' algorithm is fairly complex, and it's nearly
-impossible for a human without a few days of spare time to figure out if the matching produced by
-edmonds_matching on a graph with, say, 100 vertices and 500 edges is indeed a maximum cardinality
-matching. A verification algorithm can do this mechanically, and it's much easier to verify by inspection
-that the verification algorithm has been implemented correctly than it is to verify by inspection that
-Edmonds' algorithm has been implemented correctly.
-The Boost Graph library makes it incredibly simple to perform the subroutines needed by the verifier
-(such as finding all the connected components of odd cardinality in a graph, or creating the induced graph
+Why is a verification algorithm needed? Edmonds' algorithm is fairly complex, and it's nearly
+impossible for a human without a few days of spare time to figure out if the matching produced by
+edmonds_matching on a graph with, say, 100 vertices and 500 edges is indeed a maximum cardinality
+matching. A verification algorithm can do this mechanically, and it's much easier to verify by inspection
+that the verification algorithm has been implemented correctly than it is to verify by inspection that
+Edmonds' algorithm has been implemented correctly.
+The Boost Graph library makes it incredibly simple to perform the subroutines needed by the verifier
+(such as finding all the connected components of odd cardinality in a graph, or creating the induced graph
on all vertices with a certain label) in just a few lines of code.
-Understanding how the verifier works requires a few graph-theoretic facts.
+Understanding how the verifier works requires a few graph-theoretic facts.
Let m(G) be the size of a maximum cardinality matching in the graph G.
-Denote by o(G) the number of connected components in G of odd cardinality, and for a set of
-vertices X, denote by G - X the induced graph on the vertex set V(G) - X. Then the
+Denote by o(G) the number of connected components in G of odd cardinality, and for a set of
+vertices X, denote by G - X the induced graph on the vertex set V(G) - X. Then the
Tutte-Berge Formula says that
2 * m(G) = min ( |V(G)| + |X| - o(G-X) )
-Where the minimum is taken over all subsets X of the vertex set V(G). A side effect of the
-Edmonds Blossom-Shrinking algorithm is that it computes what is known as the Edmonds-Gallai decomposition
-of a graph: it decomposes the graph into three disjoint sets of vertices, one of which achieves the minimum
+Where the minimum is taken over all subsets X of the vertex set V(G). A side effect of the
+Edmonds Blossom-Shrinking algorithm is that it computes what is known as the Edmonds-Gallai decomposition
+of a graph: it decomposes the graph into three disjoint sets of vertices, one of which achieves the minimum
in the Tutte-Berge Formula.
An outline of our verification procedure is:
@@ -163,7 +163,7 @@ Verification Algorithms
- Run edmonds_augmenting_path_finder once on g and mate. If it finds an augmenting
path, the matching isn't a maximum cardinality matching. Otherwise, we retrieve a copy of the vertex_state
map used by the edmonds_augmenting_path_finder. The Edmonds-Gallai decomposition tells us that the set
-of vertices labeled V_ODD by the vertex_state map can be used as the set X to achieve the
+of vertices labeled V_ODD by the vertex_state map can be used as the set X to achieve the
minimum in the Tutte-Berge Formula.
- Count the number of vertices labeled V_ODD, store this in num_odd_vertices.
- Create a filtered_graph
@@ -175,7 +175,7 @@
Verification Algorithms
Assuming these steps are implemented correctly, the verifier will never return a false positive,
and will only return a false negative if edmonds_augmenting_path_finder doesn't compute the
vertex_state map correctly, in which case the edmonds_augmenting_path_finder
-isn't working correctly.
+isn't working correctly.
Creating Your Own Matching Algorithms
@@ -183,24 +183,24 @@ Creating Your Own Matching Algorithms
Creating a matching algorithm is as simple as plugging the algorithms described above into a generic
matching function, which has the following signature:
-template <typename Graph,
+template <typename Graph,
typename MateMap,
typename VertexIndexMap,
- template <typename, typename, typename> class AugmentingPathFinder,
+ template <typename, typename, typename> class AugmentingPathFinder,
template <typename, typename> class InitialMatchingFinder,
template <typename, typename, typename> class MatchingVerifier>
bool matching(const Graph& g, MateMap mate, VertexIndexMap vm)
The matching functions provided for you are just inlined specializations of this function:
-edmonds_maximum_cardinality_matching uses edmonds_augmenting_path_finder
-as the AugmentingPathFinder, extra_greedy_matching as the InitialMatchingFinder,
-and no_matching_verifier as the MatchingVerifier.
+edmonds_maximum_cardinality_matching uses edmonds_augmenting_path_finder
+as the AugmentingPathFinder, extra_greedy_matching as the InitialMatchingFinder,
+and no_matching_verifier as the MatchingVerifier.
checked_edmonds_maximum_cardinality_matching uses the same parameters except that
maximum_cardinality_matching_verifier is used for the MatchingVerifier.
These aren't necessarily the best choices for any situation - for example, it's been claimed in the literature
-that for sparse graphs, Edmonds' algorithm converges to the maximum cardinality matching more quickly if it
+that for sparse graphs, Edmonds' algorithm converges to the maximum cardinality matching more quickly if it
isn't supplied with an intitial matching. Such an algorithm can be easily assembled by calling matching with
- AugmentingPathFinder = edmonds_augmenting_path_finder
@@ -209,16 +209,16 @@
Creating Your Own Matching Algorithms
and choosing the MatchingVerifier depending on how careful you're feeling.
-Suppose instead that you want a relatively large matching quickly, but are not exactly interested in a maximum matching.
-Both extra_greedy_matching and greedy_matching find maximal matchings, which means they're guaranteed to be at
+Suppose instead that you want a relatively large matching quickly, but are not exactly interested in a maximum matching.
+Both extra_greedy_matching and greedy_matching find maximal matchings, which means they're guaranteed to be at
least half the size of a maximum cardinality matching, so you could call matching with
- AugmentingPathFinder = no_augmenting_path_finder
- InitialMatchingFinder = extra_greedy_matching
- MatchingVerifier = maximum_cardinality_matching_verifier
-The resulting algorithm will find an extra greedy matching in time O(m log n) without looking for
-augmenting paths. As a bonus, the return value of this function is true if and only if the extra greedy
+The resulting algorithm will find an extra greedy matching in time O(m log n) without looking for
+augmenting paths. As a bonus, the return value of this function is true if and only if the extra greedy
matching happens to be a maximum cardinality matching.
Where Defined
@@ -231,7 +231,7 @@ Creating Your Own Matching Algorithms
IN: const Graph& g
-An undirected graph. The graph type must be a model of
+An undirected graph. The graph type must be a model of
Vertex and Edge List Graph and
Incidence Graph.
@@ -251,9 +251,9 @@ Creating Your Own Matching Algorithms
Complexity
-Let m and n be the number of edges and vertices in the input graph, respectively. Assuming the
-VertexIndexMap supplied allows constant-time lookups, the time complexity for both
-edmonds_matching and checked_edmonds_matching is O(mn alpha(m,n)).
+Let m and n be the number of edges and vertices in the input graph, respectively. Assuming the
+VertexIndexMap supplied allows constant-time lookups, the time complexity for both
+edmonds_matching and checked_edmonds_matching is O(mn alpha(m,n)).
alpha(m,n) is a slow growing function that is at most 4 for any feasible input.
diff --git a/doc/maximum_weighted_matching.html b/doc/maximum_weighted_matching.html
index e617faa91..ab40f1f45 100644
--- a/doc/maximum_weighted_matching.html
+++ b/doc/maximum_weighted_matching.html
@@ -1,10 +1,10 @@
Boost Graph Library: Maximum Weighted Matching
@@ -28,10 +28,10 @@
Before you continue, it is recommended to read
-about maximal cardinality matching first.
+about maximal cardinality matching first.
A maximum weighted matching of an edge-weighted graph is a matching
-for which the sum of the weights of the edges is maximum.
-Two different matchings (edges in the matching are colored blue) in the same graph are illustrated below.
+for which the sum of the weights of the edges is maximum.
+Two different matchings (edges in the matching are colored blue) in the same graph are illustrated below.
The matching on the left is a maximum cardinality matching of size 8 and a maximal
weighted matching of weight sum 30, meaning that is has maximum size over all matchings in the graph
and its weight sum can't be increased by adding edges.
@@ -49,26 +49,26 @@
-Both maximum_weighted_matching and
+Both maximum_weighted_matching and
brute_force_maximum_weighted_matching find a
maximum weighted matching in any undirected graph. The matching is returned in a
-MateMap, which is a
-ReadWritePropertyMap
+MateMap, which is a
+ReadWritePropertyMap
that maps vertices to vertices. In the mapping returned, each vertex is either mapped
to the vertex it's matched to, or to graph_traits<Graph>::null_vertex() if it
doesn't participate in the matching. If no VertexIndexMap is provided, both functions
assume that the VertexIndexMap is provided as an internal graph property accessible
-by calling get(vertex_index, g).
+by calling get(vertex_index, g).
The maximum weighted matching problem was solved by Edmonds in [74].
The implementation of maximum_weighted_matching followed Chapter 6, Section 10 of [20] and
-was written in a consistent style with edmonds_maximum_cardinality_matching because of their algorithmic similarity.
+was written in a consistent style with edmonds_maximum_cardinality_matching because of their algorithmic similarity.
In addition, a brute-force verifier brute_force_maximum_weighted_matching simply searches all possible matchings in any graph and selects one with the maximum weight sum.
Algorithm Description
-Primal-dual method in linear programming is introduced to solve weighted matching problems. Edmonds proved that for any graph,
+Primal-dual method in linear programming is introduced to solve weighted matching problems. Edmonds proved that for any graph,
the maximum number of edges in a matching is equal to the minimum capacity of an odd-set cover; this further enable us to prove a max-min duality theorem for weighted matching.
Let Hk-1 denote any graph obtained from G by contracting odd sets of three or more nodes and deleting single nodes,
where the capacity of the family of odd sets (not necessarily a cover of G) is k-1. Let Xk denote any matching containing k edges.
@@ -76,7 +76,7 @@
-This matching duality theorem gives an indication of how the matching problem should be formulated as a linear programming problem. That is,
+This matching duality theorem gives an indication of how the matching problem should be formulated as a linear programming problem. That is,
the theorem suggests a set of linear inequalities which are satisfied by any matching, and it is anticipated that these inequalities describe a convex polyhedron
with integer vertices corresponding to feasible matchings.
@@ -95,7 +95,7 @@
If an augmenting path is found, go to step 2. If a blossom is formed, go to step 3. Otherwise, go to step 4.
- (Augmentation) Find the augmenting path, tracing the path through shrunken blossoms. Augment the matching,
correct labels on nodes in the augmenting path, expand blossoms with zero dual variables and remove labels from all base nodes. Go to step 1.
-- (Blossoming) Determine the membership and base node of the new blossom and supply missing labels for all non-base nodes in the blossom.
+
- (Blossoming) Determine the membership and base node of the new blossom and supply missing labels for all non-base nodes in the blossom.
Return to step 1.
- (Revision of Dual Solution) Adjust the dual variables based on the primal-dual method. Go to step 1 or halt, accordingly.
@@ -104,8 +104,8 @@
Unlike max_cardinality_matching, the initial matching and augmenting path finder are not parameterized,
because the algorithm maintains blossoms, dual variables and node labels across all augmentations.
-The algorithm's time complexity is reduced from O(V4) (naive implementation of [74])
-to O(V3), by a delicate labeling procedure [75] to avoid re-scanning labels after revision of the dual solution.
+The algorithm's time complexity is reduced from O(V4) (naive implementation of [74])
+to O(V3), by a delicate labeling procedure [75] to avoid re-scanning labels after revision of the dual solution.
Special variables pi, tau, gamma and two arrays critical_edge, tau_idx are introduced for this purpose.
Please refer to [20] and code comments for more implementation details.
@@ -118,7 +118,7 @@
IN: const Graph& g
-An undirected graph. The graph type must be a model of
+An undirected graph. The graph type must be a model of
Vertex and Edge List Graph and
Incidence Graph.
The edge property of the graph property_map<Graph, edge_weight_t> must exist and have numeric value type.
@@ -139,8 +139,8 @@
Complexity
-Let m and n be the number of edges and vertices in the input graph, respectively. Assuming the
-VertexIndexMap supplied allows constant-time lookup, the time complexity for
+Let m and n be the number of edges and vertices in the input graph, respectively. Assuming the
+VertexIndexMap supplied allows constant-time lookup, the time complexity for
maximum_weighted_matching is O(n3). For brute_force_maximum_weighted_matching, the time complexity is exponential of m.
Note that the best known time complexity for maximum weighted matching in general graph
is O(nm+n2log(n)) by [76], but relies on an
diff --git a/doc/mcgregor_common_subgraphs.html b/doc/mcgregor_common_subgraphs.html
index e545fca22..a38228540 100644
--- a/doc/mcgregor_common_subgraphs.html
+++ b/doc/mcgregor_common_subgraphs.html
@@ -1,7 +1,7 @@
Boost Graph Library: Minimum Degree Ordering
-
-
+
+
@@ -23,14 +23,14 @@
template <class AdjacencyGraph, class OutDegreeMap,
- class InversePermutationMap,
+ class InversePermutationMap,
class PermutationMap, class SuperNodeSizeMap, class VertexIndexMap>
void minimum_degree_ordering
(AdjacencyGraph& G,
OutDegreeMap outdegree,
InversePermutationMap inverse_perm,
- PermutationMap perm,
- SuperNodeSizeMap supernode_size, int delta, VertexIndexMap id)
+ PermutationMap perm,
+ SuperNodeSizeMap supernode_size, int delta, VertexIndexMap id)
The minimum degree ordering algorithm [
inverse_perm[new_index[u]] == old_index[u]
- and the permutation from the old index to the new index.
+
and the permutation from the old index to the new index.
perm[old_index[u]] == new_index[u]
@@ -80,7 +80,7 @@ Parameters
-- AdjacencyGraph& G (IN)
+ - AdjacencyGraph& G (IN)
A directed graph. The graph's type must be a model of Adjacency Graph,
Parameters
descriptor type of the graph, and with a value type that is an
integer type.
-- InversePermutationMap inverse_perm  (OUT)
+ - InversePermutationMap inverse_perm  (OUT)
The new vertex ordering, given as the mapping from the
new indices to the old indices (an inverse permutation).
This must be an
- LvaluePropertyMap with a value type and key type a signed integer.
+ LvaluePropertyMap with a value type and key type a signed integer.
- - PermutationMap perm  (OUT)
+ - PermutationMap perm  (OUT)
The new vertex ordering, given as the mapping from the
old indices to the new indices (a permutation).
This must be an
- LvaluePropertyMap with a value type and key type a signed integer.
+ LvaluePropertyMap
with a value type and key type a signed integer.
-
- SuperNodeSizeMap supernode_size  (WORK/OUT)
+ - SuperNodeSizeMap supernode_size  (WORK/OUT)
This is used internally to record the size of supernodes and is also
useful information to have. This is a
LvaluePropertyMap with an unsigned integer value type and key
type of vertex descriptor.
- - int delta  (IN)
+ - int delta  (IN)
Multiple elimination control variable. If it is larger than or equal
to zero then multiple elimination is enabled. The value of
delta specifies the difference between the minimum degree
and the degree of vertices that are to be eliminated.
-
- - VertexIndexMap id  (IN)
+
+ - VertexIndexMap id  (IN)
Used internally to map vertices to their indices. This must be a Readable
Property Map with key type the same as the vertex descriptor of
@@ -155,7 +155,7 @@ Implementation Notes
graph G by removing vertex v and all of its incident
edges and by then adding edges to make all of the vertices adjacent to
v into a clique (that is, add an edge between each pair of
-adjacent vertices if an edge doesn't already exist).
+adjacent vertices if an edge doesn't already exist).
Suppose that graph G is the graph representing the nonzero
structure of a matrix A. Then performing a step of Guassian
@@ -175,4 +175,4 @@ Implementation Notes
-
+
diff --git a/doc/minimum_degree_ordering.w b/doc/minimum_degree_ordering.w
index d231799f1..9de5b11de 100644
--- a/doc/minimum_degree_ordering.w
+++ b/doc/minimum_degree_ordering.w
@@ -53,7 +53,7 @@ complete subgraph. That is, it is a subgraph where each vertex is
adjacent to every other vertex in the subgraph}.
-quotient graph
+quotient graph
set of cliques in the graph
@@ -81,7 +81,7 @@ external degree
@d MMD Algorithm Overview @{
@
-
+
@}
@@ -153,7 +153,7 @@ void eliminate(vertex_t node)
tagged or if it is numbered
add vertices adjacent to node to the clique
put all numbered adjacent vertices into the temporary neighbors stack
-
+
@
}
@}
@@ -201,7 +201,7 @@ while (!neighbors.empty()) {
@d
@{
-predicateRemoveEdge1
p(G, marker, numbering, element_neighbor, vertex_index_map);
@@ -213,16 +213,16 @@ remove_out_edge_if(node, p, G);
@d Interface of the MMD function @{
-template
void minimum_degree_ordering
- (Graph& G,
- DegreeMap degree,
- InversePermutationMap inverse_perm,
- PermutationMap perm,
- SuperNodeMap supernode_size,
+ (Graph& G,
+ DegreeMap degree,
+ InversePermutationMap inverse_perm,
+ PermutationMap perm,
+ SuperNodeMap supernode_size,
int delta,
VertexIndexMap vertex_index_map)
@}
@@ -253,8 +253,8 @@ public:
typedef typename property_traits::key_type value_type;
typedef typename property_traits::value_type size_type;
- bucket_sorter(size_type length, bucket_type max_bucket,
- const BucketMap& bucket = BucketMap(),
+ bucket_sorter(size_type length, bucket_type max_bucket,
+ const BucketMap& bucket = BucketMap(),
const ValueIndexMap& index_map = ValueIndexMap());
void remove(const value_type& x);
void push(const value_type& x);
@@ -300,10 +300,10 @@ value object to (the minimum is assumed to be zero).
@d Bucket Sorter Constructor @{
bucket_sorter::bucket_sorter
(size_type N, bucket_type max_bucket,
- const BucketMap& bucket_map = BucketMap(),
+ const BucketMap& bucket_map = BucketMap(),
const ValueIndexMap& index_map = ValueIndexMap())
: head(max_bucket, invalid_value()),
- next(N, invalid_value()),
+ next(N, invalid_value()),
prev(N, invalid_value()),
id_to_value(N),
bucket_map(bucket_map), index_map(index_map) { }
diff --git a/doc/null_visitor.html b/doc/null_visitor.html
index df73c844a..287283d11 100644
--- a/doc/null_visitor.html
+++ b/doc/null_visitor.html
@@ -1,17 +1,17 @@
Boost Graph Library: null_visitor
-
-
+
+
@@ -91,4 +91,4 @@ Member Functions
-
+
diff --git a/doc/opposite.html b/doc/opposite.html
index cfe102001..e77bbe372 100644
--- a/doc/opposite.html
+++ b/doc/opposite.html
@@ -1,17 +1,17 @@
Boost Graph Library: opposite
-
-
+
+
@@ -76,4 +76,4 @@ Example
-
+
diff --git a/doc/planar_canonical_ordering.html b/doc/planar_canonical_ordering.html
index f79c39e3e..1eabba8f3 100644
--- a/doc/planar_canonical_ordering.html
+++ b/doc/planar_canonical_ordering.html
@@ -1,17 +1,17 @@
Boost Graph Library: Planar Canonical Ordering
-
-
+
+
@@ -22,25 +22,25 @@ Planar Canonical Ordering
-A planar canonical ordering is an ordering v1,
-v2, ..., vn of the vertices of a
-maximal
-planar graph having the property that, for
-each k, 3 <= k < n, the graph induced by
+A planar canonical ordering is an ordering v1,
+v2, ..., vn of the vertices of a
+maximal
+planar graph having the property that, for
+each k, 3 <= k < n, the graph induced by
v1, v2, ..., vk
-- is biconnected and contains the edge {v1, v2}
+
- is biconnected and contains the edge {v1, v2}
on its outer face.
-
- has any vertices in the range v1, v2, ...,
-vk that are adjacent to v(k+1) on its outer
+
- has any vertices in the range v1, v2, ...,
+vk that are adjacent to v(k+1) on its outer
face, and these vertices form a path along the outer face.
Let Gk be the graph induced by the first k vertices in
-the canonical ordering, along with all edges between any of the first k
-vertices. After Gk has been drawn, the (k+1)st vertex
-can be drawn easily without edge crossings, since it's adjacent only to a
-consecutive sequence of vertices on the outer face of Gk.
+the canonical ordering, along with all edges between any of the first k
+vertices. After Gk has been drawn, the (k+1)st vertex
+can be drawn easily without edge crossings, since it's adjacent only to a
+consecutive sequence of vertices on the outer face of Gk.
@@ -53,21 +53,21 @@ Planar Canonical Ordering
to have at least 2 vertices.
-The planar canonical ordering is used as an input in some planar graph drawing
-algorithms, particularly those that create a straight line embedding.
-de Fraysseix, Pach, and Pollack
-[72]
-first proved the
-existence of such an ordering and showed how to compute one in time
+The planar canonical ordering is used as an input in some planar graph drawing
+algorithms, particularly those that create a straight line embedding.
+de Fraysseix, Pach, and Pollack
+[72]
+first proved the
+existence of such an ordering and showed how to compute one in time
O(n) on a maximal planar graph with n vertices.
Complexity
If the vertex index map provides constant-time access to indices, this
-function takes time O(n + m) for a planar graph with n vertices
-and m edges. Note that
-in a simple planar graph with f faces, m edges, and n
-vertices, both f and m are O(n).
+function takes time O(n + m) for a planar graph with n vertices
+and m edges. Note that
+in a simple planar graph with f faces, m edges, and n
+vertices, both f and m are O(n).
Where Defined
@@ -80,7 +80,7 @@ Where Defined
IN: Graph& g
-An undirected graph. The graph type must be a model of
+An undirected graph. The graph type must be a model of
VertexAndEdgeListGraph.
The graph must:
@@ -89,7 +89,7 @@ Where Defined
-IN: PlanarEmbedding
+IN: PlanarEmbedding
A model of PlanarEmbedding.
@@ -98,7 +98,7 @@ Where Defined
IN: OutputIterator
-An OutputIterator with value_type equal to
+An OutputIterator with value_type equal to
graph_traits<Graph>::vertex_descriptor. The canonical ordering
will be written to this iterator.
@@ -107,7 +107,7 @@ Where Defined
A Readable Property Map
- that maps vertices from g to distinct integers in the range
+
that maps vertices from g to distinct integers in the range
[0, num_vertices(g) )
Default: get(vertex_index,g)
@@ -127,5 +127,5 @@ Example
Copyright © 2007 Aaron Windsor (
aaron.windsor@gmail.com)
-
+
diff --git a/doc/planar_face_traversal.html b/doc/planar_face_traversal.html
index 9a93799d6..24214c366 100644
--- a/doc/planar_face_traversal.html
+++ b/doc/planar_face_traversal.html
@@ -1,17 +1,17 @@
Boost Graph Library: Planar Face Traversal
-
-
+
+
@@ -23,17 +23,17 @@ Planar Face Traversal
-A graph is planar if it can be drawn in two-dimensional space with no
-two of its edges crossing. Any embedding of a planar graph separates the plane
-into distinct regions that are bounded by sequences of edges in the graph.
-These regions are called faces.
+A graph is planar if it can be drawn in two-dimensional space with no
+two of its edges crossing. Any embedding of a planar graph separates the plane
+into distinct regions that are bounded by sequences of edges in the graph.
+These regions are called faces.
-A plane drawing of a graph (left), and the 8 faces defined by the planar
-embedding (right.) Each connected blue region in the image on the right is a
+A plane drawing of a graph (left), and the 8 faces defined by the planar
+embedding (right.) Each connected blue region in the image on the right is a
face. The large blue region surrounding the graph is the outer face.
@@ -49,27 +49,27 @@ A plane drawing of a graph (left), and the 8 faces defined by the planar
A traversal of the faces of a planar graph involves iterating through all faces
of the graph, and on each face, iterating through all vertices and edges of the
-face. The iteration through all vertices and edges of each face follows a
+face. The iteration through all vertices and edges of each face follows a
path around the border of the face.
-In a biconnected graph, like the one shown above, each face is bounded by a
-cycle and each edge belongs to exactly two faces. For this reason, when
+In a biconnected graph, like the one shown above, each face is bounded by a
+cycle and each edge belongs to exactly two faces. For this reason, when
planar_face_traversal is called on a biconnected graph, each edge will
-be visited exactly twice: once on each of two distinct faces, and no vertex
-will be visited more than once on a particular face. The output of
-planar_face_traversal on non-biconnected graphs is less intuitive -
-for example, if the graph
-consists solely of a path of vertices (and therefore a single face),
-planar_face_traversal will iterate around the path, visiting
-each edge twice and visiting some vertices more than once.
+be visited exactly twice: once on each of two distinct faces, and no vertex
+will be visited more than once on a particular face. The output of
+planar_face_traversal on non-biconnected graphs is less intuitive -
+for example, if the graph
+consists solely of a path of vertices (and therefore a single face),
+planar_face_traversal will iterate around the path, visiting
+each edge twice and visiting some vertices more than once.
planar_face_traversal does not visit isolated vertices.
-Like other graph traversal algorithms in the Boost Graph Library, the planar
-face traversal is a generic traversal that can be customized by the
+Like other graph traversal algorithms in the Boost Graph Library, the planar
+face traversal is a generic traversal that can be customized by the
redefinition of certain visitor event points. By defining an appropriate
-visitor, this traversal can be
-used to enumerate the faces of a planar graph, triangulate a planar graph, or
-even construct a dual of a planar graph.
+visitor, this traversal can be
+used to enumerate the faces of a planar graph, triangulate a planar graph, or
+even construct a dual of a planar graph.
@@ -77,13 +77,13 @@ A plane drawing of a graph (left), and the 8 faces defined by the planar
-For example, on the above graph, an instance my_visitor of the
+For example, on the above graph, an instance my_visitor of the
following visitor:
struct output_visitor: public planar_face_traversal_visitor
{
void begin_face() { std::cout << "New face: "; }
- template <typename Vertex> void next_vertex(Vertex v) { std::cout << v << " "; }
+ template <typename Vertex> void next_vertex(Vertex v) { std::cout << v << " "; }
void finish_face() { std::cout << std::endl; }
};
@@ -100,47 +100,47 @@ A plane drawing of a graph (left), and the 8 faces defined by the planar
New face: 1 0 3 2
-Visitor Event Points
-
+Visitor Event Points
+
-- visitor.begin_traversal(): called once before any faces are
+
- visitor.begin_traversal(): called once before any faces are
visited.
-
- visitor.begin_face(): called once, for each face, before any
+
- visitor.begin_face(): called once, for each face, before any
vertex or edge on that face has been visited.
- visitor.end_face(): called once, for each face, after all vertices
and all edges on that face have been visited.
-
- visitor.next_vertex(Vertex v): called once on each vertex in the
-current face (the start and end of which are designated by calls to
-begin_face() and end_face(), respectively) in order
+
- visitor.next_vertex(Vertex v): called once on each vertex in the
+current face (the start and end of which are designated by calls to
+begin_face() and end_face(), respectively) in order
according to the order established by the planar embedding.
- visitor.next_edge(Edge e): called once on each edge in the current
-face (the start and end of which are designated by calls to
-begin_face() and end_face(), respectively) in order
+face (the start and end of which are designated by calls to
+begin_face() and end_face(), respectively) in order
according to the order established by the planar embedding.
-
- visitor.end_traversal(): called once after all faces have been
+
- visitor.end_traversal(): called once after all faces have been
visited.
Although next_vertex is guaranteed to be called in sequence for each
vertex as the traversal moves around a face and next_edge is
guaranteed to be called in sequence for each edge as the traversal moves
-around a face, there's no guarantee about the order in which
-next_vertex and next_edge are called with respect to each
-other in between calls to begin_face and end_face. These
-calls may be interleaved, all vertex visits may precede all edge visits, or
+around a face, there's no guarantee about the order in which
+next_vertex and next_edge are called with respect to each
+other in between calls to begin_face and end_face. These
+calls may be interleaved, all vertex visits may precede all edge visits, or
vise-versa.
-planar_face_traversal iterates over a copy of the edges of the input
+planar_face_traversal iterates over a copy of the edges of the input
graph, so it is safe to add edges to the graph during visitor event points.
Complexity
-If all of the visitor event points run in constant time, the traversal takes
+If all of the visitor event points run in constant time, the traversal takes
time O(n + m) for a planar graph with n vertices and m
-edges. Note that
-in a simple planar graph with f faces, m edges, and n
-vertices, both f and m are O(n).
+edges. Note that
+in a simple planar graph with f faces, m edges, and n
+vertices, both f and m are O(n).
Where Defined
@@ -154,11 +154,11 @@ Parameters
IN: Graph& g
-An undirected graph. The graph type must
+An undirected graph. The graph type must
be a model of VertexAndEdgeListGraph
-IN: PlanarEmbedding
+IN: PlanarEmbedding
A model of PlanarEmbedding.
@@ -174,7 +174,7 @@ Parameters
A Readable Property Map
- that maps edges from g to distinct integers in the range
+ that maps edges from g to distinct integers in the range
[0, num_edges(g) )
Default: get(edge_index,g)
@@ -199,4 +199,4 @@ See Also
Copyright © 2007 Aaron Windsor (
aaron.windsor@gmail.com)
-
+
diff --git a/doc/planar_graphs.html b/doc/planar_graphs.html
index 47e66fd6b..1d2f8f791 100644
--- a/doc/planar_graphs.html
+++ b/doc/planar_graphs.html
@@ -1,35 +1,35 @@
Boost Graph Library: Planar Graphs
-
-
+
+
Planar Graphs
-A graph is planar if it can be drawn in
-two-dimensional space with no two of its edges crossing. Such a drawing of a
-planar graph is called a plane drawing.
-Every planar graph also admits a straight-line drawing, which is a
-plane drawing where each edge is represented by a line segment.
+A graph is planar if it can be drawn in
+two-dimensional space with no two of its edges crossing. Such a drawing of a
+planar graph is called a plane drawing.
+Every planar graph also admits a straight-line drawing, which is a
+plane drawing where each edge is represented by a line segment.
profile
(1)
@@ -23,22 +23,22 @@ profile
typename graph_traits<Graph>::vertices_size_type
profile(const Graph& g, VertexIndexMap index_map)
-The profile is the sum of all the maximum distances between the i-th
+
The profile is the sum of all the maximum distances between the i-th
vertex and any of its neighbors with an index j>i.
B(G) = max { |index[u] - index[v]| | (u,v) in E }
Defined in
-boost/graph/profile.hpp
+boost/graph/profile.hpp
-
+
Copyright © 2001-2002
- Marc Wintermantel, ETH Zurich (wintermantel@imes.mavt.ethz.ch)
+ Marc Wintermantel, ETH Zurich (wintermantel@imes.mavt.ethz.ch)
diff --git a/doc/property.html b/doc/property.html
index 3894a282c..71f2e95ee 100644
--- a/doc/property.html
+++ b/doc/property.html
@@ -1,17 +1,17 @@
Boost Graph Library: Property
-
-
+
+
@@ -147,21 +147,21 @@ Property Tags
namespace boost {
- enum edge_name_t { edge_name };
- enum edge_weight_t { edge_weight };
+ enum edge_name_t { edge_name };
+ enum edge_weight_t { edge_weight };
enum edge_index_t { edge_index };
- enum edge_capacity_t { edge_capacity };
- enum edge_residual_capacity_t { edge_residual_capacity };
- enum edge_reverse_t { edge_reverse };
- enum vertex_name_t { vertex_name };
- enum vertex_distance_t { vertex_distance };
+ enum edge_capacity_t { edge_capacity };
+ enum edge_residual_capacity_t { edge_residual_capacity };
+ enum edge_reverse_t { edge_reverse };
+ enum vertex_name_t { vertex_name };
+ enum vertex_distance_t { vertex_distance };
enum vertex_index_t { vertex_index };
- enum vertex_color_t { vertex_color };
- enum vertex_degree_t { vertex_degree };
- enum vertex_out_degree_t { vertex_out_degree };
- enum vertex_in_degree_t { vertex_in_degree };
- enum vertex_discover_time_t { vertex_discover_time };
- enum vertex_finish_time_t { vertex_finish_time };
+ enum vertex_color_t { vertex_color };
+ enum vertex_degree_t { vertex_degree };
+ enum vertex_out_degree_t { vertex_out_degree };
+ enum vertex_in_degree_t { vertex_in_degree };
+ enum vertex_discover_time_t { vertex_discover_time };
+ enum vertex_finish_time_t { vertex_finish_time };
enum graph_name_t { graph_name };
BOOST_INSTALL_PROPERTY(vertex, index);
diff --git a/doc/property_map.html b/doc/property_map.html
index 3ed394012..5455bda88 100644
--- a/doc/property_map.html
+++ b/doc/property_map.html
@@ -1,17 +1,17 @@
Boost Graph Library: Property Map Traits
-
-
+
+
@@ -83,4 +83,4 @@ Associated Types
-
+
diff --git a/doc/property_put.html b/doc/property_put.html
index 8dd7ecb8a..73dbead0a 100644
--- a/doc/property_put.html
+++ b/doc/property_put.html
@@ -3,17 +3,17 @@
Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
Copyright (c) 2010 Matthias Walter (xammy@xammy.homelinux.net)
Copyright (c) 2010 Trustees of Indiana University
-
+
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)
-->
Boost Graph Library: property_put
-
-
+
+
@@ -181,7 +181,7 @@ See Also
-
+
Boost Graph Library: property_writer
-
-
+
+
@@ -45,7 +45,7 @@ Example
boost::breadth_first_search
(G, vertex(a, G), make_bfs_visitor(
std::make_pair(write_property(name, cout_char, on_discover_vertex()),
- std::make_pair(write_property(distance.begin(), cout_int,
+ std::make_pair(write_property(distance.begin(), cout_int,
on_discover_vertex()),
std::make_pair(print_edge(name, std::cout, on_examine_edge()),
print_endl(std::cout, on_finish_vertex()
@@ -194,7 +194,7 @@ See Also
-
+
Boost Graph Library: Publications
-
-
+
+
@@ -43,4 +43,4 @@ Boost Graph Library Related Publications
-
+
diff --git a/doc/push_relabel_max_flow.html b/doc/push_relabel_max_flow.html
index d70bad3ea..6cb8ad577 100644
--- a/doc/push_relabel_max_flow.html
+++ b/doc/push_relabel_max_flow.html
@@ -1,17 +1,17 @@
Boost Graph Library: Push-Relabel Maximum Flow
-
-
+
+
@@ -24,17 +24,17 @@
// named parameter version
template <class Graph, class P, class T, class R>
typename property_traits<CapacityEdgeMap>::value_type
-push_relabel_max_flow(Graph& g,
+push_relabel_max_flow(Graph& g,
typename graph_traits<Graph>::vertex_descriptor src,
typename graph_traits<Graph>::vertex_descriptor sink,
const bgl_named_params<P, T, R>& params = all defaults)
// non-named parameter version
-template <class Graph,
+template <class Graph,
class CapacityEdgeMap, class ResidualCapacityEdgeMap,
class ReverseEdgeMap, class VertexIndexMap>
typename property_traits<CapacityEdgeMap>::value_type
-push_relabel_max_flow(Graph& g,
+push_relabel_max_flow(Graph& g,
typename graph_traits<Graph>::vertex_descriptor src,
typename graph_traits<Graph>::vertex_descriptor sink,
CapacityEdgeMap cap, ResidualCapacityEdgeMap res,
@@ -49,7 +49,7 @@
maximum flow will be the return value of the function. The function
also calculates the flow values f(u,v) for all (u,v) in
E, which are returned in the form of the residual capacity
-r(u,v) = c(u,v) - f(u,v).
+r(u,v) = c(u,v) - f(u,v).
There are several special requirements on the input graph and property
@@ -96,14 +96,14 @@
Parameters
The source vertex for the flow network graph.
-
+
IN: vertex_descriptor sink
The sink vertex for the flow network graph.
Named Parameters
-
+
IN: capacity_map(EdgeCapacityMap cap)
The edge capacity property map. The type must be a model of a
@@ -112,7 +112,7 @@ Named Parameters
key type of the map must be the graph's edge descriptor type.
Default: get(edge_capacity, g)
-
+
OUT: residual_capacity_map(ResidualCapacityEdgeMap res)
The edge residual capacity property map. The type must be a model of
@@ -121,7 +121,7 @@ Named Parameters
key type of the map must be the graph's edge descriptor type.
Default: get(edge_residual_capacity, g)
-
+
IN: reverse_edge_map(ReverseEdgeMap rev)
An edge property map that maps every edge (u,v) in the graph
@@ -131,7 +131,7 @@ Named Parameters
key type of the map must be the graph's edge descriptor type.
Default: get(edge_reverse, g)
-
+
IN: vertex_index_map(VertexIndexMap index_map)
Maps each vertex of the graph to a unique integer in the range
@@ -168,7 +168,7 @@ Example
using namespace boost;
typedef adjacency_list_traits<vecS, vecS, directedS> Traits;
- typedef adjacency_list<vecS, vecS, directedS,
+ typedef adjacency_list<vecS, vecS, directedS,
property<vertex_name_t, std::string>,
property<edge_capacity_t, long,
property<edge_residual_capacity_t, long,
@@ -178,11 +178,11 @@ Example
Graph g;
long flow;
- property_map<Graph, edge_capacity_t>::type
+ property_map<Graph, edge_capacity_t>::type
capacity = get(edge_capacity, g);
- property_map<Graph, edge_reverse_t>::type
+ property_map<Graph, edge_reverse_t>::type
rev = get(edge_reverse, g);
- property_map<Graph, edge_residual_capacity_t>::type
+ property_map<Graph, edge_residual_capacity_t>::type
residual_capacity = get(edge_residual_capacity, g);
Traits::vertex_descriptor s, t;
@@ -199,7 +199,7 @@ Example
for (boost::tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter)
for (boost::tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei)
if (capacity[*ei] > 0)
- std::cout << "f " << *u_iter << " " << target(*ei, g) << " "
+ std::cout << "f " << *u_iter << " " << target(*ei, g) << " "
<< (capacity[*ei] - residual_capacity[*ei]) << std::endl;
return 0;
}
@@ -237,7 +237,7 @@ See Also
-
+
-
-
+
+
Boost Graph Library: Python Bindings (Experimental)
The Boost Graph Library offers a wealth of graph algorithms and
data types for C++. These algorithms are flexible and efficient,
diff --git a/doc/quick_tour.html b/doc/quick_tour.html
index 6078c6bd1..f6e248311 100644
--- a/doc/quick_tour.html
+++ b/doc/quick_tour.html
@@ -2,7 +2,7 @@
Boost Graph Library: Resource-Constrained Shortest Paths
-
-
+
+
@@ -443,7 +443,7 @@ Parameters
A container for storing the Pareto-optimal resource containers in the overloads where all Pareto-optimal solutions are returned.
-OUT: std::vector<typename graph_traits<Graph>::edge_descriptor>&
+OUT: std::vector<typename graph_traits<Graph>::edge_descriptor>&
pareto_optimal_solution
A container for storing the first Pareto-optimal (undominated) solution (s-t-path) in the overloads where only one Pareto-optimal solution is returned. The path is returned as a sequence of edge descriptors in reverse order (from t to s). This argument is not modified if there are no solutions.
diff --git a/doc/random.html b/doc/random.html
index 058555060..1799dc554 100644
--- a/doc/random.html
+++ b/doc/random.html
@@ -1,7 +1,7 @@
Boost Graph Library: Random Graph Layout
-
-
+
+
@@ -37,10 +37,10 @@ Where Defined
Parameters
-IN: const Graph& g
+IN: const Graph& g
The graph object on which the algorithm will be applied.
- The type Graph must be a model of
+ The type Graph must be a model of
Vertex And Edge List Graph.
@@ -75,4 +75,4 @@ Complexity
-
+
diff --git a/doc/random_spanning_tree.html b/doc/random_spanning_tree.html
index 474a19ddd..21d5500a9 100644
--- a/doc/random_spanning_tree.html
+++ b/doc/random_spanning_tree.html
@@ -1,21 +1,21 @@
Boost Graph Library: Random Spanning Tree
-
-
+
+
@@ -157,4 +157,4 @@ Named Parameters
-
+
diff --git a/doc/read_dimacs.html b/doc/read_dimacs.html
index 3c50673c0..0269c9d81 100644
--- a/doc/read_dimacs.html
+++ b/doc/read_dimacs.html
@@ -34,10 +34,10 @@
-->
Boost Graph Library: read_dimacs_max_flow and read_dimacs_min_cut
-
-
+
+
@@ -49,7 +49,7 @@
//reads a graph with attached edge_capacity properties from an std::istream
template <class Graph, class CapacityMap, class ReverseEdgeMap>
int read_dimacs_max_flow(Graph& g,
- CapacityMap capacity,
+ CapacityMap capacity,
ReverseEdgeMap reverse_edge,
typename graph_traits::vertex_descriptor& src,
typename graph_traits::vertex_descriptor& sink,
@@ -58,18 +58,18 @@
//reads a graph with attached edge_capacity properties from an std::istream
template <class Graph, class CapacityMap, class ReverseEdgeMap>
int read_dimacs_min_cut(Graph& g,
- CapacityMap capacity,
+ CapacityMap capacity,
ReverseEdgeMap reverse_edge,
std::istream& in=std::cin)
-These functions read a BGL graph object from a max-flow or min-cut problem description in extended dimacs format. (see Goldberg's site for more information). For each edge found in the
+These functions read a BGL graph object from a max-flow or min-cut problem description in extended dimacs format. (see Goldberg's site for more information). For each edge found in the
file an additional reverse_edge is added and set in the reverse_edge map. For
max-flow problems, source and sink vertex descriptors are set according to the
dimacs file.
-
+
Where Defined
@@ -78,37 +78,37 @@
Where Defined
Parameters
IN: Graph& g
- A directed or undirected graph. The graph's type must be a model of IncidenceGraph.
-
+ A directed or undirected graph. The graph's type must be a model of IncidenceGraph.
+
OUT: CapacityMap capacity
A property map that models mutable Lvalue Property Map whose key type is the edge descriptor of the graph.
-
+
OUT: ReverseEdgeMap reverse_edge
A property map that models mutable Lvalue Property Map whose key and value type is the edge descriptor of the graph. This map stores the corresponding reverse edge for each each in Graph g.
-
-
+
+
OUT: vertex_descriptor& src
A graph vertex that will be set to the source of a max-flow problem.
-
-
+
+
OUT: vertex_descriptor& sink
A graph vertex that will be set to the sink of a max-flow problem.
-
-
+
+
IN: std::istream& in
A standard std::istream object.
Default: std::cin (for backward compatibility)
-
+
-Example
+Example
A short example which uses read_dimacs and write_dimacs is located in the examples directory.
@@ -116,4 +116,4 @@ See Also
write_dimacs
-
+
diff --git a/doc/read_graphml.rst b/doc/read_graphml.rst
index 1e8bd8182..61323a9fe 100644
--- a/doc/read_graphml.rst
+++ b/doc/read_graphml.rst
@@ -3,11 +3,11 @@
============================
.. Copyright (C) 2006 Tiago de Paula Peixoto
-
+
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)
-
+
Authors: Tiago de Paula Peixoto
.. |(logo)| image:: ../../../boost.png
@@ -21,11 +21,11 @@ __ ../../../index.htm
void read_graphml(std::istream& in, MutableGraph& graph,
dynamic_properties& dp, size_t graph_index = 0);
-
+
The ``read_graphml`` function interprets a graph described using the
GraphML_ format and builds a BGL graph that captures that
description. Using this function, you can initialize a graph using
-data stored as text.
+data stored as text.
The GraphML format can specify both directed and undirected graphs, and
``read_graphml`` differentiates between the two. One must pass
diff --git a/doc/read_graphviz.rst b/doc/read_graphviz.rst
index 92e7c7cc0..95df2ceb6 100644
--- a/doc/read_graphviz.rst
+++ b/doc/read_graphviz.rst
@@ -15,25 +15,25 @@ __ ../../../index.htm
::
namespace boost {
-
+
template
bool read_graphviz(std::istream& in, MutableGraph& graph,
- dynamic_properties& dp,
+ dynamic_properties& dp,
const std::string& node_id = "node_id");
-
+
template
bool read_graphviz(std::string& str, MutableGraph& graph,
- dynamic_properties& dp,
+ dynamic_properties& dp,
const std::string& node_id = "node_id");
-
+
template
bool read_graphviz(InputIterator begin, InputIterator end,
- MutableGraph& graph, dynamic_properties& dp,
+ MutableGraph& graph, dynamic_properties& dp,
const std::string& node_id = "node_id");
-
+
}
-
+
The ``read_graphviz`` function interprets a graph described using the
GraphViz_ DOT language and builds a BGL graph that captures that
description. Using these functions, you can initialize a graph using
@@ -51,7 +51,7 @@ takes a dynamic_properties_ object and operates on its collection of
property maps. The reader passes all the properties encountered to
this object, using the GraphViz string keys as the property keys.
Furthermore, ``read_graphviz`` stores node identifier names under the
-vertex property map named ``node_id``.
+vertex property map named ``node_id``.
Requirements:
- The type of the graph must model the `Mutable Graph`_ concept.
@@ -140,7 +140,7 @@ GraphViz reader to populate an ``adjacency_list`` graph
// Vertex properties
typedef property < vertex_name_t, std::string,
- property < vertex_color_t, float > > vertex_p;
+ property < vertex_color_t, float > > vertex_p;
// Edge properties
typedef property < edge_weight_t, double > edge_p;
// Graph properties
@@ -166,7 +166,7 @@ GraphViz reader to populate an ``adjacency_list`` graph
dp.property("weight",weight);
// Use ref_property_map to turn a graph property into a property map
- boost::ref_property_map
+ boost::ref_property_map
gname(get_property(graph,graph_name));
dp.property("name",gname);
@@ -209,7 +209,7 @@ Notes
reflect subgraphs as actual entities in the BGL. Rather, they are
used to shorten some edge definitions as well as to give a subset
of all nodes or edges certain properties. For example, the
- DOT graphs ``digraph { a -> subgraph {b -> c} -> e }`` and
+ DOT graphs ``digraph { a -> subgraph {b -> c} -> e }`` and
``digraph { a -> b -> e ; a -> c -> e ; b -> c}`` are equivalent.
- Subgraph IDs refer to subgraphs defined earlier in the graph
diff --git a/doc/reverse_graph.html b/doc/reverse_graph.html
index 761b75450..662d4813a 100644
--- a/doc/reverse_graph.html
+++ b/doc/reverse_graph.html
@@ -1,17 +1,17 @@
Boost Graph Library: Reverse Graph Adaptor
-
-
+
+
@@ -39,10 +39,10 @@ Example
int
main()
{
- typedef boost::adjacency_list<
+ typedef boost::adjacency_list<
boost::vecS, boost::vecS, boost::bidirectionalS,
> Graph;
-
+
Graph G(5);
boost::add_edge(0, 2, G);
boost::add_edge(1, 1, G);
@@ -60,7 +60,7 @@ Example
boost::print_graph(G, boost::get(boost::vertex_index, G));
std::cout << std::endl << "reversed graph:" << std::endl;
- boost::print_graph(boost::make_reverse_graph(G),
+ boost::print_graph(boost::make_reverse_graph(G),
boost::get(boost::vertex_index, G));
@@ -70,18 +70,18 @@ Example
The output is:
original graph:
-0 --> 2
-1 --> 1 3 4
-2 --> 1 3 4
-3 --> 1 4
-4 --> 0 1
+0 --> 2
+1 --> 1 3 4
+2 --> 1 3 4
+3 --> 1 4
+4 --> 0 1
reversed graph:
-0 --> 4
-1 --> 1 2 3 4
-2 --> 0
-3 --> 1 2
-4 --> 1 2 3
+0 --> 4
+1 --> 1 2 3 4
+2 --> 0
+3 --> 1 2
+4 --> 1 2 3
Template Parameters
@@ -443,4 +443,4 @@ Non-Member Functions
-
+
diff --git a/doc/sequential_vertex_coloring.html b/doc/sequential_vertex_coloring.html
index 8620be922..6ffa9b561 100644
--- a/doc/sequential_vertex_coloring.html
+++ b/doc/sequential_vertex_coloring.html
@@ -2,7 +2,7 @@
-
sloan_ordering
@@ -26,114 +26,114 @@
sloan_ordering
Complexity:
- time: O(log(m)|E|) where m = max { degree(v) | v
+ time: O(log(m)|E|) where m = max { degree(v) | v
in V }
(1)
template <class Graph, class OutputIterator,
- class ColorMap, class DegreeMap,
+ class ColorMap, class DegreeMap,
class PriorityMap, class Weight>
OutputIterator
sloan_ordering(Graph& g,
typename graph_traits<Graph>::vertex_descriptor s,
typename graph_traits<Graph>::vertex_descriptor e,
- OutputIterator permutation,
- ColorMap color,
- DegreeMap degree,
- PriorityMap priority,
- Weight W1,
+ OutputIterator permutation,
+ ColorMap color,
+ DegreeMap degree,
+ PriorityMap priority,
+ Weight W1,
Weight W2 )
(2)
template <class Graph, class OutputIterator,
- class ColorMap, class DegreeMap,
+ class ColorMap, class DegreeMap,
class PriorityMap, class Weight>
OutputIterator
sloan_ordering(Graph& g,
- OutputIterator permutation,
- ColorMap color,
- DegreeMap degree,
- PriorityMap priority,
- Weight W1,
+ OutputIterator permutation,
+ ColorMap color,
+ DegreeMap degree,
+ PriorityMap priority,
+ Weight W1,
Weight W2 )
(3)
template <class Graph, class OutputIterator,
- class ColorMap, class DegreeMap,
+ class ColorMap, class DegreeMap,
class PriorityMap>
OutputIterator
sloan_ordering(Graph& g,
typename graph_traits<Graph>::vertex_descriptor s,
typename graph_traits<Graph>::vertex_descriptor e,
- OutputIterator permutation,
- ColorMap color,
- DegreeMap degree,
+ OutputIterator permutation,
+ ColorMap color,
+ DegreeMap degree,
PriorityMap priority )
(4)
template <class Graph, class OutputIterator,
- class ColorMap, class DegreeMap,
+ class ColorMap, class DegreeMap,
class PriorityMap>
OutputIterator
sloan_ordering(Graph& g,
- OutputIterator permutation,
- ColorMap color,
- DegreeMap degree,
+ OutputIterator permutation,
+ ColorMap color,
+ DegreeMap degree,
PriorityMap priority )
-The goal of the Sloan ordering algorithm[1, 2] is to reduce the profile and - the wavefront of a graph by reordering the indices assigned to each vertex. - The Sloan algorithm needs a start and an end vertex. These vertices can be asigned - manually. But there is also an algorithm sloan_starting_nodes that provides - usually quite good start and end vertices. Each vertex is asigned with a priority. - This priority is a weighted sum of the distance of the vector to the end vertex - (a global criterion) and is called the current degree of vertex. This current - degree basically reflects the status of the renumbering in the neighborhood - of a vertex (a local criterion). Therefore the Sloan algorithm (in contrast - to-McKee) takes into account local as well as global criteria for the renumbering - sequence. One can play around with the relative weights, but the default values - proposed by Sloan (weight1/weight2=1/2) turn out to be pretty good in most cases. +
The goal of the Sloan ordering algorithm[1, 2] is to reduce the profile and + the wavefront of a graph by reordering the indices assigned to each vertex. + The Sloan algorithm needs a start and an end vertex. These vertices can be asigned + manually. But there is also an algorithm sloan_starting_nodes that provides + usually quite good start and end vertices. Each vertex is asigned with a priority. + This priority is a weighted sum of the distance of the vector to the end vertex + (a global criterion) and is called the current degree of vertex. This current + degree basically reflects the status of the renumbering in the neighborhood + of a vertex (a local criterion). Therefore the Sloan algorithm (in contrast + to-McKee) takes into account local as well as global criteria for the renumbering + sequence. One can play around with the relative weights, but the default values + proposed by Sloan (weight1/weight2=1/2) turn out to be pretty good in most cases.
-Version 1 of the algorithm lets the user choose the start- and end-vertex whereas - version 2 finds a good starting vertex using the already mentioned sloan_starting_node - algorithm. The choice of these vertices can have a significant effect on the - quality of the ordering. Version 3 and 4 are identical to version 1 and 2 respectively, - except that for the weights the standard weights W1=1 and W2=2 are used. -
The output of the algorithm are the vertices in the new ordering. Depending - on what kind of output iterator you use, you can get either the Sloan ordering - or the reverse Sloan ordering. For example, if you store the output into a vector - using the vector's reverse iterator, then you get the reverse Sloan ordering. +
Version 1 of the algorithm lets the user choose the start- and end-vertex whereas + version 2 finds a good starting vertex using the already mentioned sloan_starting_node + algorithm. The choice of these vertices can have a significant effect on the + quality of the ordering. Version 3 and 4 are identical to version 1 and 2 respectively, + except that for the weights the standard weights W1=1 and W2=2 are used. +
The output of the algorithm are the vertices in the new ordering. Depending + on what kind of output iterator you use, you can get either the Sloan ordering + or the reverse Sloan ordering. For example, if you store the output into a vector + using the vector's reverse iterator, then you get the reverse Sloan ordering.
std::vector<vertex_descriptor> inv_perm(num_vertices(G)); sloan_ordering(G, inv_perm.rbegin());-
Either way, storing the output into a vector gives you the permutation from +
Either way, storing the output into a vector gives you the permutation from the new ordering to the old ordering.
inv_perm[new_index[u]] == u-
Sometimes, it is the opposite permutation that you want, the permutation from - the old index to the new index. This can easily be computed in the following - way. +
Sometimes, it is the opposite permutation that you want, the permutation from + the old index to the new index. This can easily be computed in the following + way.
for (size_type i = 0; i != inv_perm.size(); ++i)
perm[old_index[inv_perm[i]]] = i;
-Usually you need the reversed ordering with the Cuthill-McKee algorithm and +
Usually you need the reversed ordering with the Cuthill-McKee algorithm and the direct ordering with the Sloan algorithm.
For version 2:
For version 3:
For version 4:
sloan_start_end_vertices, - bandwidth, profile, wavefront +
sloan_start_end_vertices, + bandwidth, profile, wavefront and degree_property_map in boost/graph/properties.hpp.
-[1] S. W. Sloan, An algorithm for profile and wavefront reduction of sparse +
[1] S. W. Sloan, An algorithm for profile and wavefront reduction of sparse matrices, Int. j. numer. methods eng., 23, 239 - 251 (1986)
-[2] S. W. Sloan, A fortran program for profile and wavefront reduction, +
[2] S. W. Sloan, A fortran program for profile and wavefront reduction,
Int. j. numer. methods eng., 28, 2651 - 2679 (1989)
| Copyright © 2001-2002 | -Marc Wintermantel, ETH Zurich (wintermantel@imes.mavt.ethz.ch) + | Marc Wintermantel, ETH Zurich (wintermantel@imes.mavt.ethz.ch) |
@@ -34,53 +34,53 @@
The goal of the sloan_start_end_vertices algorithm[1, 2] is to find good start- - and end-vertices for the profile and wavefront reduction algorithm sloan_ordering. - The algorithm is similar to pseudo_peripheral_pair and also based on breadth_first_search. - With this breadth_first_search function a so-called rooted level structure (RLS) - is formed, where the vertices with the same distance to the starting vertex - are grouped together. The maximum number of vertices in one group is called - the width of the RLS. Sloan_start_end_vertices tries to find a pseudoperipheral +
The goal of the sloan_start_end_vertices algorithm[1, 2] is to find good start- + and end-vertices for the profile and wavefront reduction algorithm sloan_ordering. + The algorithm is similar to pseudo_peripheral_pair and also based on breadth_first_search. + With this breadth_first_search function a so-called rooted level structure (RLS) + is formed, where the vertices with the same distance to the starting vertex + are grouped together. The maximum number of vertices in one group is called + the width of the RLS. Sloan_start_end_vertices tries to find a pseudoperipheral pair with a minimum RLS-width.
sloan_start_end_vertices, - bandwidth, profile, - wavefront and +
sloan_start_end_vertices, + bandwidth, profile, + wavefront and degree_property_map in boost/graph/properties.hpp.
-[1] S. W. Sloan, An algorithm for profile and wavefront reduction of sparse +
[1] S. W. Sloan, An algorithm for profile and wavefront reduction of sparse matrices, Int. j. numer. methods eng., 23, 239 - 251 (1986)
-[2] S. W. Sloan, A fortran program for profile and wavefront reduction, +
[2] S. W. Sloan, A fortran program for profile and wavefront reduction,
Int. j. numer. methods eng., 28, 2651 - 2679 (1989)
| Copyright © 2001-2002 | -Marc Wintermantel, ETH Zurich(wintermantel@imes.mavt.ethz.ch) + | Marc Wintermantel, ETH Zurich(wintermantel@imes.mavt.ethz.ch) |
+
+
small_world_iterator
@@ -54,7 +54,7 @@
small_world_iterator operator++(int);
bool operator==(const small_world_iterator& other) const;
bool operator!=(const small_world_iterator& other) const;
-};
+};
This class template implements a generator for small-world graphs, @@ -106,7 +106,7 @@
+
+
namespace boost {
template <class Graph, class Vertex, class Color, class Degree>
- Vertex
+ Vertex
pseudo_peripheral_pair(Graph& G, const Vertex& u, int& ecc,
Color color, Degree degree)
{
typename property_traits<Color>::value_type c = get(color, u);
rcm_queue<Vertex, Degree> Q(degree);
-
+
typename boost::graph_traits<Graph>::vertex_iterator ui, ui_end;
for (boost::tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui)
put(color, *ui, white(c));
breadth_first_search(G, u, Q, bfs_visitor<>(), color);
- ecc = Q.eccentricity();
+ ecc = Q.eccentricity();
return Q.spouse();
}
-
- template <class Graph, class Vertex, class Color, class Degree>
+
+ template <class Graph, class Vertex, class Color, class Degree>
Vertex find_starting_node(Graph& G, Vertex r, Color c, Degree d) {
int eccen_r, eccen_x;
Vertex x = pseudo_peripheral_pair(G, r, eccen_r, c, d);
@@ -196,12 +196,12 @@
- template < class Graph, class Vertex, class OutputIterator,
+ template < class Graph, class Vertex, class OutputIterator,
class Color, class Degree >
- inline void
- cuthill_mckee_ordering(Graph& G,
+ inline void
+ cuthill_mckee_ordering(Graph& G,
Vertex s,
- OutputIterator inverse_permutation,
+ OutputIterator inverse_permutation,
Color color, Degree degree)
{
typedef typename property_traits<Degree>::value_type DS;
@@ -212,12 +212,12 @@
typedef cuthill_mckee_visitor<OutputIterator> CMVisitor;
CMVisitor cm_visitor(inverse_permutation);
-
+
typename boost::graph_traits<Graph>::vertex_iterator ui, ui_end;
for (boost::tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui)
put(color, *ui, white(c));
breadth_first_search(G, s, Q, cm_visitor, color);
- }
+ }
@@ -246,18 +246,18 @@ Minimum Degree Ordering Algorithm
- Start: Construct undirected graph G0
corresponding to matrix A
-
+
-- Iterate: For k = 1, 2, ... until
+
- Iterate: For k = 1, 2, ... until
Gk = { } do:
-
+
- Choose a vertex vk from Gk
according to some criterion
-- Eliminate vk from Gk to form
+
- Eliminate vk from Gk to form
Gk+1
-
+
@@ -374,4 +374,4 @@ Proper Self-Avoiding Walk
-
+
diff --git a/doc/stanford_graph.html b/doc/stanford_graph.html
index 6e3a77ea9..ea578cbe2 100644
--- a/doc/stanford_graph.html
+++ b/doc/stanford_graph.html
@@ -9,10 +9,10 @@
-->
Boost Graph Library: Stanford Graph Interface
-
-
+
+
@@ -455,4 +455,4 @@ Vertex and Edge Properties
-
+
diff --git a/doc/stoer_wagner_min_cut.html b/doc/stoer_wagner_min_cut.html
index ddd862785..344f488d1 100644
--- a/doc/stoer_wagner_min_cut.html
+++ b/doc/stoer_wagner_min_cut.html
@@ -10,7 +10,7 @@
Boost Graph Library: Stoer–Wagner Min-Cut
-
+
stoer_wagner_min_cut
@@ -67,7 +67,7 @@ Named Parameters
Expert Parameters
-IN: vertex_index_map(VertexIndexMap vertexIndices)
+
IN: vertex_index_map(VertexIndexMap vertexIndices)
This maps each vertex to an integer in the range [0, num_vertices(g)). This
is only necessary if the default is used for the assignment, index-in-heap, or distance maps.
@@ -92,7 +92,7 @@ Expert Parameters
MaxPriorityQueue must be a model of Keyed Updatable Queue
and a max-Updatable Priority Queue.
- The value type must be the graph's vertex descriptor and the key type must be
+ The value type must be the graph's vertex descriptor and the key type must be
the weight type.
Default: A boost::d_ary_heap_indirect using a default index-in-heap
and distance map.
diff --git a/doc/straight_line_drawing.html b/doc/straight_line_drawing.html
index d54e6e71f..66c87a29d 100644
--- a/doc/straight_line_drawing.html
+++ b/doc/straight_line_drawing.html
@@ -1,17 +1,17 @@
Boost Graph Library: Chrobak-Payne Straight Line Drawing
-
-
+
+
@@ -19,13 +19,13 @@ Chrobak-Payne Straight Line Drawing
-template<typename Graph,
- typename PlanarEmbedding,
- typename ForwardIterator,
+template<typename Graph,
+ typename PlanarEmbedding,
+ typename ForwardIterator,
typename PositionMap,
typename VertexIndexMap>
-void chrobak_payne_straight_line_drawing(const Graph& g,
- PlanarEmbedding perm,
+void chrobak_payne_straight_line_drawing(const Graph& g,
+ PlanarEmbedding perm,
ForwardIterator ordering_begin,
ForwardIterator ordering_end,
PositionMap drawing,
@@ -36,14 +36,14 @@ Chrobak-Payne Straight Line Drawing
A straight line drawing of a
-planar graph is a plane
-drawing where each edge is drawn using a straight line segment. Since all
-edges are line segments, the drawing is completely determined by the placement
-of vertices in the plane. chrobak_payne_straight_line_drawing uses an
-algorithm of Chrobak and Payne
-[71]
-to form a straight
-line drawing of a planar graph by mapping all n vertices in a planar
+planar graph is a plane
+drawing where each edge is drawn using a straight line segment. Since all
+edges are line segments, the drawing is completely determined by the placement
+of vertices in the plane. chrobak_payne_straight_line_drawing uses an
+algorithm of Chrobak and Payne
+[71]
+to form a straight
+line drawing of a planar graph by mapping all n vertices in a planar
graph to integer coordinates in a (2n - 4) x (n - 2) grid.
@@ -51,18 +51,18 @@ Chrobak-Payne Straight Line Drawing
-The input graph passed to chrobak_payne_straight_line_drawing must
-be a maximal planar graph with at least
-3 vertices. Self-loops and parallel edges are ignored by this function. Note
+The input graph passed to chrobak_payne_straight_line_drawing must
+be a maximal planar graph with at least
+3 vertices. Self-loops and parallel edges are ignored by this function. Note
that the restriction that the graph be maximal planar does not
mean that this function can only draw maximal planar graphs (the graph pictured
-above is not maximal planar, for example). If you want to
-draw a graph g, you can create a copy g' of g, store a
-mapping m of vertices in g' to vertices in g,
-triangulate g', and then send
-g' in as the input to chrobak_payne_straight_line_drawing. The
-drawing returned can then be applied to g using m to translate
-vertices from one graph to another, since g contains a subset of the
+above is not maximal planar, for example). If you want to
+draw a graph g, you can create a copy g' of g, store a
+mapping m of vertices in g' to vertices in g,
+triangulate g', and then send
+g' in as the input to chrobak_payne_straight_line_drawing. The
+drawing returned can then be applied to g using m to translate
+vertices from one graph to another, since g contains a subset of the
edges in g'.
@@ -70,10 +70,10 @@
Chrobak-Payne Straight Line Drawing
Complexity
If the vertex index map provides constant-time access to indices, this
-function takes time O(n + m) for a planar graph with n vertices
-and m edges. Note that
-in a simple planar graph with f faces, m edges, and n
-vertices, both f and m are O(n).
+function takes time O(n + m) for a planar graph with n vertices
+and m edges. Note that
+in a simple planar graph with f faces, m edges, and n
+vertices, both f and m are O(n).
Where Defined
@@ -96,26 +96,26 @@ Parameters
A Readable Property Map
- that models the PlanarEmbedding
+ that models the PlanarEmbedding
concept.
IN ForwardIterator
-A ForwardIterator that has value_type equal to
+A ForwardIterator that has value_type equal to
graph_traits<Graph>::vertex_descriptor.
-OUT: PositionMap
+OUT: PositionMap
-A Writable LValue Property
+A Writable LValue Property
Map that models the Position Map concept. The Position Map concept requires
that the value mapped to be an object that has members x and
y. For example, if p models PositionMap and v
is a vertex in the graph, p[v].x and p[v].y are valid
-expressions. The type of x and y must be implicitly
+expressions. The type of x and y must be implicitly
convertable to std::size_t.
@@ -123,7 +123,7 @@ Parameters
A Readable Property Map
- that maps vertices from g to distinct integers in the range
+ that maps vertices from g to distinct integers in the range
[0, num_vertices(g) )
Default: get(vertex_index,g)
@@ -151,4 +151,4 @@ See Also
Copyright © 2007 Aaron Windsor (
aaron.windsor@gmail.com)
-
+
diff --git a/doc/strong_components.html b/doc/strong_components.html
index 39c0cc52d..b97b78302 100644
--- a/doc/strong_components.html
+++ b/doc/strong_components.html
@@ -1,17 +1,17 @@
Boost Graph Library: Strongly Connected Components
-
-
+
+
@@ -198,4 +198,4 @@ Example
-
+
diff --git a/doc/strong_components.w b/doc/strong_components.w
index 503f4fed1..bc96bb02d 100644
--- a/doc/strong_components.w
+++ b/doc/strong_components.w
@@ -40,7 +40,7 @@ have a common ancestor in $F$. Also, if $u$ is the common ancestor of
$u$ and $v$ with the latest discover time then $w$ is also in the same
SCC as $u$ and $v$.
-Proof.
+Proof.
If there is a path from $v$ to $w$ and if they are in different DFS
trees, then the discover time for $w$ must be earlier than for $v$.
@@ -76,13 +76,13 @@ following cases:
$u$ in the DFS tree and therefore we have a cycle and $u$ must be in
a SCC with $a$. We then set $root[u] = a$ and continue our way back up
the DFS.
-
+
\item If $a = u$ then we know that $u$ must be the topmost vertex of a
subtree that defines a SCC. All of the vertices in this subtree are
further down on the stack than vertex $u$ so we pop the vertices off
of the stack until we reach $u$ and mark each one as being in the
same component.
-
+
\item If $d[a] > d[u]$ then the adjacent vertices are in different
strongly connected components. We continue our way back up the
DFS.
diff --git a/doc/successive_shortest_path_nonnegative_weights.html b/doc/successive_shortest_path_nonnegative_weights.html
index 434eabbbb..b895018e4 100644
--- a/doc/successive_shortest_path_nonnegative_weights.html
+++ b/doc/successive_shortest_path_nonnegative_weights.html
@@ -1,17 +1,17 @@
Boost Graph Library: Successive Shortest Path for Min Cost Max Flow
-
-
+
+
@@ -23,34 +23,34 @@
// named parameter version
template <class Graph, class P, class T, class R>
void successive_shortest_path_nonnegative_weights(
- Graph &g,
- typename graph_traits<Graph>::vertex_descriptor s,
+ Graph &g,
+ typename graph_traits<Graph>::vertex_descriptor s,
typename graph_traits<Graph>::vertex_descriptor t,
const bgl_named_params<P, T, R> & params = all defaults)
// non-named parameter version
template <class Graph, class Capacity, class ResidualCapacity, class Reversed, class Pred, class Weight, class Distance, class Distance2, class VertexIndex>
void successive_shortest_path_nonnegative_weights(
- const Graph & g,
- typename graph_traits<Graph>::vertex_descriptor s,
+ const Graph & g,
+ typename graph_traits<Graph>::vertex_descriptor s,
typename graph_traits<Graph>::vertex_descriptor t,
Capacity capacity,
ResidualCapacity residual_capacity,
- Weight weight,
+ Weight weight,
Reversed rev,
VertexIndex index,
- Pred pred,
+ Pred pred,
Distance distance,
- Distance2 distance_prev)
+ Distance2 distance_prev)
The successive_shortest_path_nonnegative_weights() function calculates the minimum cost maximum flow of a network. See Section Network
-Flow Algorithms for a description of maximum flow.
+Flow Algorithms for a description of maximum flow.
The function calculates the flow values f(u,v) for all (u,v) in
E, which are returned in the form of the residual capacity
-r(u,v) = c(u,v) - f(u,v).
+r(u,v) = c(u,v) - f(u,v).
There are several special requirements on the input graph and property
@@ -72,7 +72,7 @@
This algorithm starts with empty flow and in each round augments the shortest path (in terms of weight) in the residual graph.
-
+
In order to find the cost of the result flow use:
find_flow_cost().
@@ -98,12 +98,12 @@
Parameters
The source vertex for the flow network graph.
-
+
IN: vertex_descriptor t
The sink vertex for the flow network graph.
-
+
Named Parameters
@@ -115,7 +115,7 @@ Named Parameters
key type of the map must be the graph's edge descriptor type.
Default: get(edge_capacity, g)
-
+
OUT: residual_capacity_map(ResidualCapacityEdgeMap res)
This maps edges to their residual capacity. The type must be a model
@@ -136,11 +136,11 @@ Named Parameters
Default: get(edge_reverse, g)
-IN: weight_map(WeightMap w_map)
+IN: weight_map(WeightMap w_map)
The weight or ``cost'' of each edge in the graph. The weights
must all be non-negative, and the algorithm will throw a
- negative_edge
+ negative_edge
exception if one of the edges is negative.
The type WeightMap must be a model of
Readable Property Map. The edge descriptor type of
@@ -166,7 +166,7 @@ Named Parameters
using the i_map for the index map.
-UTIL: distance_map(DistanceMap d_map)
+UTIL: distance_map(DistanceMap d_map)
The shortest path weight from the source vertex s to each
vertex in the graph g is recorded in this property map. The
@@ -174,7 +174,7 @@ Named Parameters
shortest path. The type DistanceMap must be a model of Read/Write
Property Map. The vertex descriptor type of the graph needs to
- be usable as the key type of the distance map.
+ be usable as the key type of the distance map.
Default:
@@ -185,13 +185,13 @@ Named Parameters
-UTIL: distance_map2(DistanceMap2 d_map2)
+UTIL: distance_map2(DistanceMap2 d_map2)
The shortest path computation in iteration nr k uses distances computed in iteration k.
The type DistanceMap2 must be a model of Read/Write
Property Map. The vertex descriptor type of the graph needs to
- be usable as the key type of the distance map.
+ be usable as the key type of the distance map.
Default:
@@ -220,7 +220,7 @@ Named Parameters
Complexity
-In the integer capacity case, if U is the value of the max flow, then the complexity is O(U * (|E| + |V|*log|V|)),
+In the integer capacity case, if U is the value of the max flow, then the complexity is O(U * (|E| + |V|*log|V|)),
where O(|E| + |V|*log|V|) is the complexity of the dijkstra algorithm and U is upper bound on number of iteration.
In many real world cases number of iterations is much smaller than U.
@@ -244,7 +244,7 @@ See Also
-
+
Boost Graph Library: time_stamper
-
-
+
+
@@ -193,7 +193,7 @@ See Also
-
+
Boost Graph Library: Topological Sort
-
-
+
+
@@ -153,4 +153,4 @@ Example
-
+
diff --git a/doc/topology.html b/doc/topology.html
index 2eefd237d..a2abbd29e 100644
--- a/doc/topology.html
+++ b/doc/topology.html
@@ -1,7 +1,7 @@
Boost Graph Library: Transitive Closure
-
-
+
+
@@ -66,7 +66,7 @@ Parameters
OUT: GraphTC& tc
A directed graph, where the GraphTC type must model the
- Vertex Mutable Graph
+ Vertex Mutable Graph
and Edge Mutable Graph concepts.
Python: This parameter is not used in Python. Instead, a new
@@ -221,4 +221,4 @@ Implementation Notes
-
+
diff --git a/doc/transitive_closure.w b/doc/transitive_closure.w
index 136eab681..9e214b3e0 100644
--- a/doc/transitive_closure.w
+++ b/doc/transitive_closure.w
@@ -97,7 +97,7 @@ void transitive_closure(const Graph& g, GraphTC& tc)
typedef typename graph_traits::vertex_descriptor tc_vertex;
std::vector to_tc_vec(num_vertices(g));
- iterator_property_map
+ iterator_property_map
g_to_tc_map(&to_tc_vec[0], index_map);
transitive_closure(g, tc, g_to_tc_map, index_map);
@@ -118,7 +118,7 @@ void transitive_closure(const Graph& g, GraphTC& tc,
const bgl_named_params& params)
{
if (num_vertices(g) == 0) return;
- detail::transitive_closure_dispatch(g, tc,
+ detail::transitive_closure_dispatch(g, tc,
get_param(params, orig_to_copy),
choose_const_pmap(get_param(params, vertex_index), g, vertex_index)
);
@@ -132,7 +132,7 @@ mapping or to use the default, a vector, to map between the two.
@d Construct Default G to TC Vertex Mapping
@{
namespace detail {
- template
void transitive_closure_dispatch
@@ -141,7 +141,7 @@ namespace detail {
VertexIndexMap index_map)
{
typedef typename graph_traits::vertex_descriptor tc_vertex;
- typename std::vector::size_type
+ typename std::vector::size_type
n = is_default_param(g_to_tc_map) ? num_vertices(g) : 1;
std::vector to_tc_vec(n);
@@ -192,7 +192,7 @@ the same integer type \code{cg\_vertex} for both.
@{
typedef size_type cg_vertex;
std::vector component_number_vec(num_vertices(g));
-iterator_property_map
+iterator_property_map
component_number(&component_number_vec[0], index_map);
int num_scc = strong_components(g, component_number,
@@ -259,7 +259,7 @@ for (cg_vertex s = 0; s < components.size(); ++s) {
std::sort(adj.begin(), adj.end());
std::vector::iterator di = std::unique(adj.begin(), adj.end());
if (di != adj.end())
- adj.erase(di, adj.end());
+ adj.erase(di, adj.end());
CG[s] = adj;
}
@}
@@ -335,7 +335,7 @@ topological numbers to the vertices.
@{
std::vector topo_order;
std::vector topo_number(num_vertices(CG));
-topological_sort(CG, std::back_inserter(topo_order),
+topological_sort(CG, std::back_inserter(topo_order),
vertex_index_map(identity_property_map()));
std::reverse(topo_order.begin(), topo_order.end());
size_type n = 0;
@@ -354,10 +354,10 @@ returns the topological number of its input argument.
@d Sort the out-edge lists by topological number
@{
for (size_type i = 0; i < num_vertices(CG); ++i)
- std::sort(CG[i].begin(), CG[i].end(),
+ std::sort(CG[i].begin(), CG[i].end(),
compose_f_gx_hy(std::less(),
detail::subscript(topo_number),
- detail::subscript(topo_number)));
+ detail::subscript(topo_number)));
@}
Here is the code that defines the \code{subscript\_t} function object
@@ -366,7 +366,7 @@ and its associated helper object generation function.
@d Subscript function object
@{
namespace detail {
- template
struct subscript_t : public std::unary_function {
subscript_t(Container& c) : container(&c) { }
@@ -443,7 +443,7 @@ for (size_type i = 0; i < chains.size(); ++i)
cg_vertex v = chains[i][j];
chain_number[v] = i;
pos_in_chain[v] = j;
- }
+ }
@}
Now that we have completed the chain decomposition we are ready to
@@ -471,7 +471,7 @@ for (std::vector::reverse_iterator i = topo_order.rbegin();
cg_vertex v = *adj;
if (topo_number[v] < successors[u][chain_number[v]]) {
// Succ(u) = Succ(u) U Succ(v)
- detail::union_successor_sets(successors[u], successors[v],
+ detail::union_successor_sets(successors[u], successors[v],
successors[u]);
// Succ(u) = Succ(u) U {v}
successors[u][chain_number[v]] = topo_number[v];
@@ -490,7 +490,7 @@ vector.
@{
for (size_type i = 0; i < CG.size(); ++i)
CG[i].clear();
-for (size_type i = 0; i < CG.size(); ++i)
+for (size_type i = 0; i < CG.size(); ++i)
for (size_type j = 0; j < chains.size(); ++j) {
size_type topo_num = successors[i][j];
if (topo_num < inf) {
@@ -539,11 +539,11 @@ for (size_type i = 0; i < components.size(); ++i)
add_edge(g_to_tc_map[u], g_to_tc_map[v], tc);
}
-// Find loopbacks in the original graph.
+// Find loopbacks in the original graph.
// Need to add it to transitive closure.
{
vertex_iterator i, i_end;
- for (tie(i, i_end) = vertices(g); i != i_end; ++i)
+ for (tie(i, i_end) = vertices(g); i != i_end; ++i)
{
adjacency_iterator ab, ae;
for (boost::tie(ab, ae) = adjacent_vertices(*i, g); ab != ae; ++ab)
@@ -577,14 +577,14 @@ void warshall_transitive_closure(G& g)
// A[i,j] = A[i,j] | A[k,j]
vertex_iterator ki, ke, ii, ie, ji, je;
for (tie(ki, ke) = vertices(g); ki != ke; ++ki)
- for (tie(ii, ie) = vertices(g); ii != ie; ++ii)
+ for (tie(ii, ie) = vertices(g); ii != ie; ++ii)
if (edge(*ii, *ki, g).second)
for (tie(ji, je) = vertices(g); ji != je; ++ji)
if (!edge(*ii, *ji, g).second &&
edge(*ki, *ji, g).second)
{
add_edge(*ii, *ji, g);
- }
+ }
}
@}
@@ -600,12 +600,12 @@ void warren_transitive_closure(G& g)
BOOST_CONCEPT_ASSERT(( AdjacencyMatrixConcept ));
BOOST_CONCEPT_ASSERT(( EdgeMutableGraphConcept ));
- // Make sure second loop will work
+ // Make sure second loop will work
if (num_vertices(g) == 0)
return;
// for i = 2 to n
- // for k = 1 to i - 1
+ // for k = 1 to i - 1
// if A[i,k]
// for j = 1 to n
// A[i,j] = A[i,j] | A[k,j]
@@ -635,7 +635,7 @@ void warren_transitive_closure(G& g)
edge(*kc, *jc, g).second)
{
add_edge(*ic, *jc, g);
- }
+ }
}
@}
@@ -653,7 +653,7 @@ indent -nut -npcs -i2 -br -cdw -ce transitive_closure.hpp
// Copyright (C) 2001 Vladimir Prus
// Copyright (C) 2001 Jeremy Siek
// Permission to copy, use, modify, sell and distribute this software is
-// granted, provided this copyright notice appears in all copies and
+// granted, provided this copyright notice appears in all copies and
// modified version are clearly marked as such. This software is provided
// "as is" without express or implied warranty, and with no claim as to its
// suitability for any purpose.
diff --git a/doc/transpose_graph.html b/doc/transpose_graph.html
index a8fc62ae5..30cf44d4f 100644
--- a/doc/transpose_graph.html
+++ b/doc/transpose_graph.html
@@ -1,24 +1,24 @@
Boost Graph Library: Transpose Graph
-
-
+
+
transpose_graph
-template <class VertexListGraph, class MutableGraph>
+template <class VertexListGraph, class MutableGraph>
void transpose_graph(const VertexListGraph& G, MutableGraph& G_T,
const bgl_named_params<P, T, R>& params = all defaults)
@@ -124,4 +124,4 @@ Complexity
-
+
diff --git a/doc/trouble_shooting.html b/doc/trouble_shooting.html
index fe20679c4..b9108ff76 100644
--- a/doc/trouble_shooting.html
+++ b/doc/trouble_shooting.html
@@ -1,17 +1,17 @@
Boost Graph Library: Trouble Shooting
-
-
+
+
@@ -31,7 +31,7 @@ Trouble Shooting
-error C2784: 'T __cdecl source(struct std::pair,const G &)' :
+error C2784: 'T __cdecl source(struct std::pair,const G &)' :
could not deduce template argument for 'struct std::pair<_T1,_T1>' from
'class boost::detail::bidir_edge'
@@ -44,7 +44,7 @@ Trouble Shooting
../../..\boost/property_map.hpp(283) : error C2678: binary '[' : no operator defined
which takes a left-hand operand of type 'const struct boost::adj_list_edge_property_map,unsigned int,enum boost::edge_weight_t>' (or there is no acceptable conversion)
@@ -126,4 +126,4 @@ Trouble Shooting
-
+
diff --git a/doc/undirected_dfs.html b/doc/undirected_dfs.html
index fe81aced3..5bbda9ded 100644
--- a/doc/undirected_dfs.html
+++ b/doc/undirected_dfs.html
@@ -1,17 +1,17 @@
Boost Graph Library: Undirected Depth-First Search
-
-
+
+
@@ -90,36 +90,36 @@
DFS(G)
- for each vertex u in V
+ for each vertex u in V
vcolor[u] := WHITE
- p[u] := u
+ p[u] := u
end for
- for each edge e in E
+ for each edge e in E
ecolor[u] := WHITE
end for
time := 0
if there is a starting vertex s
call DFS-VISIT(G, s)
- for each vertex u in V
+ for each vertex u in V
if vcolor[u] = WHITE
call DFS-VISIT(G, u)
end for
return (p,d_time,f_time)
-DFS-VISIT(G, u)
+DFS-VISIT(G, u)
vcolor[u] := GRAY
- d_time[u] := time := time + 1
- for each e in Out[u]
+ d_time[u] := time := time + 1
+ for each e in Out[u]
var ec := ecolor[e]
ecolor[e] := BLACK
if (vcolor[v] = WHITE)
- p[v] := u
+ p[v] := u
call DFS-VISIT(G, v)
else if (vcolor[v] = GRAY and ec = WHITE)
...
...
end for
vcolor[u] := BLACK
- f_time[u] := time := time + 1
+ f_time[u] := time := time + 1
@@ -178,7 +178,7 @@ Parameters
Vertex List Graph,
and Edge List Graph.
- Python: The parameter is named graph.
+ Python: The parameter is named graph.
@@ -280,22 +280,22 @@ Visitor Event Points
- vis.start_vertex(s, g) is invoked on the source
vertex once before the start of the search.
-
+
- vis.discover_vertex(u, g) is invoked when a vertex
is encountered for the first time.
-
+
- vis.examine_edge(e, g) is invoked on every out-edge
of each vertex after it is discovered.
- vis.tree_edge(e, g) is invoked on each edge as it
becomes a member of the edges that form the search tree. If you
wish to record predecessors, do so at this event point.
-
+
- vis.back_edge(e, g) is invoked on the back edges in
- the graph.
+ the graph.
-
- vis.finish_edge(e, g) is invoked on the back edges in
- the graph as well as on each tree edge after its target vertex is finished.
+
- vis.finish_edge(e, g) is invoked on the back edges in
+ the graph as well as on each tree edge after its target vertex is finished.
- vis.finish_vertex(u, g) is invoked on a vertex after
all of its out edges have been added to the search tree and all of
@@ -317,7 +317,7 @@
See Also
Notes
-[1]
+
[1]
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
@@ -339,4 +339,4 @@
Notes
-
+
diff --git a/doc/users.html b/doc/users.html
index 5c154f286..7cbdda97d 100644
--- a/doc/users.html
+++ b/doc/users.html
@@ -1,16 +1,16 @@
Boost Graph Library Users
-
-
+
+
Boost Graph Library Users
diff --git a/doc/using_adjacency_list.html b/doc/using_adjacency_list.html
index 1d3de094a..457721441 100644
--- a/doc/using_adjacency_list.html
+++ b/doc/using_adjacency_list.html
@@ -1,17 +1,17 @@
Using the Boost Graph Library
-
-
+
+
@@ -134,11 +134,11 @@ Time Complexity
vertex()
This operation is constant time for vecS and for
-listS.
+listS.
-
+
@@ -163,7 +163,7 @@
want to represent a multi-graph, or know that you will not be
inserting parallel edges into the graph, then choose one of the Sequence
-types: vecS, listS, or slistS.
+types: vecS, listS, or slistS.
You will also want to take into account the differences in time and space
complexity for the various graph operations. Below we use V for
the total number of vertices in the graph and E for the total
@@ -194,7 +194,7 @@ Time Complexity
considered a constant.
-
+
-
@@ -312,7 +312,7 @@
Time Complexity
-
+
Directed and Undirected Adjacency Lists
@@ -344,16 +344,16 @@
adjacency_list class are meant to be filled by these interior
properties.
-
NOTE: The Boost Graph Library supports two interchangeable methods for
-specifying interior properties: bundled properties
-and property lists. The former is easier to use and requires less effort,
-whereas the latter is compatible with older, broken compilers and is
+
NOTE: The Boost Graph Library supports two interchangeable methods for
+specifying interior properties: bundled properties
+and property lists. The former is easier to use and requires less effort,
+whereas the latter is compatible with older, broken compilers and is
backward-compatible with Boost versions prior to 1.32.0. If you absolutely
-require these compatibility features, read on to learn about property lists.
+require these compatibility features, read on to learn about property lists.
Otherwise, we strongly suggest that you read about the bundled
properties mechanism.
-
One may specify internal properties via property lists, which are build from instances of the
+
One may specify internal properties via property lists, which are build from instances of the
property class declared as follows.
@@ -427,11 +427,11 @@
- typedef property<vertex_distance_t, float,
+ typedef property<vertex_distance_t, float,
property<vertex_name_t, std::string> > VertexProperty;
typedef property<edge_weight_t, float> EdgeProperty;
- typedef adjacency_list<mapS, vecS, undirectedS,
+ typedef adjacency_list<mapS, vecS, undirectedS,
VertexProperty, EdgeProperty> Graph;
Graph g(num_vertices); // construct a graph object
@@ -464,7 +464,7 @@
typedef edge_property_tag kind;
};
-struct capacity_t {
+struct capacity_t {
typedef edge_property_tag kind;
};
@@ -545,28 +545,28 @@
typedef property<first_name_t, std::string> FirstNameProperty;
- typedef adjacency_list<vecS, vecS, directedS,
+ typedef adjacency_list<vecS, vecS, directedS,
FirstNameProperty> MyGraphType;
typedef pair<int,int> Pair;
- Pair edge_array[11] = { Pair(0,1), Pair(0,2), Pair(0,3),
- Pair(0,4), Pair(2,0), Pair(3,0),
- Pair(2,4), Pair(3,1), Pair(3,4),
+ Pair edge_array[11] = { Pair(0,1), Pair(0,2), Pair(0,3),
+ Pair(0,4), Pair(2,0), Pair(3,0),
+ Pair(2,4), Pair(3,1), Pair(3,4),
Pair(4,0), Pair(4,1) };
-
+
MyGraphType G(5);
for (int i = 0; i < 11; ++i)
add_edge(edge_array[i].first, edge_array[i].second, G);
property_map<MyGraphType, first_name_t>::type
name = get(first_name_t(), G);
-
+
boost::put(name, 0, "Jeremy");
boost::put(name, 1, "Rich");
boost::put(name, 2, "Andrew");
boost::put(name, 3, "Jeff");
name[4] = "Kinis"; // you can use operator[] too
-
+
who_owes_who(edges(G).first, edges(G).second, G);
@@ -589,7 +589,7 @@
void who_owes_who(EdgeIter first, EdgeIter last, const Graph& G)
{
// Access the propety acessor type for this graph
- typedef typename property_map<Graph,
+ typedef typename property_map<Graph,
first_name_t>::const_type NameMap;
NameMap name = get(first_name, G);
@@ -601,7 +601,7 @@
while (first != last) {
src_name = boost::get(name, source(*first, G));
targ_name = boost::get(name, target(*first, G));
- cout << src_name << " owes "
+ cout << src_name << " owes "
<< targ_name << " some money" << endl;
++first;
}
@@ -712,8 +712,8 @@
};
}
- // now you can define a graph using std::list
- // and a specific allocator
+ // now you can define a graph using std::list
+ // and a specific allocator
typedef adjacency_list< list_with_allocatorS< std::allocator<int> >, vecS, directedS> MyGraph;
@@ -769,7 +769,7 @@
template <>
- struct parallel_edge_traits<custom_containerS> {
+ struct parallel_edge_traits<custom_containerS> {
typedef allow_parallel_edge_tag type;
};
@@ -784,4 +784,4 @@
-
+
diff --git a/doc/using_property_maps.html b/doc/using_property_maps.html
index 661e66e05..80da3e621 100644
--- a/doc/using_property_maps.html
+++ b/doc/using_property_maps.html
@@ -1,17 +1,17 @@
Boost Graph Library: Using Property Maps
-
-
+
+
@@ -59,10 +59,10 @@ Property Map Interface
template <class Edge, class Graph,
- class WeightPropertyMap,
+ class WeightPropertyMap,
class DistancePropertyMap>
- bool relax(Edge e, const Graph& g,
- WeightPropertyMap weight,
+ bool relax(Edge e, const Graph& g,
+ WeightPropertyMap weight,
DistancePropertyMap distance)
{
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
@@ -107,14 +107,14 @@ Property Map Interface
-There are two kinds of graph properties: interior and exterior.
+There are two kinds of graph properties: interior and exterior.
- Interior Properties
- are stored ``inside'' the graph object
in some way, and the lifetime of the property value objects is the
-same as that of the graph object.
+same as that of the graph object.
@@ -174,7 +174,7 @@
- dijkstra_shortest_paths(g, src,
+ dijkstra_shortest_paths(g, src,
distance_map(get(vertex_distance, g)).
weight_map(get(edge_weight, g)).
color_map(get(vertex_color, g)).
@@ -240,7 +240,7 @@
- typedef adjacency_list<vecS, vecS, bidirectionalS,
+ typedef adjacency_list<vecS, vecS, bidirectionalS,
no_property, property<edge_index_t, std::size_t> > Graph;
const int num_vertices = 9;
@@ -258,8 +258,8 @@
EdgeID_Map edge_id = get(edge_index, G);
iterator_property_map
- <int*, int, int&, EdgeID_Map>
- capacity(capacity_array, edge_id),
+ <int*, int, int&, EdgeID_Map>
+ capacity(capacity_array, edge_id),
flow(flow_array, edge_id);
print_network(G, capacity, flow);
@@ -337,7 +337,7 @@
// An array of vertex name properties
std::string names[] = { "San Jose", "San Francisco", "San Jose",
- "San Francisco", "Los Angeles", "San Diego",
+ "San Francisco", "Los Angeles", "San Diego",
"Fresno", "Los Vegas", "Reno", "Sacramento",
"Salt Lake City", "Pheonix" };
@@ -359,7 +359,7 @@
cout << endl;
// Get the source vertex
- boost::graph_traits<Graph>::vertex_descriptor
+ boost::graph_traits<Graph>::vertex_descriptor
s = vertex(SanJose, G);
cout << "*** Breadth First ***" << endl;
@@ -414,12 +414,12 @@
class iterator_map
{
public:
- typedef typename boost::property_traits<IDMap>::key_type key_type;
+ typedef typename boost::property_traits<IDMap>::key_type key_type;
typedef typename std::iterator_traits<Iterator>::value_type value_type;
typedef boost::lvalue_property_map_tag category;
- iterator_map(Iterator i = Iterator(),
- const IDMap& id = IDMap())
+ iterator_map(Iterator i = Iterator(),
+ const IDMap& id = IDMap())
: m_iter(i), m_id(id) { }
Iterator m_iter;
IDMap m_id;
@@ -477,4 +477,4 @@
-
+
diff --git a/doc/vf2_sub_graph_iso.html b/doc/vf2_sub_graph_iso.html
index 41b32e168..66fc766ce 100644
--- a/doc/vf2_sub_graph_iso.html
+++ b/doc/vf2_sub_graph_iso.html
@@ -1,8 +1,8 @@
Boost Graph Library: Visitor Concepts
-
-
+
+
@@ -60,4 +60,4 @@
-
+
diff --git a/doc/wavefront.htm b/doc/wavefront.htm
index bfc0928ee..f6a3b651f 100644
--- a/doc/wavefront.htm
+++ b/doc/wavefront.htm
@@ -10,7 +10,7 @@
-->
-
ith_wavefront
(1)
@@ -23,8 +23,8 @@ ith_wavefront
Defined in
-boost/graph/wavefront.hpp
+boost/graph/wavefront.hpp
max_wavefront
@@ -36,8 +36,8 @@ max_wavefront
Calculates the maximum wavefront a graph.
Defined in
-
aver_wavefront
@@ -46,12 +46,12 @@ aver_wavefront
(2)
template <typename Graph, typename VertexIndexMap>
typename graph_traits<Graph>::vertices_size_type
aver_wavefront(const Graph& g, VertexIndexMap index)
-Calculates the average wavefront of a graph (sum of all wavefronts devided by
+Calculates the average wavefront of a graph (sum of all wavefronts devided by
the number ob vertices).
Defined in
-boost/graph/wavefront.hpp
+boost/graph/wavefront.hpp
@@ -64,15 +64,15 @@ rms_wavefront
Calculates the root mean square of all wavefronts.
Defined in
-boost/graph/wavefront.hpp
+boost/graph/wavefront.hpp
Copyright © 2001-2002
- Marc Wintermantel, ETH Zurich(wintermantel@imes.mavt.ethz.ch)
+ Marc Wintermantel, ETH Zurich(wintermantel@imes.mavt.ethz.ch)
diff --git a/doc/write_dimacs.html b/doc/write_dimacs.html
index 9a6e80660..f10af48ac 100644
--- a/doc/write_dimacs.html
+++ b/doc/write_dimacs.html
@@ -35,10 +35,10 @@
Boost Graph Library: write_dimacs_max_flow
-
-
+
+
@@ -50,7 +50,7 @@
//outputs a graph with including edge_capacity properties to an std::ostream
template < typename Graph, typename CapacityMap, typename IndexMap >
void write_dimacs_max_flow(Graph& g,
- CapacityMap capacity,
+ CapacityMap capacity,
IndexMap idx,
typename graph_traits::vertex_descriptor& src,
typename graph_traits::vertex_descriptor& sink,
@@ -60,7 +60,7 @@
This method writes a BGL graph object as an max-flow problem into an output stream in extended dimacs format (see Goldbergs site for more information).
-The output can be read in again using the boost/graph/read_dimacs.hpp method.
+The output can be read in again using the boost/graph/read_dimacs.hpp method.
Where Defined
@@ -72,25 +72,25 @@ Parameters
A directed or undirected graph. The graph's type must be a model of
VertexListGraph and EdgeListGraph, as num_vertices(Graph) and num_edges(Graph) is used inside. [1]
-
+
IN: CapacityMap capacity
A property map that models Readable Property Map whose key type is the edge descriptor of the graph and whose value type can be written to a stream.
-
+
IN: IndexMap epw
A property map that models Readable Property Map whose key type is the vertex descriptor of the graph and whose value type can be written to a stream.
-
+
OUT: std::ostream& out
A standard std::ostream object.
-
+
-Example
+Example
A short example which uses read_dimacs and write_dimacs is located in the examples directory.
@@ -101,4 +101,4 @@ See Also
Notes
[1] As num_edges() and num_vertices() is used inside which returns values for the unfiltered graph (instead of the filtered), this method cannot be used with a filtered_graphSee filtered_graph Note [2] for the reason.
-
+
diff --git a/doc/write_graphml.rst b/doc/write_graphml.rst
index 00e68b7d7..ec229ae03 100644
--- a/doc/write_graphml.rst
+++ b/doc/write_graphml.rst
@@ -3,11 +3,11 @@
============================
.. Copyright (C) 2006 Tiago de Paula Peixoto
-
+
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)
-
+
Authors: Tiago de Paula Peixoto
.. |(logo)| image:: ../../../boost.png
@@ -20,7 +20,7 @@ __ ../../../index.htm
template
void
- write_graphml(std::ostream& out, const Graph& g, const dynamic_properties& dp,
+ write_graphml(std::ostream& out, const Graph& g, const dynamic_properties& dp,
bool ordered_vertices=false);
template
@@ -48,7 +48,7 @@ Parameters
OUT: ``std::ostream& out``
A standard ``std::ostream`` object.
-IN: ``VertexListGraph& g``
+IN: ``VertexListGraph& g``
A directed or undirected graph. The
graph's type must be a model of VertexListGraph_. If the graph
doesn't have an internal ``vertex_index`` property map, one
@@ -74,7 +74,7 @@ IN: ``bool ordered_vertices``
Example
-------
-This example demonstrates using BGL-GraphML interface to write
+This example demonstrates using BGL-GraphML interface to write
a BGL graph into a GraphML format file.
::
diff --git a/example/Jamfile.v2 b/example/Jamfile.v2
index f1bc9d994..42d3bbd5c 100644
--- a/example/Jamfile.v2
+++ b/example/Jamfile.v2
@@ -6,171 +6,182 @@
import ../../config/checks/config : requires ;
import modules ;
import path ;
+import pch ;
path-constant TEST_DIR : . ;
-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 ;
-run adjacency_list.cpp ;
-run adjacency_list_io.cpp ;
-run adjacency_matrix.cpp ;
-run astar-cities.cpp ;
-run astar_maze.cpp ;
-run bellman-example.cpp ;
-run bellman-ford-internet.cpp ;
-run bfs.cpp ;
-run bfs_neighbor.cpp ;
-run bfs-example.cpp ;
-run bfs-example2.cpp ;
-run bfs-name-printer.cpp ;
-run biconnected_components.cpp ;
-run bipartite_example.cpp ;
-run boost_web_graph.cpp : $(TEST_DIR)/boost_web.dat ;
-exe boykov_kolmogorov-eg : boykov_kolmogorov-eg.cpp ;
-exe bron_kerbosch_clique_number : bron_kerbosch_clique_number.cpp ;
-exe bron_kerbosch_print_cliques : bron_kerbosch_print_cliques.cpp ;
-run bucket_sorter.cpp ;
-run canonical_ordering.cpp ;
-run city_visitor.cpp ;
-exe closeness_centrality : closeness_centrality.cpp ;
-exe clustering_coefficient : clustering_coefficient.cpp ;
-run components_on_edgelist.cpp ;
-run connected_components.cpp ;
-run connected-components.cpp ;
-run container_gen.cpp ;
-run copy-example.cpp ;
-run csr-example.cpp ;
-run cuthill_mckee_ordering.cpp ;
-run cycle_canceling_example.cpp ;
-run cycle_ratio_example.cpp ;
-run cycle-file-dep.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
-run cycle-file-dep2.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
-run dag_shortest_paths.cpp ;
-run dave.cpp ;
-run default-constructor.cpp : $(TEST_DIR)/makefile-dependencies.dat ;
-run default-constructor2.cpp : $(TEST_DIR)/makefile-dependencies.dat ;
-exe degree_centrality : degree_centrality.cpp ;
-run dfs.cpp ;
-run dfs_parenthesis.cpp ;
-run dfs-example.cpp ;
-run dijkstra-example.cpp ;
-run dijkstra-example-listS.cpp ;
-run dijkstra-no-color-map-example.cpp ;
-run directed_graph.cpp ;
-exe eccentricity : eccentricity.cpp ;
-run edge_basics.cpp ;
-run edge_coloring.cpp ;
-run edge_iterator_constructor.cpp : $(TEST_DIR)/edge_iterator_constructor.dat ;
-run edge_property.cpp ;
-run edge-function.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
-run edge-iter-constructor.cpp : $(TEST_DIR)/makefile-dependencies.dat ;
-exe edmonds-karp-eg : edmonds-karp-eg.cpp ;
-run exterior_properties.cpp ;
-run exterior_property_map.cpp ;
-run family_tree.cpp ;
-run fibonacci_heap.cpp ;
-run file_dependencies.cpp ;
-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 ;
-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 grid_graph_example.cpp ;
-run grid_graph_properties.cpp ;
-exe hawick_circuits : hawick_circuits.cpp ;
-run implicit_graph.cpp ;
-run in_edges.cpp ;
-exe inclusive_mean_geodesic : inclusive_mean_geodesic.cpp ;
-run incremental_components.cpp ;
-run incremental-components-eg.cpp ;
-exe influence_prestige : influence_prestige.cpp ;
-run interior_pmap_bundled.cpp ;
-run interior_property_map.cpp ;
-run isomorphism.cpp ;
-run iteration_macros.cpp ;
-run iterator-property-map-eg.cpp ;
-run johnson-eg.cpp ;
-run kevin-bacon.cpp : $(TEST_DIR)/kevin-bacon.dat ;
-run king_ordering.cpp ;
-run knights_tour.cpp ;
-run kruskal-example.cpp ;
-run kuratowski_subgraph.cpp ;
-run make_biconnected_planar.cpp ;
-run make_connected.cpp ;
-run make_maximal_planar.cpp ;
-run matching_example.cpp ;
-exe max_flow : max_flow.cpp ;
-run mcgregor_subgraphs_example.cpp ;
-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 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 ;
-run print-adjacent-vertices.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
-run print-edges.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
-run print-in-edges.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
-run print-out-edges.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
-exe property_iterator : property_iterator.cpp ;
-run property-map-traits-eg.cpp ;
-exe push-relable : push-relabel-eg.cpp ;
-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 ;
-exe read_write_dimacs : read_write_dimacs-eg.cpp ;
-run remove_edge_if_bidir.cpp ;
-run remove_edge_if_dir.cpp ;
-run remove_edge_if_undir.cpp ;
-run reverse_graph.cpp ;
-exe scaled_closeness_centrality : scaled_closeness_centrality.cpp ;
-run simple_planarity_test.cpp ;
-run sloan_ordering.cpp ;
-run stoer_wagner.cpp ;
-run straight_line_drawing.cpp ;
-run strong-components.cpp ;
-run subgraph.cpp ;
-run subgraph_properties.cpp ;
-run successive_shortest_path_nonnegative_weights_example.cpp ;
-exe tiernan_girth_circumference : tiernan_girth_circumference.cpp ;
-exe tiernan_print_cycles : tiernan_print_cycles.cpp ;
-run topo_sort.cpp ;
-run topo-sort1.cpp ;
-run topo-sort2.cpp ;
-run topo-sort-file-dep.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
-run topo-sort-file-dep2.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
-run transitive_closure.cpp ;
-run transpose-example.cpp ;
-run two_graphs_common_spanning_trees.cpp ;
-run undirected_adjacency_list.cpp ;
-run undirected_dfs.cpp ;
-run undirected_graph.cpp ;
-run vector_as_graph.cpp ;
-run vertex_basics.cpp ;
-run vertex-name-property.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
-run vf2_sub_graph_iso_example.cpp ;
-run vf2_sub_graph_iso_multi_example.cpp ;
-run visitor.cpp ;
-run write_graphviz.cpp ;
+
+local pchs ;
+
+for local hpp in [ glob-tree *.hpp ] {
+ cpp-pch $(hpp:B) : $(hpp) : include ;
+ explicit $(hpp:B) ;
+ pchs += $(hpp:B) ;
+}
+alias headers : $(pchs) ;
+
+run $(headers) accum-compile-times.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat $(TEST_DIR)/target-compile-costs.dat ;
+exe $(headers) actor_clustering : actor_clustering.cpp ;
+run $(headers) adj_list_ra_edgelist.cpp ;
+run $(headers) adjacency_list.cpp ;
+run $(headers) adjacency_list_io.cpp ;
+run $(headers) adjacency_matrix.cpp ;
+run $(headers) astar-cities.cpp ;
+run $(headers) astar_maze.cpp ;
+run $(headers) bellman-example.cpp ;
+run $(headers) bellman-ford-internet.cpp ;
+run $(headers) bfs.cpp ;
+run $(headers) bfs_neighbor.cpp ;
+run $(headers) bfs-example.cpp ;
+run $(headers) bfs-example2.cpp ;
+run $(headers) bfs-name-printer.cpp ;
+run $(headers) biconnected_components.cpp ;
+run $(headers) bipartite_example.cpp ;
+run $(headers) boost_web_graph.cpp : $(TEST_DIR)/boost_web.dat ;
+exe $(headers) boykov_kolmogorov-eg : boykov_kolmogorov-eg.cpp ;
+exe $(headers) bron_kerbosch_clique_number : bron_kerbosch_clique_number.cpp ;
+exe $(headers) bron_kerbosch_print_cliques : bron_kerbosch_print_cliques.cpp ;
+run $(headers) bucket_sorter.cpp ;
+run $(headers) canonical_ordering.cpp ;
+run $(headers) city_visitor.cpp ;
+exe $(headers) closeness_centrality : closeness_centrality.cpp ;
+exe $(headers) clustering_coefficient : clustering_coefficient.cpp ;
+run $(headers) components_on_edgelist.cpp ;
+run $(headers) connected_components.cpp ;
+run $(headers) connected-components.cpp ;
+run $(headers) container_gen.cpp ;
+run $(headers) copy-example.cpp ;
+run $(headers) csr-example.cpp ;
+run $(headers) cuthill_mckee_ordering.cpp ;
+run $(headers) cycle_canceling_example.cpp ;
+run $(headers) cycle_ratio_example.cpp ;
+run $(headers) cycle-file-dep.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
+run $(headers) cycle-file-dep2.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
+run $(headers) dag_shortest_paths.cpp ;
+run $(headers) dave.cpp ;
+run $(headers) default-constructor.cpp : $(TEST_DIR)/makefile-dependencies.dat ;
+run $(headers) default-constructor2.cpp : $(TEST_DIR)/makefile-dependencies.dat ;
+exe $(headers) degree_centrality : degree_centrality.cpp ;
+run $(headers) dfs.cpp ;
+run $(headers) dfs_parenthesis.cpp ;
+run $(headers) dfs-example.cpp ;
+run $(headers) dijkstra-example.cpp ;
+run $(headers) dijkstra-example-listS.cpp ;
+run $(headers) dijkstra-no-color-map-example.cpp ;
+run $(headers) directed_graph.cpp ;
+exe $(headers) eccentricity : eccentricity.cpp ;
+run $(headers) edge_basics.cpp ;
+run $(headers) edge_coloring.cpp ;
+run $(headers) edge_iterator_constructor.cpp : $(TEST_DIR)/edge_iterator_constructor.dat ;
+run $(headers) edge_property.cpp ;
+run $(headers) edge-function.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
+run $(headers) edge-iter-constructor.cpp : $(TEST_DIR)/makefile-dependencies.dat ;
+exe $(headers) edmonds-karp-eg : edmonds-karp-eg.cpp ;
+run $(headers) exterior_properties.cpp ;
+run $(headers) exterior_property_map.cpp ;
+run $(headers) family_tree.cpp ;
+run $(headers) fibonacci_heap.cpp ;
+run $(headers) file_dependencies.cpp ;
+run $(headers) filtered_graph.cpp ;
+run $(headers) filtered_graph_edge_range.cpp ;
+run $(headers) filtered_vec_as_graph.cpp ;
+run $(headers) filtered-copy-example.cpp ;
+exe $(headers) fr_layout : fr_layout.cpp ;
+run $(headers) gerdemann.cpp ;
+run $(headers) graph.cpp ;
+run $(headers) graph_as_tree.cpp ;
+run $(headers) graph_property.cpp ;
+run $(headers) graph-assoc-types.cpp ;
+run $(headers) graph-property-iter-eg.cpp ;
+run $(headers) graph-thingie.cpp ../build//boost_graph ;
+run $(headers) graphviz.cpp ../build//boost_graph : $(TEST_DIR)/graphviz_example.dot ;
+run $(headers) grid_graph_example.cpp ;
+run $(headers) grid_graph_properties.cpp ;
+exe $(headers) hawick_circuits : hawick_circuits.cpp ;
+run $(headers) implicit_graph.cpp ;
+run $(headers) in_edges.cpp ;
+exe $(headers) inclusive_mean_geodesic : inclusive_mean_geodesic.cpp ;
+run $(headers) incremental_components.cpp ;
+run $(headers) incremental-components-eg.cpp ;
+exe $(headers) influence_prestige : influence_prestige.cpp ;
+run $(headers) interior_pmap_bundled.cpp ;
+run $(headers) interior_property_map.cpp ;
+run $(headers) isomorphism.cpp ;
+run $(headers) iteration_macros.cpp ;
+run $(headers) iterator-property-map-eg.cpp ;
+run $(headers) johnson-eg.cpp ;
+run $(headers) kevin-bacon.cpp : $(TEST_DIR)/kevin-bacon.dat ;
+run $(headers) king_ordering.cpp ;
+run $(headers) knights_tour.cpp ;
+run $(headers) kruskal-example.cpp ;
+run $(headers) kuratowski_subgraph.cpp ;
+run $(headers) make_biconnected_planar.cpp ;
+run $(headers) make_connected.cpp ;
+run $(headers) make_maximal_planar.cpp ;
+run $(headers) matching_example.cpp ;
+exe $(headers) max_flow : max_flow.cpp ;
+run $(headers) mcgregor_subgraphs_example.cpp ;
+exe $(headers) mean_geodesic : mean_geodesic.cpp ;
+exe $(headers) minimum_degree_ordering : minimum_degree_ordering.cpp ;
+run $(headers) modify_graph.cpp ;
+run $(headers) neighbor_bfs.cpp ;
+run $(headers) ospf-example.cpp ../build//boost_graph : $(TEST_DIR)/figs/ospf-graph.dot $(TEST_DIR)/figs/ospf-sptree.dot $(TEST_DIR)/routing-table.dat ;
+run $(headers) parallel-compile-time.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat $(TEST_DIR)/target-compile-costs.dat ;
+run $(headers) planar_face_traversal.cpp ;
+run $(headers) prim-example.cpp ;
+run $(headers) print-adjacent-vertices.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
+run $(headers) print-edges.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
+run $(headers) print-in-edges.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
+run $(headers) print-out-edges.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
+exe $(headers) property_iterator : property_iterator.cpp ;
+run $(headers) property-map-traits-eg.cpp ;
+exe $(headers) push-relable : push-relabel-eg.cpp ;
+run $(headers) put-get-helper-eg.cpp ;
+run $(headers) quick_tour.cpp ;
+run $(headers) quick-tour.cpp ;
+run $(headers) r_c_shortest_paths_example.cpp ;
+run $(headers) read_graphviz.cpp ../build//boost_graph ;
+exe $(headers) read_write_dimacs : read_write_dimacs-eg.cpp ;
+run $(headers) remove_edge_if_bidir.cpp ;
+run $(headers) remove_edge_if_dir.cpp ;
+run $(headers) remove_edge_if_undir.cpp ;
+run $(headers) reverse_graph.cpp ;
+exe $(headers) scaled_closeness_centrality : scaled_closeness_centrality.cpp ;
+run $(headers) simple_planarity_test.cpp ;
+run $(headers) sloan_ordering.cpp ;
+run $(headers) stoer_wagner.cpp ;
+run $(headers) straight_line_drawing.cpp ;
+run $(headers) strong-components.cpp ;
+run $(headers) subgraph.cpp ;
+run $(headers) subgraph_properties.cpp ;
+run $(headers) successive_shortest_path_nonnegative_weights_example.cpp ;
+exe $(headers) tiernan_girth_circumference : tiernan_girth_circumference.cpp ;
+exe $(headers) tiernan_print_cycles : tiernan_print_cycles.cpp ;
+run $(headers) topo_sort.cpp ;
+run $(headers) topo-sort1.cpp ;
+run $(headers) topo-sort2.cpp ;
+run $(headers) topo-sort-file-dep.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
+run $(headers) topo-sort-file-dep2.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
+run $(headers) transitive_closure.cpp ;
+run $(headers) transpose-example.cpp ;
+run $(headers) two_graphs_common_spanning_trees.cpp ;
+run $(headers) undirected_adjacency_list.cpp ;
+run $(headers) undirected_dfs.cpp ;
+run $(headers) undirected_graph.cpp ;
+run $(headers) vector_as_graph.cpp ;
+run $(headers) vertex_basics.cpp ;
+run $(headers) vertex-name-property.cpp : $(TEST_DIR)/makefile-dependencies.dat $(TEST_DIR)/makefile-target-names.dat ;
+run $(headers) vf2_sub_graph_iso_example.cpp ;
+run $(headers) vf2_sub_graph_iso_multi_example.cpp ;
+run $(headers) visitor.cpp ;
+run $(headers) write_graphviz.cpp ;
#
# These require LEDA:
#
-run leda-graph-eg.cpp ;
-run leda-concept-check.cpp ;
-run topo-sort-with-leda.cpp ;
+run $(headers) leda-graph-eg.cpp ;
+run $(headers) leda-concept-check.cpp ;
+run $(headers) topo-sort-with-leda.cpp ;
explicit leda-graph-eg ;
explicit leda-concept-check ;
explicit topo-sort-with-leda ;
@@ -178,13 +189,13 @@ explicit topo-sort-with-leda ;
#
# These require standford-graph:
#
-run miles_span.cpp ;
+run $(headers) miles_span.cpp ;
explicit miles_span ;
-run roget_components.cpp ;
+run $(headers) roget_components.cpp ;
explicit roget_components ;
-run topo-sort-with-sgb.cpp ;
+run $(headers) topo-sort-with-sgb.cpp ;
explicit topo-sort-with-sgb ;
-run girth.cpp ;
+run $(headers) girth.cpp ;
explicit girth ;
#
diff --git a/example/accum-compile-times.cpp b/example/accum-compile-times.cpp
index d4db2cf4f..cc0d48fd8 100644
--- a/example/accum-compile-times.cpp
+++ b/example/accum-compile-times.cpp
@@ -1,5 +1,5 @@
//=======================================================================
-// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -16,80 +16,85 @@
namespace std
{
- template < typename T >
- std::istream& operator >> (std::istream& in, std::pair < T, T > &p)
- {
+template < typename T >
+std::istream& operator>>(std::istream& in, std::pair< T, T >& p)
+{
in >> p.first >> p.second;
return in;
- }
+}
}
namespace boost
{
- enum vertex_compile_cost_t { vertex_compile_cost };
- BOOST_INSTALL_PROPERTY(vertex, compile_cost);
+enum vertex_compile_cost_t
+{
+ vertex_compile_cost
+};
+BOOST_INSTALL_PROPERTY(vertex, compile_cost);
}
using namespace boost;
typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list
- listS, // Store vertex set in a std::list
- directedS, // The file dependency graph is directed
- // vertex properties
- property < vertex_name_t, std::string,
- property < vertex_compile_cost_t, float,
- property < vertex_distance_t, float,
- property < vertex_color_t, default_color_type > > > >,
- // an edge property
- property < edge_weight_t, float > >
- file_dep_graph2;
+ listS, // Store vertex set in a std::list
+ directedS, // The file dependency graph is directed
+ // vertex properties
+ property< vertex_name_t, std::string,
+ property< vertex_compile_cost_t, float,
+ property< vertex_distance_t, float,
+ property< vertex_color_t, default_color_type > > > >,
+ // an edge property
+ property< edge_weight_t, float > >
+ file_dep_graph2;
-typedef graph_traits::vertex_descriptor vertex_t;
-typedef graph_traits::edge_descriptor edge_t;
+typedef graph_traits< file_dep_graph2 >::vertex_descriptor vertex_t;
+typedef graph_traits< file_dep_graph2 >::edge_descriptor edge_t;
-int
-main(int argc, const char** argv)
+int main(int argc, const char** argv)
{
- std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat");
- typedef graph_traits::vertices_size_type size_type;
- size_type n_vertices;
- file_in >> n_vertices; // read in number of vertices
+ std::ifstream file_in(argc >= 2 ? argv[1] : "makefile-dependencies.dat");
+ typedef graph_traits< file_dep_graph2 >::vertices_size_type size_type;
+ size_type n_vertices;
+ file_in >> n_vertices; // read in number of vertices
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- // std::istream_iterator causes trouble with VC++
- std::vector id2vertex;
- file_dep_graph2 g;
- for (std::size_t i = 0; i < n_vertices; ++i)
- id2vertex.push_back(add_vertex(g));
- std::pair p;
- while (file_in >> p)
- add_edge(id2vertex[p.first], id2vertex[p.second], g);
+ // std::istream_iterator causes trouble with VC++
+ std::vector< vertex_t > id2vertex;
+ file_dep_graph2 g;
+ for (std::size_t i = 0; i < n_vertices; ++i)
+ id2vertex.push_back(add_vertex(g));
+ std::pair< size_type, size_type > p;
+ while (file_in >> p)
+ add_edge(id2vertex[p.first], id2vertex[p.second], g);
#else
- std::istream_iterator >
- input_begin(file_in), input_end;
- file_dep_graph2 g(input_begin, input_end, n_vertices);
+ std::istream_iterator< std::pair< size_type, size_type > > input_begin(
+ file_in),
+ input_end;
+ file_dep_graph2 g(input_begin, input_end, n_vertices);
#endif
- typedef property_map < file_dep_graph2, vertex_name_t >::type name_map_t;
- typedef property_map < file_dep_graph2, vertex_compile_cost_t >::type
- compile_cost_map_t;
+ typedef property_map< file_dep_graph2, vertex_name_t >::type name_map_t;
+ typedef property_map< file_dep_graph2, vertex_compile_cost_t >::type
+ compile_cost_map_t;
- name_map_t name_map = get(vertex_name, g);
- compile_cost_map_t compile_cost_map = get(vertex_compile_cost, g);
+ name_map_t name_map = get(vertex_name, g);
+ compile_cost_map_t compile_cost_map = get(vertex_compile_cost, g);
- std::ifstream name_in(argc >= 3 ? argv[2] : "makefile-target-names.dat");
- std::ifstream compile_cost_in(argc >= 4 ? argv[3] : "target-compile-costs.dat");
- graph_traits < file_dep_graph2 >::vertex_iterator vi, vi_end;
- for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) {
- name_in >> name_map[*vi];
- compile_cost_in >> compile_cost_map[*vi];
- }
+ std::ifstream name_in(argc >= 3 ? argv[2] : "makefile-target-names.dat");
+ std::ifstream compile_cost_in(
+ argc >= 4 ? argv[3] : "target-compile-costs.dat");
+ graph_traits< file_dep_graph2 >::vertex_iterator vi, vi_end;
+ for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
+ {
+ name_in >> name_map[*vi];
+ compile_cost_in >> compile_cost_map[*vi];
+ }
- graph_property_iter_range < file_dep_graph2,
- vertex_compile_cost_t >::iterator ci, ci_end;
- boost::tie(ci, ci_end) = get_property_iter_range(g, vertex_compile_cost);
- std::cout << "total (sequential) compile time: "
- << std::accumulate(ci, ci_end, 0.0) << std::endl;
+ graph_property_iter_range< file_dep_graph2,
+ vertex_compile_cost_t >::iterator ci,
+ ci_end;
+ boost::tie(ci, ci_end) = get_property_iter_range(g, vertex_compile_cost);
+ std::cout << "total (sequential) compile time: "
+ << std::accumulate(ci, ci_end, 0.0) << std::endl;
- return 0;
+ return 0;
}
-
diff --git a/example/actor_clustering.cpp b/example/actor_clustering.cpp
index 9b1b40221..5564a9e9c 100644
--- a/example/actor_clustering.cpp
+++ b/example/actor_clustering.cpp
@@ -29,159 +29,191 @@ using namespace boost;
struct Actor
{
- Actor(int id = -1) : id(id) {}
+ Actor(int id = -1) : id(id) {}
- int id;
+ int id;
};
-typedef adjacency_list > ActorGraph;
-typedef graph_traits::vertex_descriptor Vertex;
-typedef graph_traits::edge_descriptor Edge;
+typedef adjacency_list< vecS, vecS, undirectedS, Actor,
+ property< edge_centrality_t, double > >
+ ActorGraph;
+typedef graph_traits< ActorGraph >::vertex_descriptor Vertex;
+typedef graph_traits< ActorGraph >::edge_descriptor Edge;
void load_actor_graph(std::istream& in, ActorGraph& g)
{
- std::map actors;
-
- std::string line;
- while (getline(in, line)) {
- std::vector actors_in_movie;
-
- // Map from the actor numbers on this line to the actor vertices
- typedef tokenizer > Tok;
- Tok tok(line, char_separator(" "));
- for (Tok::iterator id = tok.begin(); id != tok.end(); ++id) {
- int actor_id = lexical_cast(*id);
- std::map::iterator v = actors.find(actor_id);
- if (v == actors.end()) {
- Vertex new_vertex = add_vertex(Actor(actor_id), g);
- actors[actor_id] = new_vertex;
- actors_in_movie.push_back(new_vertex);
- } else {
- actors_in_movie.push_back(v->second);
- }
+ std::map< int, Vertex > actors;
+
+ std::string line;
+ while (getline(in, line))
+ {
+ std::vector< Vertex > actors_in_movie;
+
+ // Map from the actor numbers on this line to the actor vertices
+ typedef tokenizer< char_separator< char > > Tok;
+ Tok tok(line, char_separator< char >(" "));
+ for (Tok::iterator id = tok.begin(); id != tok.end(); ++id)
+ {
+ int actor_id = lexical_cast< int >(*id);
+ std::map< int, Vertex >::iterator v = actors.find(actor_id);
+ if (v == actors.end())
+ {
+ Vertex new_vertex = add_vertex(Actor(actor_id), g);
+ actors[actor_id] = new_vertex;
+ actors_in_movie.push_back(new_vertex);
+ }
+ else
+ {
+ actors_in_movie.push_back(v->second);
+ }
+ }
+
+ for (std::vector< Vertex >::iterator i = actors_in_movie.begin();
+ i != actors_in_movie.end(); ++i)
+ {
+ for (std::vector< Vertex >::iterator j = i + 1;
+ j != actors_in_movie.end(); ++j)
+ {
+ if (!edge(*i, *j, g).second)
+ add_edge(*i, *j, g);
+ }
+ }
}
-
- for (std::vector::iterator i = actors_in_movie.begin();
- i != actors_in_movie.end(); ++i) {
- for (std::vector::iterator j = i + 1;
- j != actors_in_movie.end(); ++j) {
- if (!edge(*i, *j, g).second) add_edge(*i, *j, g);
- }
- }
- }
}
-template
-std::ostream&
-write_pajek_graph(std::ostream& out, const Graph& g,
- VertexIndexMap vertex_index, VertexNameMap vertex_name)
+template < typename Graph, typename VertexIndexMap, typename VertexNameMap >
+std::ostream& write_pajek_graph(std::ostream& out, const Graph& g,
+ VertexIndexMap vertex_index, VertexNameMap vertex_name)
{
- out << "*Vertices " << num_vertices(g) << '\n';
- typedef typename graph_traits::vertex_iterator vertex_iterator;
- for (vertex_iterator v = vertices(g).first; v != vertices(g).second; ++v) {
- out << get(vertex_index, *v)+1 << " \"" << get(vertex_name, *v) << "\"\n";
- }
-
- out << "*Edges\n";
- typedef typename graph_traits::edge_iterator edge_iterator;
- for (edge_iterator e = edges(g).first; e != edges(g).second; ++e) {
- out << get(vertex_index, source(*e, g))+1 << ' '
- << get(vertex_index, target(*e, g))+1 << " 1.0\n"; // HACK!
- }
- return out;
+ out << "*Vertices " << num_vertices(g) << '\n';
+ typedef typename graph_traits< Graph >::vertex_iterator vertex_iterator;
+ for (vertex_iterator v = vertices(g).first; v != vertices(g).second; ++v)
+ {
+ out << get(vertex_index, *v) + 1 << " \"" << get(vertex_name, *v)
+ << "\"\n";
+ }
+
+ out << "*Edges\n";
+ typedef typename graph_traits< Graph >::edge_iterator edge_iterator;
+ for (edge_iterator e = edges(g).first; e != edges(g).second; ++e)
+ {
+ out << get(vertex_index, source(*e, g)) + 1 << ' '
+ << get(vertex_index, target(*e, g)) + 1 << " 1.0\n"; // HACK!
+ }
+ return out;
}
-class actor_clustering_threshold : public bc_clustering_threshold
+class actor_clustering_threshold : public bc_clustering_threshold< double >
{
- typedef bc_clustering_threshold inherited;
-
- public:
- actor_clustering_threshold(double threshold, const ActorGraph& g,
- bool normalize)
- : inherited(threshold, g, normalize), iter(1) { }
-
- bool operator()(double max_centrality, Edge e, const ActorGraph& g)
- {
- std::cout << "Iter: " << iter << " Max Centrality: "
- << (max_centrality / dividend) << std::endl;
- ++iter;
- return inherited::operator()(max_centrality, e, g);
- }
-
- private:
- unsigned int iter;
+ typedef bc_clustering_threshold< double > inherited;
+
+public:
+ actor_clustering_threshold(
+ double threshold, const ActorGraph& g, bool normalize)
+ : inherited(threshold, g, normalize), iter(1)
+ {
+ }
+
+ bool operator()(double max_centrality, Edge e, const ActorGraph& g)
+ {
+ std::cout << "Iter: " << iter
+ << " Max Centrality: " << (max_centrality / dividend)
+ << std::endl;
+ ++iter;
+ return inherited::operator()(max_centrality, e, g);
+ }
+
+private:
+ unsigned int iter;
};
int main(int argc, char* argv[])
{
- std::string in_file;
- std::string out_file;
- double threshold = -1.0;
- bool normalize = false;
-
- // Parse command-line options
- {
- int on_arg = 1;
- while (on_arg < argc) {
- std::string arg(argv[on_arg]);
- if (arg == "-in") {
- ++on_arg; assert(on_arg < argc);
- in_file = argv[on_arg];
- } else if (arg == "-out") {
- ++on_arg; assert(on_arg < argc);
- out_file = argv[on_arg];
- } else if (arg == "-threshold") {
- ++on_arg; assert(on_arg < argc);
- threshold = lexical_cast(argv[on_arg]);
- } else if (arg == "-normalize") {
- normalize = true;
- } else {
- std::cerr << "Unrecognized parameter \"" << arg << "\".\n";
- return -1;
- }
- ++on_arg;
+ std::string in_file;
+ std::string out_file;
+ double threshold = -1.0;
+ bool normalize = false;
+
+ // Parse command-line options
+ {
+ int on_arg = 1;
+ while (on_arg < argc)
+ {
+ std::string arg(argv[on_arg]);
+ if (arg == "-in")
+ {
+ ++on_arg;
+ assert(on_arg < argc);
+ in_file = argv[on_arg];
+ }
+ else if (arg == "-out")
+ {
+ ++on_arg;
+ assert(on_arg < argc);
+ out_file = argv[on_arg];
+ }
+ else if (arg == "-threshold")
+ {
+ ++on_arg;
+ assert(on_arg < argc);
+ threshold = lexical_cast< double >(argv[on_arg]);
+ }
+ else if (arg == "-normalize")
+ {
+ normalize = true;
+ }
+ else
+ {
+ std::cerr << "Unrecognized parameter \"" << arg << "\".\n";
+ return -1;
+ }
+ ++on_arg;
+ }
+
+ if (in_file.empty() || out_file.empty() || threshold < 0)
+ {
+ std::cerr << "error: syntax is actor_clustering [options]\n\n"
+ << "options are:\n"
+ << "\t-in \tInput file\n"
+ << "\t-out \tOutput file\n"
+ << "\t-threshold \tA threshold value\n"
+ << "\t-normalize\tNormalize edge centrality scores\n";
+ return -1;
+ }
}
- if (in_file.empty() || out_file.empty() || threshold < 0) {
- std::cerr << "error: syntax is actor_clustering [options]\n\n"
- << "options are:\n"
- << "\t-in \tInput file\n"
- << "\t-out \tOutput file\n"
- << "\t-threshold \tA threshold value\n"
- << "\t-normalize\tNormalize edge centrality scores\n";
- return -1;
+ ActorGraph g;
+
+ // Load the actor graph
+ {
+ std::cout << "Building graph." << std::endl;
+ std::ifstream in(in_file.c_str());
+ if (!in)
+ {
+ std::cerr << "Unable to open file \"" << in_file
+ << "\" for input.\n";
+ return -2;
+ }
+ load_actor_graph(in, g);
}
- }
-
- ActorGraph g;
- // Load the actor graph
- {
- std::cout << "Building graph." << std::endl;
- std::ifstream in(in_file.c_str());
- if (!in) {
- std::cerr << "Unable to open file \"" << in_file << "\" for input.\n";
- return -2;
- }
- load_actor_graph(in, g);
- }
-
- // Run the algorithm
- std::cout << "Clusting..." << std::endl;
- betweenness_centrality_clustering(g,
- actor_clustering_threshold(threshold, g, normalize),
- get(edge_centrality, g));
-
- // Output the graph
- {
- std::cout << "Writing graph to file: " << out_file << std::endl;
- std::ofstream out(out_file.c_str());
- if (!out) {
- std::cerr << "Unable to open file \"" << out_file << "\" for output.\n";
- return -3;
+ // Run the algorithm
+ std::cout << "Clusting..." << std::endl;
+ betweenness_centrality_clustering(g,
+ actor_clustering_threshold(threshold, g, normalize),
+ get(edge_centrality, g));
+
+ // Output the graph
+ {
+ std::cout << "Writing graph to file: " << out_file << std::endl;
+ std::ofstream out(out_file.c_str());
+ if (!out)
+ {
+ std::cerr << "Unable to open file \"" << out_file
+ << "\" for output.\n";
+ return -3;
+ }
+ write_pajek_graph(out, g, get(vertex_index, g), get(&Actor::id, g));
}
- write_pajek_graph(out, g, get(vertex_index, g), get(&Actor::id, g));
- }
- return 0;
+ return 0;
}
diff --git a/example/adj_list_ra_edgelist.cpp b/example/adj_list_ra_edgelist.cpp
index d92ecd66e..d6380efae 100644
--- a/example/adj_list_ra_edgelist.cpp
+++ b/example/adj_list_ra_edgelist.cpp
@@ -11,25 +11,26 @@
#include
#include
-int
-main()
+int main()
{
- using namespace boost;
- typedef adjacency_list, no_property, vecS> Graph;
+ using namespace boost;
+ typedef adjacency_list< vecS, vecS, bidirectionalS, no_property,
+ property< int, edge_weight_t >, no_property, vecS >
+ Graph;
- const std::size_t n = 3;
- typedef std::pair E;
- E edge_array[] = { E(0,1), E(0,2), E(0,1) };
- const std::size_t m = sizeof(edge_array) / sizeof(E);
- Graph g(edge_array, edge_array + m, n);
+ const std::size_t n = 3;
+ typedef std::pair< std::size_t, std::size_t > E;
+ E edge_array[] = { E(0, 1), E(0, 2), E(0, 1) };
+ const std::size_t m = sizeof(edge_array) / sizeof(E);
+ Graph g(edge_array, edge_array + m, n);
- graph_traits::edge_iterator edge_iterator;
- for (std::size_t i = 0; i < m; ++i) {
- const graph_traits::edge_iterator e = edges(g).first + i;
- std::cout << *e << " ";
- }
- std::cout << std::endl;
-
- return 0;
+ graph_traits< Graph >::edge_iterator edge_iterator;
+ for (std::size_t i = 0; i < m; ++i)
+ {
+ const graph_traits< Graph >::edge_iterator e = edges(g).first + i;
+ std::cout << *e << " ";
+ }
+ std::cout << std::endl;
+
+ return 0;
}
diff --git a/example/adjacency_list.cpp b/example/adjacency_list.cpp
index 6d8053792..916a98c02 100644
--- a/example/adjacency_list.cpp
+++ b/example/adjacency_list.cpp
@@ -20,88 +20,92 @@
Sample Output
graph name: foo
- 0 --joe--> 1
- 1 --joe--> 0 --curly--> 2 --dick--> 3
- 2 --curly--> 1 --tom--> 4
- 3 --dick--> 1 --harry--> 4
- 4 --tom--> 2 --harry--> 3
- (0,1) (1,2) (1,3) (2,4) (3,4)
-
- removing edge (1,3):
- 0 --joe--> 1
- 1 --joe--> 0 --curly--> 2
- 2 --curly--> 1 --tom--> 4
- 3 --harry--> 4
- 4 --tom--> 2 --harry--> 3
- (0,1) (1,2) (2,4) (3,4)
+ 0 --joe--> 1
+ 1 --joe--> 0 --curly--> 2 --dick--> 3
+ 2 --curly--> 1 --tom--> 4
+ 3 --dick--> 1 --harry--> 4
+ 4 --tom--> 2 --harry--> 3
+ (0,1) (1,2) (1,3) (2,4) (3,4)
+
+ removing edge (1,3):
+ 0 --joe--> 1
+ 1 --joe--> 0 --curly--> 2
+ 2 --curly--> 1 --tom--> 4
+ 3 --harry--> 4
+ 4 --tom--> 2 --harry--> 3
+ (0,1) (1,2) (2,4) (3,4)
*/
-struct EdgeProperties {
- EdgeProperties(const std::string& n) : name(n) { }
- std::string name;
+struct EdgeProperties
+{
+ EdgeProperties(const std::string& n) : name(n) {}
+ std::string name;
};
-struct VertexProperties {
- std::size_t index;
- boost::default_color_type color;
+struct VertexProperties
+{
+ std::size_t index;
+ boost::default_color_type color;
};
-
-int main(int , char* [])
+int main(int, char*[])
{
- using namespace boost;
- using namespace std;
-
- typedef adjacency_list Graph;
-
- const int V = 5;
- Graph g(V);
-
- property_map::type
- id = get(&VertexProperties::index, g);
- property_map::type
- name = get(&EdgeProperties::name, g);
-
- boost::graph_traits::vertex_iterator vi, viend;
- int vnum = 0;
-
- for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi)
- id[*vi] = vnum++;
-
- add_edge(vertex(0, g), vertex(1, g), EdgeProperties("joe"), g);
- add_edge(vertex(1, g), vertex(2, g), EdgeProperties("curly"), g);
- add_edge(vertex(1, g), vertex(3, g), EdgeProperties("dick"), g);
- add_edge(vertex(2, g), vertex(4, g), EdgeProperties("tom"), g);
- add_edge(vertex(3, g), vertex(4, g), EdgeProperties("harry"), g);
-
- graph_traits::vertex_iterator i, end;
- graph_traits::out_edge_iterator ei, edge_end;
- for (boost::tie(i,end) = vertices(g); i != end; ++i) {
- cout << id[*i] << " ";
- for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
- cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
- cout << endl;
- }
- print_edges(g, id);
-
- cout << endl << "removing edge (1,3): " << endl;
- remove_edge(vertex(1, g), vertex(3, g), g);
-
- ei = out_edges(vertex(1, g), g).first;
- cout << "removing edge (" << id[source(*ei, g)]
- << "," << id[target(*ei, g)] << ")" << endl;
- remove_edge(ei, g);
-
- for(boost::tie(i,end) = vertices(g); i != end; ++i) {
- cout << id[*i] << " ";
- for (boost::tie(ei,edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
- cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
- cout << endl;
- }
-
- print_edges(g, id);
-
- return 0;
+ using namespace boost;
+ using namespace std;
+
+ typedef adjacency_list< vecS, listS, undirectedS, VertexProperties,
+ EdgeProperties >
+ Graph;
+
+ const int V = 5;
+ Graph g(V);
+
+ property_map< Graph, std::size_t VertexProperties::* >::type id
+ = get(&VertexProperties::index, g);
+ property_map< Graph, std::string EdgeProperties::* >::type name
+ = get(&EdgeProperties::name, g);
+
+ boost::graph_traits< Graph >::vertex_iterator vi, viend;
+ int vnum = 0;
+
+ for (boost::tie(vi, viend) = vertices(g); vi != viend; ++vi)
+ id[*vi] = vnum++;
+
+ add_edge(vertex(0, g), vertex(1, g), EdgeProperties("joe"), g);
+ add_edge(vertex(1, g), vertex(2, g), EdgeProperties("curly"), g);
+ add_edge(vertex(1, g), vertex(3, g), EdgeProperties("dick"), g);
+ add_edge(vertex(2, g), vertex(4, g), EdgeProperties("tom"), g);
+ add_edge(vertex(3, g), vertex(4, g), EdgeProperties("harry"), g);
+
+ graph_traits< Graph >::vertex_iterator i, end;
+ graph_traits< Graph >::out_edge_iterator ei, edge_end;
+ for (boost::tie(i, end) = vertices(g); i != end; ++i)
+ {
+ cout << id[*i] << " ";
+ for (boost::tie(ei, edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
+ cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
+ cout << endl;
+ }
+ print_edges(g, id);
+
+ cout << endl << "removing edge (1,3): " << endl;
+ remove_edge(vertex(1, g), vertex(3, g), g);
+
+ ei = out_edges(vertex(1, g), g).first;
+ cout << "removing edge (" << id[source(*ei, g)] << "," << id[target(*ei, g)]
+ << ")" << endl;
+ remove_edge(ei, g);
+
+ for (boost::tie(i, end) = vertices(g); i != end; ++i)
+ {
+ cout << id[*i] << " ";
+ for (boost::tie(ei, edge_end) = out_edges(*i, g); ei != edge_end; ++ei)
+ cout << " --" << name[*ei] << "--> " << id[target(*ei, g)] << " ";
+ cout << endl;
+ }
+
+ print_edges(g, id);
+
+ return 0;
}
diff --git a/example/adjacency_list.expected b/example/adjacency_list.expected
index f85d7549f..8fbdaeaa0 100644
--- a/example/adjacency_list.expected
+++ b/example/adjacency_list.expected
@@ -1,15 +1,15 @@
-0 --joe--> 1
-1 --joe--> 0 --curly--> 2 --dick--> 3
-2 --curly--> 1 --tom--> 4
-3 --dick--> 1 --harry--> 4
-4 --tom--> 2 --harry--> 3
-(0,1) (1,2) (1,3) (2,4) (3,4)
+0 --joe--> 1
+1 --joe--> 0 --curly--> 2 --dick--> 3
+2 --curly--> 1 --tom--> 4
+3 --dick--> 1 --harry--> 4
+4 --tom--> 2 --harry--> 3
+(0,1) (1,2) (1,3) (2,4) (3,4)
-removing edge (1,3):
+removing edge (1,3):
removing edge (1,0)
-0
-1 --curly--> 2
-2 --curly--> 1 --tom--> 4
-3 --harry--> 4
-4 --tom--> 2 --harry--> 3
-(1,2) (2,4) (3,4)
+0
+1 --curly--> 2
+2 --curly--> 1 --tom--> 4
+3 --harry--> 4
+4 --tom--> 2 --harry--> 3
+(1,2) (2,4) (3,4)
diff --git a/example/adjacency_list_io.cpp b/example/adjacency_list_io.cpp
index ab626f89c..bfc0280c5 100644
--- a/example/adjacency_list_io.cpp
+++ b/example/adjacency_list_io.cpp
@@ -15,83 +15,99 @@
using namespace boost;
//======== my data structure
-struct MyStruct { double value; };
-std::ostream& operator << ( std::ostream& out, const MyStruct& s )
+struct MyStruct
{
- out << s.value << " ";
- return out;
+ double value;
+};
+std::ostream& operator<<(std::ostream& out, const MyStruct& s)
+{
+ out << s.value << " ";
+ return out;
}
-std::istream& operator >> ( std::istream& in, MyStruct& s )
+std::istream& operator>>(std::istream& in, MyStruct& s)
{
- in >> s.value;
- return in;
+ in >> s.value;
+ return in;
}
//======== vertex properties
-struct n1_t { enum { num = 23063}; typedef vertex_property_tag kind; };
-struct n2_t { enum { num = 23062}; typedef vertex_property_tag kind; };
-struct n3_t { enum { num = 23061}; typedef vertex_property_tag kind; };
+struct n1_t
+{
+ enum
+ {
+ num = 23063
+ };
+ typedef vertex_property_tag kind;
+};
+struct n2_t
+{
+ enum
+ {
+ num = 23062
+ };
+ typedef vertex_property_tag kind;
+};
+struct n3_t
+{
+ enum
+ {
+ num = 23061
+ };
+ typedef vertex_property_tag kind;
+};
typedef property< n1_t, int,
- property< n2_t, double,
- property< n3_t, MyStruct > > > VertexProperty;
-
+ property< n2_t, double, property< n3_t, MyStruct > > >
+ VertexProperty;
//====== edge properties
-struct e1_t { enum { num = 23064}; typedef edge_property_tag kind; };
-typedef property EdgeProperty;
-
-
+struct e1_t
+{
+ enum
+ {
+ num = 23064
+ };
+ typedef edge_property_tag kind;
+};
+typedef property< e1_t, double > EdgeProperty;
//===== graph types
-typedef
- adjacency_list
- Graph1;
-
-typedef
- adjacency_list
- Graph2;
+typedef adjacency_list< vecS, listS, directedS, no_property, no_property >
+ Graph1;
+typedef adjacency_list< setS, setS, bidirectionalS, VertexProperty,
+ EdgeProperty >
+ Graph2;
-
-int
-main()
+int main()
{
- // read Graph1
- Graph1 g1;
- std::ifstream readFile1("data1.txt");
- readFile1 >> read( g1 );
- std::cout << "graph g1 from file data1.txt:\n"
- << write( g1 )
- << std::endl;
-
- // read Graph2 and all internal properties
- Graph2 g2;
- std::ifstream readFile2("data2.txt");
- readFile2 >> read( g2 );
- std::cout << "graph g2 from file data2.txt:\n"
- << write( g2 )
- << std::endl;
-
- // read Graph2, no property given. Write no property.
- Graph2 g21;
- std::ifstream readFile21("data1.txt");
- readFile21 >> read( g21, no_property(), no_property() );
- std::cout << "graph g21 from file data1.txt:\n"
- << write(g21, no_property(), no_property())
- << std::endl;
-
- // read Graph2, incomplete data in a different order. Write it diffently.
- Graph2 g31;
- std::ifstream readFile31("data3.txt");
- typedef property< n3_t, MyStruct, property< n1_t, int > > readNodeProp;
- readFile31 >> read( g31, readNodeProp() , EdgeProperty() );
- std::cout << "graph g31 from file data3.txt:\n"
- << write( g31, property(), EdgeProperty() )
- << std::endl;
-
-
- return 0;
+ // read Graph1
+ Graph1 g1;
+ std::ifstream readFile1("data1.txt");
+ readFile1 >> read(g1);
+ std::cout << "graph g1 from file data1.txt:\n" << write(g1) << std::endl;
+
+ // read Graph2 and all internal properties
+ Graph2 g2;
+ std::ifstream readFile2("data2.txt");
+ readFile2 >> read(g2);
+ std::cout << "graph g2 from file data2.txt:\n" << write(g2) << std::endl;
+
+ // read Graph2, no property given. Write no property.
+ Graph2 g21;
+ std::ifstream readFile21("data1.txt");
+ readFile21 >> read(g21, no_property(), no_property());
+ std::cout << "graph g21 from file data1.txt:\n"
+ << write(g21, no_property(), no_property()) << std::endl;
+
+ // read Graph2, incomplete data in a different order. Write it diffently.
+ Graph2 g31;
+ std::ifstream readFile31("data3.txt");
+ typedef property< n3_t, MyStruct, property< n1_t, int > > readNodeProp;
+ readFile31 >> read(g31, readNodeProp(), EdgeProperty());
+ std::cout << "graph g31 from file data3.txt:\n"
+ << write(g31, property< n3_t, MyStruct >(), EdgeProperty())
+ << std::endl;
+
+ return 0;
}
-
-
diff --git a/example/adjacency_matrix.cpp b/example/adjacency_matrix.cpp
index accbfca1e..4f36ead98 100644
--- a/example/adjacency_matrix.cpp
+++ b/example/adjacency_matrix.cpp
@@ -11,57 +11,65 @@
#include
#include
-
int main()
{
- using namespace boost;
- enum { A, B, C, D, E, F, N };
- const char* name = "ABCDEF";
+ using namespace boost;
+ enum
+ {
+ A,
+ B,
+ C,
+ D,
+ E,
+ F,
+ N
+ };
+ const char* name = "ABCDEF";
+
+ // A directed graph
- // A directed graph
-
- typedef adjacency_matrix Graph;
- Graph g(N);
- add_edge(B, C, g);
- add_edge(B, F, g);
- add_edge(C, A, g);
- add_edge(C, C, g);
- add_edge(D, E, g);
- add_edge(E, D, g);
- add_edge(F, A, g);
+ typedef adjacency_matrix< directedS > Graph;
+ Graph g(N);
+ add_edge(B, C, g);
+ add_edge(B, F, g);
+ add_edge(C, A, g);
+ add_edge(C, C, g);
+ add_edge(D, E, g);
+ add_edge(E, D, g);
+ add_edge(F, A, g);
- std::cout << "vertex set: ";
- print_vertices(g, name);
- std::cout << std::endl;
+ std::cout << "vertex set: ";
+ print_vertices(g, name);
+ std::cout << std::endl;
- std::cout << "edge set: ";
- print_edges(g, name);
- std::cout << std::endl;
+ std::cout << "edge set: ";
+ print_edges(g, name);
+ std::cout << std::endl;
- std::cout << "out-edges: " << std::endl;
- print_graph(g, name);
- std::cout << std::endl;
+ std::cout << "out-edges: " << std::endl;
+ print_graph(g, name);
+ std::cout << std::endl;
- // An undirected graph
+ // An undirected graph
- typedef adjacency_matrix UGraph;
- UGraph ug(N);
- add_edge(B, C, ug);
- add_edge(B, F, ug);
- add_edge(C, A, ug);
- add_edge(D, E, ug);
- add_edge(F, A, ug);
+ typedef adjacency_matrix< undirectedS > UGraph;
+ UGraph ug(N);
+ add_edge(B, C, ug);
+ add_edge(B, F, ug);
+ add_edge(C, A, ug);
+ add_edge(D, E, ug);
+ add_edge(F, A, ug);
- std::cout << "vertex set: ";
- print_vertices(ug, name);
- std::cout << std::endl;
+ std::cout << "vertex set: ";
+ print_vertices(ug, name);
+ std::cout << std::endl;
- std::cout << "edge set: ";
- print_edges(ug, name);
- std::cout << std::endl;
+ std::cout << "edge set: ";
+ print_edges(ug, name);
+ std::cout << std::endl;
- std::cout << "incident edges: " << std::endl;
- print_graph(ug, name);
- std::cout << std::endl;
- return 0;
+ std::cout << "incident edges: " << std::endl;
+ print_graph(ug, name);
+ std::cout << std::endl;
+ return 0;
}
diff --git a/example/astar-cities.cpp b/example/astar-cities.cpp
index bca644667..3437e6abd 100644
--- a/example/astar-cities.cpp
+++ b/example/astar-cities.cpp
@@ -10,7 +10,6 @@
//=======================================================================
//
-
#include
#include
#include
@@ -21,204 +20,218 @@
#include
#include
#include
-#include // for sqrt
+#include // for sqrt
using namespace boost;
using namespace std;
-
// auxiliary types
struct location
{
- float y, x; // lat, long
+ float y, x; // lat, long
};
typedef float cost;
-template
-class city_writer {
+template < class Name, class LocMap > class city_writer
+{
public:
- city_writer(Name n, LocMap l, float _minx, float _maxx,
- float _miny, float _maxy,
- unsigned int _ptx, unsigned int _pty)
- : name(n), loc(l), minx(_minx), maxx(_maxx), miny(_miny),
- maxy(_maxy), ptx(_ptx), pty(_pty) {}
- template
- void operator()(ostream& out, const Vertex& v) const {
- float px = 1 - (loc[v].x - minx) / (maxx - minx);
- float py = (loc[v].y - miny) / (maxy - miny);
- out << "[label=\"" << name[v] << "\", pos=\""
- << static_cast(ptx * px) << ","
- << static_cast(pty * py)
- << "\", fontsize=\"11\"]";
- }
+ city_writer(Name n, LocMap l, float _minx, float _maxx, float _miny,
+ float _maxy, unsigned int _ptx, unsigned int _pty)
+ : name(n)
+ , loc(l)
+ , minx(_minx)
+ , maxx(_maxx)
+ , miny(_miny)
+ , maxy(_maxy)
+ , ptx(_ptx)
+ , pty(_pty)
+ {
+ }
+ template < class Vertex >
+ void operator()(ostream& out, const Vertex& v) const
+ {
+ float px = 1 - (loc[v].x - minx) / (maxx - minx);
+ float py = (loc[v].y - miny) / (maxy - miny);
+ out << "[label=\"" << name[v] << "\", pos=\""
+ << static_cast< unsigned int >(ptx * px) << ","
+ << static_cast< unsigned int >(pty * py) << "\", fontsize=\"11\"]";
+ }
+
private:
- Name name;
- LocMap loc;
- float minx, maxx, miny, maxy;
- unsigned int ptx, pty;
+ Name name;
+ LocMap loc;
+ float minx, maxx, miny, maxy;
+ unsigned int ptx, pty;
};
-template
-class time_writer {
+template < class WeightMap > class time_writer
+{
public:
- time_writer(WeightMap w) : wm(w) {}
- template
- void operator()(ostream &out, const Edge& e) const {
- out << "[label=\"" << wm[e] << "\", fontsize=\"11\"]";
- }
+ time_writer(WeightMap w) : wm(w) {}
+ template < class Edge > void operator()(ostream& out, const Edge& e) const
+ {
+ out << "[label=\"" << wm[e] << "\", fontsize=\"11\"]";
+ }
+
private:
- WeightMap wm;
+ WeightMap wm;
};
-
// euclidean distance heuristic
-template
-class distance_heuristic : public astar_heuristic
+template < class Graph, class CostType, class LocMap >
+class distance_heuristic : public astar_heuristic< Graph, CostType >
{
public:
- typedef typename graph_traits::vertex_descriptor Vertex;
- distance_heuristic(LocMap l, Vertex goal)
- : m_location(l), m_goal(goal) {}
- CostType operator()(Vertex u)
- {
- CostType dx = m_location[m_goal].x - m_location[u].x;
- CostType dy = m_location[m_goal].y - m_location[u].y;
- return ::sqrt(dx * dx + dy * dy);
- }
+ typedef typename graph_traits< Graph >::vertex_descriptor Vertex;
+ distance_heuristic(LocMap l, Vertex goal) : m_location(l), m_goal(goal) {}
+ CostType operator()(Vertex u)
+ {
+ CostType dx = m_location[m_goal].x - m_location[u].x;
+ CostType dy = m_location[m_goal].y - m_location[u].y;
+ return ::sqrt(dx * dx + dy * dy);
+ }
+
private:
- LocMap m_location;
- Vertex m_goal;
+ LocMap m_location;
+ Vertex m_goal;
};
-
-struct found_goal {}; // exception for termination
+struct found_goal
+{
+}; // exception for termination
// visitor that terminates when we find the goal
-template
+template < class Vertex >
class astar_goal_visitor : public boost::default_astar_visitor
{
public:
- astar_goal_visitor(Vertex goal) : m_goal(goal) {}
- template
- void examine_vertex(Vertex u, Graph& g) {
- if(u == m_goal)
- throw found_goal();
- }
+ astar_goal_visitor(Vertex goal) : m_goal(goal) {}
+ template < class Graph > void examine_vertex(Vertex u, Graph& g)
+ {
+ if (u == m_goal)
+ throw found_goal();
+ }
+
private:
- Vertex m_goal;
+ Vertex m_goal;
};
-
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
-
- // specify some types
- typedef adjacency_list > mygraph_t;
- typedef property_map::type WeightMap;
- typedef mygraph_t::vertex_descriptor vertex;
- typedef mygraph_t::edge_descriptor edge_descriptor;
- typedef std::pair edge;
-
- // specify data
- enum nodes {
- Troy, LakePlacid, Plattsburgh, Massena, Watertown, Utica,
- Syracuse, Rochester, Buffalo, Ithaca, Binghamton, Woodstock,
- NewYork, N
- };
- const char *name[] = {
- "Troy", "Lake Placid", "Plattsburgh", "Massena",
- "Watertown", "Utica", "Syracuse", "Rochester", "Buffalo",
- "Ithaca", "Binghamton", "Woodstock", "New York"
- };
- location locations[] = { // lat/long
- {42.73, 73.68}, {44.28, 73.99}, {44.70, 73.46},
- {44.93, 74.89}, {43.97, 75.91}, {43.10, 75.23},
- {43.04, 76.14}, {43.17, 77.61}, {42.89, 78.86},
- {42.44, 76.50}, {42.10, 75.91}, {42.04, 74.11},
- {40.67, 73.94}
- };
- edge edge_array[] = {
- edge(Troy,Utica), edge(Troy,LakePlacid),
- edge(Troy,Plattsburgh), edge(LakePlacid,Plattsburgh),
- edge(Plattsburgh,Massena), edge(LakePlacid,Massena),
- edge(Massena,Watertown), edge(Watertown,Utica),
- edge(Watertown,Syracuse), edge(Utica,Syracuse),
- edge(Syracuse,Rochester), edge(Rochester,Buffalo),
- edge(Syracuse,Ithaca), edge(Ithaca,Binghamton),
- edge(Ithaca,Rochester), edge(Binghamton,Troy),
- edge(Binghamton,Woodstock), edge(Binghamton,NewYork),
- edge(Syracuse,Binghamton), edge(Woodstock,Troy),
- edge(Woodstock,NewYork)
- };
- unsigned int num_edges = sizeof(edge_array) / sizeof(edge);
- cost weights[] = { // estimated travel time (mins)
- 96, 134, 143, 65, 115, 133, 117, 116, 74, 56,
- 84, 73, 69, 70, 116, 147, 173, 183, 74, 71, 124
- };
-
-
- // create graph
- mygraph_t g(N);
- WeightMap weightmap = get(edge_weight, g);
- for(std::size_t j = 0; j < num_edges; ++j) {
- edge_descriptor e; bool inserted;
- boost::tie(e, inserted) = add_edge(edge_array[j].first,
- edge_array[j].second, g);
- weightmap[e] = weights[j];
- }
-
-
- // pick random start/goal
- boost::mt19937 gen(std::time(0));
- vertex start = random_vertex(g, gen);
- vertex goal = random_vertex(g, gen);
-
-
- cout << "Start vertex: " << name[start] << endl;
- cout << "Goal vertex: " << name[goal] << endl;
-
- ofstream dotfile;
- dotfile.open("test-astar-cities.dot");
- write_graphviz(dotfile, g,
- city_writer
- (name, locations, 73.46, 78.86, 40.67, 44.93,
- 480, 400),
- time_writer(weightmap));
-
-
- vector p(num_vertices(g));
- vector d(num_vertices(g));
- try {
- // call astar named parameter interface
- astar_search_tree
- (g, start,
- distance_heuristic
- (locations, goal),
- predecessor_map(make_iterator_property_map(p.begin(), get(vertex_index, g))).
- distance_map(make_iterator_property_map(d.begin(), get(vertex_index, g))).
- visitor(astar_goal_visitor(goal)));
-
-
- } catch(found_goal fg) { // found a path to the goal
- list shortest_path;
- for(vertex v = goal;; v = p[v]) {
- shortest_path.push_front(v);
- if(p[v] == v)
- break;
+
+ // specify some types
+ typedef adjacency_list< listS, vecS, undirectedS, no_property,
+ property< edge_weight_t, cost > >
+ mygraph_t;
+ typedef property_map< mygraph_t, edge_weight_t >::type WeightMap;
+ typedef mygraph_t::vertex_descriptor vertex;
+ typedef mygraph_t::edge_descriptor edge_descriptor;
+ typedef std::pair< int, int > edge;
+
+ // specify data
+ enum nodes
+ {
+ Troy,
+ LakePlacid,
+ Plattsburgh,
+ Massena,
+ Watertown,
+ Utica,
+ Syracuse,
+ Rochester,
+ Buffalo,
+ Ithaca,
+ Binghamton,
+ Woodstock,
+ NewYork,
+ N
+ };
+ const char* name[] = { "Troy", "Lake Placid", "Plattsburgh", "Massena",
+ "Watertown", "Utica", "Syracuse", "Rochester", "Buffalo", "Ithaca",
+ "Binghamton", "Woodstock", "New York" };
+ location locations[] = { // lat/long
+ { 42.73, 73.68 }, { 44.28, 73.99 }, { 44.70, 73.46 }, { 44.93, 74.89 },
+ { 43.97, 75.91 }, { 43.10, 75.23 }, { 43.04, 76.14 }, { 43.17, 77.61 },
+ { 42.89, 78.86 }, { 42.44, 76.50 }, { 42.10, 75.91 }, { 42.04, 74.11 },
+ { 40.67, 73.94 }
+ };
+ edge edge_array[]
+ = { edge(Troy, Utica), edge(Troy, LakePlacid), edge(Troy, Plattsburgh),
+ edge(LakePlacid, Plattsburgh), edge(Plattsburgh, Massena),
+ edge(LakePlacid, Massena), edge(Massena, Watertown),
+ edge(Watertown, Utica), edge(Watertown, Syracuse),
+ edge(Utica, Syracuse), edge(Syracuse, Rochester),
+ edge(Rochester, Buffalo), edge(Syracuse, Ithaca),
+ edge(Ithaca, Binghamton), edge(Ithaca, Rochester),
+ edge(Binghamton, Troy), edge(Binghamton, Woodstock),
+ edge(Binghamton, NewYork), edge(Syracuse, Binghamton),
+ edge(Woodstock, Troy), edge(Woodstock, NewYork) };
+ unsigned int num_edges = sizeof(edge_array) / sizeof(edge);
+ cost weights[] = { // estimated travel time (mins)
+ 96, 134, 143, 65, 115, 133, 117, 116, 74, 56, 84, 73, 69, 70, 116, 147,
+ 173, 183, 74, 71, 124
+ };
+
+ // create graph
+ mygraph_t g(N);
+ WeightMap weightmap = get(edge_weight, g);
+ for (std::size_t j = 0; j < num_edges; ++j)
+ {
+ edge_descriptor e;
+ bool inserted;
+ boost::tie(e, inserted)
+ = add_edge(edge_array[j].first, edge_array[j].second, g);
+ weightmap[e] = weights[j];
+ }
+
+ // pick random start/goal
+ boost::mt19937 gen(std::time(0));
+ vertex start = random_vertex(g, gen);
+ vertex goal = random_vertex(g, gen);
+
+ cout << "Start vertex: " << name[start] << endl;
+ cout << "Goal vertex: " << name[goal] << endl;
+
+ ofstream dotfile;
+ dotfile.open("test-astar-cities.dot");
+ write_graphviz(dotfile, g,
+ city_writer< const char**, location* >(
+ name, locations, 73.46, 78.86, 40.67, 44.93, 480, 400),
+ time_writer< WeightMap >(weightmap));
+
+ vector< mygraph_t::vertex_descriptor > p(num_vertices(g));
+ vector< cost > d(num_vertices(g));
+ try
+ {
+ // call astar named parameter interface
+ astar_search_tree(g, start,
+ distance_heuristic< mygraph_t, cost, location* >(locations, goal),
+ predecessor_map(
+ make_iterator_property_map(p.begin(), get(vertex_index, g)))
+ .distance_map(
+ make_iterator_property_map(d.begin(), get(vertex_index, g)))
+ .visitor(astar_goal_visitor< vertex >(goal)));
}
- cout << "Shortest path from " << name[start] << " to "
- << name[goal] << ": ";
- list::iterator spi = shortest_path.begin();
- cout << name[start];
- for(++spi; spi != shortest_path.end(); ++spi)
- cout << " -> " << name[*spi];
- cout << endl << "Total travel time: " << d[goal] << endl;
+ catch (found_goal fg)
+ { // found a path to the goal
+ list< vertex > shortest_path;
+ for (vertex v = goal;; v = p[v])
+ {
+ shortest_path.push_front(v);
+ if (p[v] == v)
+ break;
+ }
+ cout << "Shortest path from " << name[start] << " to " << name[goal]
+ << ": ";
+ list< vertex >::iterator spi = shortest_path.begin();
+ cout << name[start];
+ for (++spi; spi != shortest_path.end(); ++spi)
+ cout << " -> " << name[*spi];
+ cout << endl << "Total travel time: " << d[goal] << endl;
+ return 0;
+ }
+
+ cout << "Didn't find a path from " << name[start] << "to" << name[goal]
+ << "!" << endl;
return 0;
- }
-
- cout << "Didn't find a path from " << name[start] << "to"
- << name[goal] << "!" << endl;
- return 0;
-
}
diff --git a/example/astar_maze.cpp b/example/astar_maze.cpp
index e567a15bf..4c437ee87 100644
--- a/example/astar_maze.cpp
+++ b/example/astar_maze.cpp
@@ -4,7 +4,6 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-
// This program uses the A-star search algorithm in the Boost Graph Library to
// solve a maze. It is an example of how to apply Boost Graph Library
// algorithms to implicit graphs.
@@ -26,11 +25,11 @@
IMPORTANT:
~~~~~~~~~~
- This example appears to be broken and crashes at runtime, see https://github.com/boostorg/graph/issues/148
+ This example appears to be broken and crashes at runtime, see
+ https://github.com/boostorg/graph/issues/148
*/
-
#include
#include
#include
@@ -49,25 +48,27 @@ boost::mt19937 random_generator;
typedef double distance;
#define GRID_RANK 2
-typedef boost::grid_graph grid;
-typedef boost::graph_traits::vertex_descriptor vertex_descriptor;
-typedef boost::graph_traits::vertices_size_type vertices_size_type;
+typedef boost::grid_graph< GRID_RANK > grid;
+typedef boost::graph_traits< grid >::vertex_descriptor vertex_descriptor;
+typedef boost::graph_traits< grid >::vertices_size_type vertices_size_type;
// A hash function for vertices.
-struct vertex_hash {
- typedef vertex_descriptor argument_type;
- typedef std::size_t result_type;
- std::size_t operator()(vertex_descriptor const& u) const {
- std::size_t seed = 0;
- boost::hash_combine(seed, u[0]);
- boost::hash_combine(seed, u[1]);
- return seed;
- }
+struct vertex_hash
+{
+ typedef vertex_descriptor argument_type;
+ typedef std::size_t result_type;
+ std::size_t operator()(vertex_descriptor const& u) const
+ {
+ std::size_t seed = 0;
+ boost::hash_combine(seed, u[0]);
+ boost::hash_combine(seed, u[1]);
+ return seed;
+ }
};
-typedef boost::unordered_set vertex_set;
-typedef boost::vertex_subset_complement_filter::type
- filtered_grid;
+typedef boost::unordered_set< vertex_descriptor, vertex_hash > vertex_set;
+typedef boost::vertex_subset_complement_filter< grid, vertex_set >::type
+ filtered_grid;
// A searchable maze
//
@@ -84,235 +85,260 @@ typedef boost::vertex_subset_complement_filter::type
// A-star search is used to find a path through the maze. Each edge has a
// weight of one, so the total path length is equal to the number of edges
// traversed.
-class maze {
+class maze
+{
public:
- friend std::ostream& operator<<(std::ostream&, const maze&);
- friend void random_maze(maze&);
+ friend std::ostream& operator<<(std::ostream&, const maze&);
+ friend void random_maze(maze&);
- maze():m_grid(create_grid(0, 0)),m_barrier_grid(create_barrier_grid()) {};
- maze(std::size_t x, std::size_t y):m_grid(create_grid(x, y)),
- m_barrier_grid(create_barrier_grid()) {};
+ maze()
+ : m_grid(create_grid(0, 0)), m_barrier_grid(create_barrier_grid()) {};
+ maze(std::size_t x, std::size_t y)
+ : m_grid(create_grid(x, y)), m_barrier_grid(create_barrier_grid()) {};
- // The length of the maze along the specified dimension.
- vertices_size_type length(std::size_t d) const {return m_grid.length(d);}
+ // The length of the maze along the specified dimension.
+ vertices_size_type length(std::size_t d) const { return m_grid.length(d); }
- bool has_barrier(vertex_descriptor u) const {
- return m_barriers.find(u) != m_barriers.end();
- }
+ bool has_barrier(vertex_descriptor u) const
+ {
+ return m_barriers.find(u) != m_barriers.end();
+ }
- // Try to find a path from the lower-left-hand corner source (0,0) to the
- // upper-right-hand corner goal (x-1, y-1).
- vertex_descriptor source() const {return vertex(0, m_grid);}
- vertex_descriptor goal() const {
- return vertex(num_vertices(m_grid)-1, m_grid);
- }
+ // Try to find a path from the lower-left-hand corner source (0,0) to the
+ // upper-right-hand corner goal (x-1, y-1).
+ vertex_descriptor source() const { return vertex(0, m_grid); }
+ vertex_descriptor goal() const
+ {
+ return vertex(num_vertices(m_grid) - 1, m_grid);
+ }
- bool solve();
- bool solved() const {return !m_solution.empty();}
- bool solution_contains(vertex_descriptor u) const {
- return m_solution.find(u) != m_solution.end();
- }
+ bool solve();
+ bool solved() const { return !m_solution.empty(); }
+ bool solution_contains(vertex_descriptor u) const
+ {
+ return m_solution.find(u) != m_solution.end();
+ }
private:
- // Create the underlying rank-2 grid with the specified dimensions.
- grid create_grid(std::size_t x, std::size_t y) {
- boost::array lengths = { {x, y} };
- return grid(lengths);
- }
-
- // Filter the barrier vertices out of the underlying grid.
- filtered_grid create_barrier_grid() {
- return boost::make_vertex_subset_complement_filter(m_grid, m_barriers);
- }
-
- // The grid underlying the maze
- grid m_grid;
- // The barriers in the maze
- vertex_set m_barriers;
- // The underlying maze grid with barrier vertices filtered out
- filtered_grid m_barrier_grid;
- // The vertices on a solution path through the maze
- vertex_set m_solution;
- // The length of the solution path
- distance m_solution_length;
-};
+ // Create the underlying rank-2 grid with the specified dimensions.
+ grid create_grid(std::size_t x, std::size_t y)
+ {
+ boost::array< std::size_t, GRID_RANK > lengths = { { x, y } };
+ return grid(lengths);
+ }
+ // Filter the barrier vertices out of the underlying grid.
+ filtered_grid create_barrier_grid()
+ {
+ return boost::make_vertex_subset_complement_filter(m_grid, m_barriers);
+ }
+
+ // The grid underlying the maze
+ grid m_grid;
+ // The barriers in the maze
+ vertex_set m_barriers;
+ // The underlying maze grid with barrier vertices filtered out
+ filtered_grid m_barrier_grid;
+ // The vertices on a solution path through the maze
+ vertex_set m_solution;
+ // The length of the solution path
+ distance m_solution_length;
+};
// Euclidean heuristic for a grid
//
// This calculates the Euclidean distance between a vertex and a goal
// vertex.
-class euclidean_heuristic:
- public boost::astar_heuristic
+class euclidean_heuristic
+: public boost::astar_heuristic< filtered_grid, double >
{
public:
- euclidean_heuristic(vertex_descriptor goal):m_goal(goal) {};
+ euclidean_heuristic(vertex_descriptor goal) : m_goal(goal) {};
- double operator()(vertex_descriptor v) {
- return sqrt(pow(double(m_goal[0] - v[0]), 2) + pow(double(m_goal[1] - v[1]), 2));
- }
+ double operator()(vertex_descriptor v)
+ {
+ return sqrt(pow(double(m_goal[0] - v[0]), 2)
+ + pow(double(m_goal[1] - v[1]), 2));
+ }
private:
- vertex_descriptor m_goal;
+ vertex_descriptor m_goal;
};
// Exception thrown when the goal vertex is found
-struct found_goal {};
+struct found_goal
+{
+};
// Visitor that terminates when we find the goal vertex
-struct astar_goal_visitor:public boost::default_astar_visitor {
- astar_goal_visitor(vertex_descriptor goal):m_goal(goal) {};
+struct astar_goal_visitor : public boost::default_astar_visitor
+{
+ astar_goal_visitor(vertex_descriptor goal) : m_goal(goal) {};
- void examine_vertex(vertex_descriptor u, const filtered_grid&) {
- if (u == m_goal)
- throw found_goal();
- }
+ void examine_vertex(vertex_descriptor u, const filtered_grid&)
+ {
+ if (u == m_goal)
+ throw found_goal();
+ }
private:
- vertex_descriptor m_goal;
+ vertex_descriptor m_goal;
};
// Solve the maze using A-star search. Return true if a solution was found.
-bool maze::solve() {
- boost::static_property_map weight(1);
- // The predecessor map is a vertex-to-vertex mapping.
- typedef boost::unordered_map pred_map;
- pred_map predecessor;
- boost::associative_property_map pred_pmap(predecessor);
- // The distance map is a vertex-to-distance mapping.
- typedef boost::unordered_map dist_map;
- dist_map distance;
- boost::associative_property_map dist_pmap(distance);
-
- vertex_descriptor s = source();
- vertex_descriptor g = goal();
- euclidean_heuristic heuristic(g);
- astar_goal_visitor visitor(g);
-
- try {
- astar_search(m_barrier_grid, s, heuristic,
- boost::weight_map(weight).
- predecessor_map(pred_pmap).
- distance_map(dist_pmap).
- visitor(visitor) );
- } catch(found_goal fg) {
- // Walk backwards from the goal through the predecessor chain adding
- // vertices to the solution path.
- for (vertex_descriptor u = g; u != s; u = predecessor[u])
- m_solution.insert(u);
- m_solution.insert(s);
- m_solution_length = distance[g];
- return true;
- }
-
- return false;
-}
+bool maze::solve()
+{
+ boost::static_property_map< distance > weight(1);
+ // The predecessor map is a vertex-to-vertex mapping.
+ typedef boost::unordered_map< vertex_descriptor, vertex_descriptor,
+ vertex_hash >
+ pred_map;
+ pred_map predecessor;
+ boost::associative_property_map< pred_map > pred_pmap(predecessor);
+ // The distance map is a vertex-to-distance mapping.
+ typedef boost::unordered_map< vertex_descriptor, distance, vertex_hash >
+ dist_map;
+ dist_map distance;
+ boost::associative_property_map< dist_map > dist_pmap(distance);
+
+ vertex_descriptor s = source();
+ vertex_descriptor g = goal();
+ euclidean_heuristic heuristic(g);
+ astar_goal_visitor visitor(g);
+
+ try
+ {
+ astar_search(m_barrier_grid, s, heuristic,
+ boost::weight_map(weight)
+ .predecessor_map(pred_pmap)
+ .distance_map(dist_pmap)
+ .visitor(visitor));
+ }
+ catch (found_goal fg)
+ {
+ // Walk backwards from the goal through the predecessor chain adding
+ // vertices to the solution path.
+ for (vertex_descriptor u = g; u != s; u = predecessor[u])
+ m_solution.insert(u);
+ m_solution.insert(s);
+ m_solution_length = distance[g];
+ return true;
+ }
+ return false;
+}
#define BARRIER "#"
// Print the maze as an ASCII map.
-std::ostream& operator<<(std::ostream& output, const maze& m) {
- // Header
- for (vertices_size_type i = 0; i < m.length(0)+2; i++)
- output << BARRIER;
- output << std::endl;
- // Body
- for (int y = m.length(1)-1; y >= 0; y--) {
- // Enumerate rows in reverse order and columns in regular order so that
- // (0,0) appears in the lower left-hand corner. This requires that y be
- // int and not the unsigned vertices_size_type because the loop exit
- // condition is y==-1.
- for (vertices_size_type x = 0; x < m.length(0); x++) {
- // Put a barrier on the left-hand side.
- if (x == 0)
- output << BARRIER;
- // Put the character representing this point in the maze grid.
- vertex_descriptor u = {{x, vertices_size_type(y)}};
- if (m.solution_contains(u))
- output << ".";
- else if (m.has_barrier(u))
- output << BARRIER;
- else
- output << " ";
- // Put a barrier on the right-hand side.
- if (x == m.length(0)-1)
+std::ostream& operator<<(std::ostream& output, const maze& m)
+{
+ // Header
+ for (vertices_size_type i = 0; i < m.length(0) + 2; i++)
output << BARRIER;
- }
- // Put a newline after every row except the last one.
output << std::endl;
- }
- // Footer
- for (vertices_size_type i = 0; i < m.length(0)+2; i++)
- output << BARRIER;
- if (m.solved())
- output << std::endl << "Solution length " << m.m_solution_length;
- return output;
+ // Body
+ for (int y = m.length(1) - 1; y >= 0; y--)
+ {
+ // Enumerate rows in reverse order and columns in regular order so that
+ // (0,0) appears in the lower left-hand corner. This requires that y be
+ // int and not the unsigned vertices_size_type because the loop exit
+ // condition is y==-1.
+ for (vertices_size_type x = 0; x < m.length(0); x++)
+ {
+ // Put a barrier on the left-hand side.
+ if (x == 0)
+ output << BARRIER;
+ // Put the character representing this point in the maze grid.
+ vertex_descriptor u = { { x, vertices_size_type(y) } };
+ if (m.solution_contains(u))
+ output << ".";
+ else if (m.has_barrier(u))
+ output << BARRIER;
+ else
+ output << " ";
+ // Put a barrier on the right-hand side.
+ if (x == m.length(0) - 1)
+ output << BARRIER;
+ }
+ // Put a newline after every row except the last one.
+ output << std::endl;
+ }
+ // Footer
+ for (vertices_size_type i = 0; i < m.length(0) + 2; i++)
+ output << BARRIER;
+ if (m.solved())
+ output << std::endl << "Solution length " << m.m_solution_length;
+ return output;
}
// Return a random integer in the interval [a, b].
-std::size_t random_int(std::size_t a, std::size_t b) {
- if (b < a)
- b = a;
- boost::uniform_int<> dist(a, b);
- boost::variate_generator >
- generate(random_generator, dist);
- return generate();
+std::size_t random_int(std::size_t a, std::size_t b)
+{
+ if (b < a)
+ b = a;
+ boost::uniform_int<> dist(a, b);
+ boost::variate_generator< boost::mt19937&, boost::uniform_int<> > generate(
+ random_generator, dist);
+ return generate();
}
// Generate a maze with a random assignment of barriers.
-void random_maze(maze& m) {
- vertices_size_type n = num_vertices(m.m_grid);
- vertex_descriptor s = m.source();
- vertex_descriptor g = m.goal();
- // One quarter of the cells in the maze should be barriers.
- int barriers = n/4;
- while (barriers > 0) {
- // Choose horizontal or vertical direction.
- std::size_t direction = random_int(0, 1);
- // Walls range up to one quarter the dimension length in this direction.
- vertices_size_type wall = random_int(1, m.length(direction)/4);
- // Create the wall while decrementing the total barrier count.
- vertex_descriptor u = vertex(random_int(0, n-1), m.m_grid);
- while (wall) {
- // Start and goal spaces should never be barriers.
- if (u != s && u != g) {
- wall--;
- if (!m.has_barrier(u)) {
- m.m_barriers.insert(u);
- barriers--;
+void random_maze(maze& m)
+{
+ vertices_size_type n = num_vertices(m.m_grid);
+ vertex_descriptor s = m.source();
+ vertex_descriptor g = m.goal();
+ // One quarter of the cells in the maze should be barriers.
+ int barriers = n / 4;
+ while (barriers > 0)
+ {
+ // Choose horizontal or vertical direction.
+ std::size_t direction = random_int(0, 1);
+ // Walls range up to one quarter the dimension length in this direction.
+ vertices_size_type wall = random_int(1, m.length(direction) / 4);
+ // Create the wall while decrementing the total barrier count.
+ vertex_descriptor u = vertex(random_int(0, n - 1), m.m_grid);
+ while (wall)
+ {
+ // Start and goal spaces should never be barriers.
+ if (u != s && u != g)
+ {
+ wall--;
+ if (!m.has_barrier(u))
+ {
+ m.m_barriers.insert(u);
+ barriers--;
+ }
+ }
+ vertex_descriptor v = m.m_grid.next(u, direction);
+ // Stop creating this wall if we reached the maze's edge.
+ if (u == v)
+ break;
+ u = v;
}
- }
- vertex_descriptor v = m.m_grid.next(u, direction);
- // Stop creating this wall if we reached the maze's edge.
- if (u == v)
- break;
- u = v;
}
- }
}
-int main (int argc, char const *argv[]) {
- // The default maze size is 20x10. A different size may be specified on
- // the command line.
- std::size_t x = 20;
- std::size_t y = 10;
-
- if (argc == 3) {
- x = boost::lexical_cast(argv[1]);
- y = boost::lexical_cast(argv[2]);
- }
-
- random_generator.seed(std::time(0));
- maze m(x, y);
- random_maze(m);
- if (m.solve())
- std::cout << "Solved the maze." << std::endl;
- else
- std::cout << "The maze is not solvable." << std::endl;
- std::cout << m << std::endl;
- return 0;
+int main(int argc, char const* argv[])
+{
+ // The default maze size is 20x10. A different size may be specified on
+ // the command line.
+ std::size_t x = 20;
+ std::size_t y = 10;
+
+ if (argc == 3)
+ {
+ x = boost::lexical_cast< std::size_t >(argv[1]);
+ y = boost::lexical_cast< std::size_t >(argv[2]);
+ }
+
+ random_generator.seed(std::time(0));
+ maze m(x, y);
+ random_maze(m);
+ if (m.solve())
+ std::cout << "Solved the maze." << std::endl;
+ else
+ std::cout << "The maze is not solvable." << std::endl;
+ std::cout << m << std::endl;
+ return 0;
}
diff --git a/example/bcsstk01.rsa b/example/bcsstk01.rsa
index 3d420ed47..428488786 100644
--- a/example/bcsstk01.rsa
+++ b/example/bcsstk01.rsa
@@ -1,11 +1,11 @@
1SYMMETRIC STIFFNESS MATRIX SMALL GENERALIZED EIGENVALUE PROBLEM BCSSTK01
- 74 4 14 56 0
-RSA 48 48 224 0
-(16I5) (16I5) (4E20.12)
+ 74 4 14 56 0
+RSA 48 48 224 0
+(16I5) (16I5) (4E20.12)
1 9 17 25 31 37 43 49 55 62 66 70 75 85 95 104
112 120 127 132 136 141 144 146 149 154 158 161 164 167 169 173
178 183 185 188 191 196 201 205 208 211 213 216 219 221 222 224
- 225
+ 225
1 5 6 7 11 19 25 30 2 4 6 8 10 20 24 26
3 4 5 9 21 23 27 28 4 8 10 22 27 28 5 7
11 21 23 29 6 12 20 24 25 30 7 11 12 13 31 36
diff --git a/example/bellman-example.cpp b/example/bellman-example.cpp
index e6ec87506..69bce6397 100644
--- a/example/bellman-example.cpp
+++ b/example/bellman-example.cpp
@@ -1,5 +1,5 @@
//=======================================================================
-// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -15,114 +15,120 @@
using namespace boost;
-template < typename Graph, typename ParentMap >
-struct edge_writer
+template < typename Graph, typename ParentMap > struct edge_writer
{
- edge_writer(const Graph & g, const ParentMap & p)
- : m_g(g), m_parent(p)
- {
- }
+ edge_writer(const Graph& g, const ParentMap& p) : m_g(g), m_parent(p) {}
- template < typename Edge >
- void operator() (std::ostream & out, const Edge & e) const
- {
- out << "[label=\"" << get(edge_weight, m_g, e) << "\"";
- typename graph_traits < Graph >::vertex_descriptor
- u = source(e, m_g), v = target(e, m_g);
- if (m_parent[v] == u)
- out << ", color=\"black\"";
- else
- out << ", color=\"grey\"";
- out << "]";
- }
- const Graph & m_g;
- ParentMap m_parent;
+ template < typename Edge >
+ void operator()(std::ostream& out, const Edge& e) const
+ {
+ out << "[label=\"" << get(edge_weight, m_g, e) << "\"";
+ typename graph_traits< Graph >::vertex_descriptor u = source(e, m_g),
+ v = target(e, m_g);
+ if (m_parent[v] == u)
+ out << ", color=\"black\"";
+ else
+ out << ", color=\"grey\"";
+ out << "]";
+ }
+ const Graph& m_g;
+ ParentMap m_parent;
};
template < typename Graph, typename Parent >
-edge_writer < Graph, Parent >
-make_edge_writer(const Graph & g, const Parent & p)
+edge_writer< Graph, Parent > make_edge_writer(const Graph& g, const Parent& p)
{
- return edge_writer < Graph, Parent > (g, p);
+ return edge_writer< Graph, Parent >(g, p);
}
-struct EdgeProperties {
- int weight;
+struct EdgeProperties
+{
+ int weight;
};
-int
-main()
+int main()
{
- enum { u, v, x, y, z, N };
- char name[] = { 'u', 'v', 'x', 'y', 'z' };
- typedef std::pair < int, int >E;
- const int n_edges = 10;
- E edge_array[] = { E(u, y), E(u, x), E(u, v), E(v, u),
- E(x, y), E(x, v), E(y, v), E(y, z), E(z, u), E(z,x) };
- int weight[n_edges] = { -4, 8, 5, -2, 9, -3, 7, 2, 6, 7 };
+ enum
+ {
+ u,
+ v,
+ x,
+ y,
+ z,
+ N
+ };
+ char name[] = { 'u', 'v', 'x', 'y', 'z' };
+ typedef std::pair< int, int > E;
+ const int n_edges = 10;
+ E edge_array[] = { E(u, y), E(u, x), E(u, v), E(v, u), E(x, y), E(x, v),
+ E(y, v), E(y, z), E(z, u), E(z, x) };
+ int weight[n_edges] = { -4, 8, 5, -2, 9, -3, 7, 2, 6, 7 };
- typedef adjacency_list < vecS, vecS, directedS,
- no_property, EdgeProperties> Graph;
+ typedef adjacency_list< vecS, vecS, directedS, no_property, EdgeProperties >
+ Graph;
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- // VC++ can't handle the iterator constructor
- Graph g(N);
- for (std::size_t j = 0; j < n_edges; ++j)
- add_edge(edge_array[j].first, edge_array[j].second, g);
+ // VC++ can't handle the iterator constructor
+ Graph g(N);
+ for (std::size_t j = 0; j < n_edges; ++j)
+ add_edge(edge_array[j].first, edge_array[j].second, g);
#else
- Graph g(edge_array, edge_array + n_edges, N);
+ Graph g(edge_array, edge_array + n_edges, N);
#endif
- graph_traits < Graph >::edge_iterator ei, ei_end;
- property_map::type
- weight_pmap = get(&EdgeProperties::weight, g);
- int i = 0;
- for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei, ++i)
- weight_pmap[*ei] = weight[i];
+ graph_traits< Graph >::edge_iterator ei, ei_end;
+ property_map< Graph, int EdgeProperties::* >::type weight_pmap
+ = get(&EdgeProperties::weight, g);
+ int i = 0;
+ for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei, ++i)
+ weight_pmap[*ei] = weight[i];
- std::vector distance(N, (std::numeric_limits < short >::max)());
- std::vector parent(N);
- for (i = 0; i < N; ++i)
- parent[i] = i;
- distance[z] = 0;
+ std::vector< int > distance(N, (std::numeric_limits< short >::max)());
+ std::vector< std::size_t > parent(N);
+ for (i = 0; i < N; ++i)
+ parent[i] = i;
+ distance[z] = 0;
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- bool r = bellman_ford_shortest_paths
- (g, int(N), weight_pmap, &parent[0], &distance[0],
- closed_plus(), std::less(), default_bellman_visitor());
+ bool r = bellman_ford_shortest_paths(g, int(N), weight_pmap, &parent[0],
+ &distance[0], closed_plus< int >(), std::less< int >(),
+ default_bellman_visitor());
#else
- bool r = bellman_ford_shortest_paths
- (g, int (N), weight_map(weight_pmap).distance_map(&distance[0]).
- predecessor_map(&parent[0]));
+ bool r = bellman_ford_shortest_paths(g, int(N),
+ weight_map(weight_pmap)
+ .distance_map(&distance[0])
+ .predecessor_map(&parent[0]));
#endif
- if (r)
- for (i = 0; i < N; ++i)
- std::cout << name[i] << ": " << std::setw(3) << distance[i]
- << " " << name[parent[i]] << std::endl;
- else
- std::cout << "negative cycle" << std::endl;
+ if (r)
+ for (i = 0; i < N; ++i)
+ std::cout << name[i] << ": " << std::setw(3) << distance[i] << " "
+ << name[parent[i]] << std::endl;
+ else
+ std::cout << "negative cycle" << std::endl;
- std::ofstream dot_file("figs/bellman-eg.dot");
- dot_file << "digraph D {\n"
- << " rankdir=LR\n"
- << " size=\"5,3\"\n"
- << " ratio=\"fill\"\n"
- << " edge[style=\"bold\"]\n" << " node[shape=\"circle\"]\n";
+ std::ofstream dot_file("figs/bellman-eg.dot");
+ dot_file << "digraph D {\n"
+ << " rankdir=LR\n"
+ << " size=\"5,3\"\n"
+ << " ratio=\"fill\"\n"
+ << " edge[style=\"bold\"]\n"
+ << " node[shape=\"circle\"]\n";
- {
- for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) {
- graph_traits < Graph >::edge_descriptor e = *ei;
- graph_traits < Graph >::vertex_descriptor
- u = source(e, g), v = target(e, g);
- // VC++ doesn't like the 3-argument get function, so here
- // we workaround by using 2-nested get()'s.
- dot_file << name[u] << " -> " << name[v]
- << "[label=\"" << get(get(&EdgeProperties::weight, g), e) << "\"";
- if (parent[v] == u)
- dot_file << ", color=\"black\"";
- else
- dot_file << ", color=\"grey\"";
- dot_file << "]";
+ {
+ for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+ {
+ graph_traits< Graph >::edge_descriptor e = *ei;
+ graph_traits< Graph >::vertex_descriptor u = source(e, g),
+ v = target(e, g);
+ // VC++ doesn't like the 3-argument get function, so here
+ // we workaround by using 2-nested get()'s.
+ dot_file << name[u] << " -> " << name[v] << "[label=\""
+ << get(get(&EdgeProperties::weight, g), e) << "\"";
+ if (parent[v] == u)
+ dot_file << ", color=\"black\"";
+ else
+ dot_file << ", color=\"grey\"";
+ dot_file << "]";
+ }
}
- }
- dot_file << "}";
- return EXIT_SUCCESS;
+ dot_file << "}";
+ return EXIT_SUCCESS;
}
diff --git a/example/bellman-ford-internet.cpp b/example/bellman-ford-internet.cpp
index 24bbfef4f..a761373d3 100644
--- a/example/bellman-ford-internet.cpp
+++ b/example/bellman-ford-internet.cpp
@@ -1,5 +1,5 @@
//=======================================================================
-// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -9,55 +9,62 @@
#include
#include
-int
-main()
+int main()
{
- using namespace boost;
- // ID numbers for the routers (vertices).
- enum
- { A, B, C, D, E, F, G, 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(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);
-
- // 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};
-
- // Declare some storage for some "external" vertex properties.
- char name[] = "ABCDEFGH";
- int parent[n_vertices];
- for (int i = 0; i < n_vertices; ++i)
- parent[i] = i;
- float distance[n_vertices];
- std::fill(distance, distance + n_vertices, (std::numeric_limits < float >::max)());
- // Specify A as the source vertex
- distance[A] = 0;
-
- bool r = bellman_ford_shortest_paths(g, int (n_vertices),
- weight_map(make_iterator_property_map
- (&delay[0],
- get(edge_index, g),
- delay[0])).
- distance_map(&distance[0]).
- predecessor_map(&parent[0]));
-
- if (r)
+ using namespace boost;
+ // ID numbers for the routers (vertices).
+ enum
+ {
+ A,
+ B,
+ C,
+ D,
+ E,
+ F,
+ G,
+ 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(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);
+
+ // 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 };
+
+ // Declare some storage for some "external" vertex properties.
+ char name[] = "ABCDEFGH";
+ int parent[n_vertices];
for (int i = 0; i < n_vertices; ++i)
- std::cout << name[i] << ": " << distance[i]
- << " " << name[parent[i]] << std::endl;
- else
- std::cout << "negative cycle" << std::endl;
+ parent[i] = i;
+ float distance[n_vertices];
+ std::fill(
+ distance, distance + n_vertices, (std::numeric_limits< float >::max)());
+ // Specify A as the source vertex
+ distance[A] = 0;
+
+ bool r = bellman_ford_shortest_paths(g, int(n_vertices),
+ weight_map(
+ make_iterator_property_map(&delay[0], get(edge_index, g), delay[0]))
+ .distance_map(&distance[0])
+ .predecessor_map(&parent[0]));
+
+ if (r)
+ for (int i = 0; i < n_vertices; ++i)
+ std::cout << name[i] << ": " << distance[i] << " "
+ << name[parent[i]] << std::endl;
+ else
+ std::cout << "negative cycle" << std::endl;
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
diff --git a/example/bfs-example.cpp b/example/bfs-example.cpp
index 0436204ce..c42bef153 100644
--- a/example/bfs-example.cpp
+++ b/example/bfs-example.cpp
@@ -1,5 +1,5 @@
//=======================================================================
-// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -13,72 +13,83 @@
#include
using namespace boost;
-template < typename TimeMap > class bfs_time_visitor:public default_bfs_visitor {
- typedef typename property_traits < TimeMap >::value_type T;
+template < typename TimeMap >
+class bfs_time_visitor : public default_bfs_visitor
+{
+ typedef typename property_traits< TimeMap >::value_type T;
+
public:
- bfs_time_visitor(TimeMap tmap, T & t):m_timemap(tmap), m_time(t) { }
- template < typename Vertex, typename Graph >
- void discover_vertex(Vertex u, const Graph & g) const
- {
- put(m_timemap, u, m_time++);
- }
- TimeMap m_timemap;
- T & m_time;
+ bfs_time_visitor(TimeMap tmap, T& t) : m_timemap(tmap), m_time(t) {}
+ template < typename Vertex, typename Graph >
+ void discover_vertex(Vertex u, const Graph& g) const
+ {
+ put(m_timemap, u, m_time++);
+ }
+ TimeMap m_timemap;
+ T& m_time;
};
-
-int
-main()
+int main()
{
- using namespace boost;
- // Select the graph type we wish to use
- typedef adjacency_list < vecS, vecS, undirectedS > graph_t;
- // Set up the vertex IDs and names
- enum { r, s, t, u, v, w, x, y, N };
- const char *name = "rstuvwxy";
- // Specify the edges in the graph
- typedef std::pair < int, int >E;
- E edge_array[] = { E(r, s), E(r, v), E(s, w), E(w, r), E(w, t),
- E(w, x), E(x, t), E(t, u), E(x, y), E(u, y)
- };
- // Create the graph object
- const int n_edges = sizeof(edge_array) / sizeof(E);
+ using namespace boost;
+ // Select the graph type we wish to use
+ typedef adjacency_list< vecS, vecS, undirectedS > graph_t;
+ // Set up the vertex IDs and names
+ enum
+ {
+ r,
+ s,
+ t,
+ u,
+ v,
+ w,
+ x,
+ y,
+ N
+ };
+ const char* name = "rstuvwxy";
+ // Specify the edges in the graph
+ typedef std::pair< int, int > E;
+ E edge_array[] = { E(r, s), E(r, v), E(s, w), E(w, r), E(w, t), E(w, x),
+ E(x, t), E(t, u), E(x, y), E(u, y) };
+ // Create the graph object
+ const int n_edges = sizeof(edge_array) / sizeof(E);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- // VC++ has trouble with the edge iterator constructor
- graph_t g(N);
- for (std::size_t j = 0; j < n_edges; ++j)
- add_edge(edge_array[j].first, edge_array[j].second, g);
+ // VC++ has trouble with the edge iterator constructor
+ graph_t g(N);
+ for (std::size_t j = 0; j < n_edges; ++j)
+ add_edge(edge_array[j].first, edge_array[j].second, g);
#else
- typedef graph_traits::vertices_size_type v_size_t;
- graph_t g(edge_array, edge_array + n_edges, v_size_t(N));
+ typedef graph_traits< graph_t >::vertices_size_type v_size_t;
+ graph_t g(edge_array, edge_array + n_edges, v_size_t(N));
#endif
- // Typedefs
- typedef graph_traits < graph_t >::vertices_size_type Size;
+ // Typedefs
+ typedef graph_traits< graph_t >::vertices_size_type Size;
- // a vector to hold the discover time property for each vertex
- std::vector < Size > dtime(num_vertices(g));
- typedef
- iterator_property_map::iterator,
- property_map::const_type>
- dtime_pm_type;
- dtime_pm_type dtime_pm(dtime.begin(), get(vertex_index, g));
+ // a vector to hold the discover time property for each vertex
+ std::vector< Size > dtime(num_vertices(g));
+ typedef iterator_property_map< std::vector< Size >::iterator,
+ property_map< graph_t, vertex_index_t >::const_type >
+ dtime_pm_type;
+ dtime_pm_type dtime_pm(dtime.begin(), get(vertex_index, g));
- Size time = 0;
- bfs_time_visitor < dtime_pm_type >vis(dtime_pm, time);
- breadth_first_search(g, vertex(s, g), visitor(vis));
+ Size time = 0;
+ bfs_time_visitor< dtime_pm_type > vis(dtime_pm, time);
+ breadth_first_search(g, vertex(s, g), visitor(vis));
- // Use std::sort to order the vertices by their discover time
- std::vector::vertices_size_type > discover_order(N);
- integer_range < int >range(0, N);
- std::copy(range.begin(), range.end(), discover_order.begin());
- std::sort(discover_order.begin(), discover_order.end(),
- indirect_cmp < dtime_pm_type, std::less < Size > >(dtime_pm));
+ // Use std::sort to order the vertices by their discover time
+ std::vector< graph_traits< graph_t >::vertices_size_type > discover_order(
+ N);
+ integer_range< int > range(0, N);
+ std::copy(range.begin(), range.end(), discover_order.begin());
+ std::sort(discover_order.begin(), discover_order.end(),
+ indirect_cmp< dtime_pm_type, std::less< Size > >(dtime_pm));
- std::cout << "order of discovery: ";
- for (int i = 0; i < N; ++i)
- std::cout << name[discover_order[i]] << " ";
- std::cout << std::endl;
+ std::cout << "order of discovery: ";
+ for (int i = 0; i < N; ++i)
+ std::cout << name[discover_order[i]] << " ";
+ std::cout << std::endl;
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
diff --git a/example/bfs-example2.cpp b/example/bfs-example2.cpp
index bc5d92abd..564c70313 100644
--- a/example/bfs-example2.cpp
+++ b/example/bfs-example2.cpp
@@ -1,5 +1,5 @@
//=======================================================================
-// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -14,95 +14,106 @@
#include
using namespace boost;
-template < typename TimeMap > class bfs_time_visitor:public default_bfs_visitor {
- typedef typename property_traits < TimeMap >::value_type T;
+template < typename TimeMap >
+class bfs_time_visitor : public default_bfs_visitor
+{
+ typedef typename property_traits< TimeMap >::value_type T;
+
public:
- bfs_time_visitor(TimeMap tmap, T & t):m_timemap(tmap), m_time(t) { }
- template < typename Vertex, typename Graph >
- void discover_vertex(Vertex u, const Graph & g) const
- {
- put(m_timemap, u, m_time++);
- }
- TimeMap m_timemap;
- T & m_time;
+ bfs_time_visitor(TimeMap tmap, T& t) : m_timemap(tmap), m_time(t) {}
+ template < typename Vertex, typename Graph >
+ void discover_vertex(Vertex u, const Graph& g) const
+ {
+ put(m_timemap, u, m_time++);
+ }
+ TimeMap m_timemap;
+ T& m_time;
};
-
-struct VertexProps {
- boost::default_color_type color;
- std::size_t discover_time;
- unsigned int index;
+struct VertexProps
+{
+ boost::default_color_type color;
+ std::size_t discover_time;
+ unsigned int index;
};
-int
-main()
+int main()
{
- using namespace boost;
- // Select the graph type we wish to use
- typedef adjacency_list < listS, listS, undirectedS,
- VertexProps> graph_t;
- // Set up the vertex IDs and names
- enum { r, s, t, u, v, w, x, y, N };
- const char *name = "rstuvwxy";
- // Specify the edges in the graph
- typedef std::pair < int, int >E;
- E edge_array[] = { E(r, s), E(r, v), E(s, w), E(w, r), E(w, t),
- E(w, x), E(x, t), E(t, u), E(x, y), E(u, y)
- };
- // Create the graph object
- const int n_edges = sizeof(edge_array) / sizeof(E);
+ using namespace boost;
+ // Select the graph type we wish to use
+ typedef adjacency_list< listS, listS, undirectedS, VertexProps > graph_t;
+ // Set up the vertex IDs and names
+ enum
+ {
+ r,
+ s,
+ t,
+ u,
+ v,
+ w,
+ x,
+ y,
+ N
+ };
+ const char* name = "rstuvwxy";
+ // Specify the edges in the graph
+ typedef std::pair< int, int > E;
+ E edge_array[] = { E(r, s), E(r, v), E(s, w), E(w, r), E(w, t), E(w, x),
+ E(x, t), E(t, u), E(x, y), E(u, y) };
+ // Create the graph object
+ const int n_edges = sizeof(edge_array) / sizeof(E);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
- // VC++ has trouble with the edge iterator constructor
- graph_t g;
- std::vector::vertex_descriptor> verts;
- for (std::size_t i = 0; i < N; ++i)
- verts.push_back(add_vertex(g));
- for (std::size_t j = 0; j < n_edges; ++j)
- add_edge(verts[edge_array[j].first], verts[edge_array[j].second], g);
+ // VC++ has trouble with the edge iterator constructor
+ graph_t g;
+ std::vector< graph_traits< graph_t >::vertex_descriptor > verts;
+ for (std::size_t i = 0; i < N; ++i)
+ verts.push_back(add_vertex(g));
+ for (std::size_t j = 0; j < n_edges; ++j)
+ add_edge(verts[edge_array[j].first], verts[edge_array[j].second], g);
#else
- typedef graph_traits::vertices_size_type v_size_t;
- graph_t g(edge_array, edge_array + n_edges, v_size_t(N));
+ typedef graph_traits< graph_t >::vertices_size_type v_size_t;
+ graph_t g(edge_array, edge_array + n_edges, v_size_t(N));
#endif
- // Typedefs
- typedef graph_traits::vertices_size_type Size;
+ // Typedefs
+ typedef graph_traits< graph_t >::vertices_size_type Size;
- Size time = 0;
- typedef property_map::type dtime_map_t;
- dtime_map_t dtime_map = get(&VertexProps::discover_time, g);
- bfs_time_visitor < dtime_map_t > vis(dtime_map, time);
- breadth_first_search(g, vertex(s, g), color_map(get(&VertexProps::color, g)).
- visitor(vis));
+ Size time = 0;
+ typedef property_map< graph_t, std::size_t VertexProps::* >::type
+ dtime_map_t;
+ dtime_map_t dtime_map = get(&VertexProps::discover_time, g);
+ bfs_time_visitor< dtime_map_t > vis(dtime_map, time);
+ breadth_first_search(
+ g, vertex(s, g), color_map(get(&VertexProps::color, g)).visitor(vis));
- // a vector to hold the discover time property for each vertex
- std::vector < Size > dtime(num_vertices(g));
- typedef
- iterator_property_map::iterator,
- property_map::type>
- dtime_pm_type;
- graph_traits::vertex_iterator vi, vi_end;
- std::size_t c = 0;
- for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi, ++c) {
- dtime[c] = dtime_map[*vi];
- put(&VertexProps::index, g, *vi, c);
- }
- dtime_pm_type dtime_pm(dtime.begin(), get(&VertexProps::index, g));
+ // a vector to hold the discover time property for each vertex
+ std::vector< Size > dtime(num_vertices(g));
+ typedef iterator_property_map< std::vector< Size >::iterator,
+ property_map< graph_t, unsigned int VertexProps::* >::type >
+ dtime_pm_type;
+ graph_traits< graph_t >::vertex_iterator vi, vi_end;
+ std::size_t c = 0;
+ for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi, ++c)
+ {
+ dtime[c] = dtime_map[*vi];
+ put(&VertexProps::index, g, *vi, c);
+ }
+ dtime_pm_type dtime_pm(dtime.begin(), get(&VertexProps::index, g));
- // Use std::sort to order the vertices by their discover time
- std::vector::vertices_size_type > discover_order(N);
- integer_range < int >range(0, N);
- std::copy(range.begin(), range.end(), discover_order.begin());
- std::sort(discover_order.begin(), discover_order.end(),
- make_indirect_cmp(
- std::less(),
- make_iterator_property_map(
- dtime.begin(),
- typed_identity_property_map())));
+ // Use std::sort to order the vertices by their discover time
+ std::vector< graph_traits< graph_t >::vertices_size_type > discover_order(
+ N);
+ integer_range< int > range(0, N);
+ std::copy(range.begin(), range.end(), discover_order.begin());
+ std::sort(discover_order.begin(), discover_order.end(),
+ make_indirect_cmp(std::less< Size >(),
+ make_iterator_property_map(
+ dtime.begin(), typed_identity_property_map< std::size_t >())));
- std::cout << "order of discovery: ";
- for (int i = 0; i < N; ++i)
- std::cout << name[discover_order[i]] << " ";
- std::cout << std::endl;
+ std::cout << "order of discovery: ";
+ for (int i = 0; i < N; ++i)
+ std::cout << name[discover_order[i]] << " ";
+ std::cout << std::endl;
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
diff --git a/example/bfs-name-printer.cpp b/example/bfs-name-printer.cpp
index aab408d90..bc0da3bc3 100644
--- a/example/bfs-name-printer.cpp
+++ b/example/bfs-name-printer.cpp
@@ -1,5 +1,5 @@
//=======================================================================
-// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -12,83 +12,81 @@
#include
using namespace boost;
-template
-void
-build_router_network(Graph & g, VertexNameMap name_map,
- TransDelayMap delay_map)
+template < typename Graph, typename VertexNameMap, typename TransDelayMap >
+void build_router_network(
+ Graph& g, VertexNameMap name_map, TransDelayMap delay_map)
{
- typename graph_traits < Graph >::vertex_descriptor a, b, c, d, e;
- a = add_vertex(g);
- name_map[a] = 'a';
- b = add_vertex(g);
- name_map[b] = 'b';
- c = add_vertex(g);
- name_map[c] = 'c';
- d = add_vertex(g);
- name_map[d] = 'd';
- e = add_vertex(g);
- name_map[e] = 'e';
+ typename graph_traits< Graph >::vertex_descriptor a, b, c, d, e;
+ a = add_vertex(g);
+ name_map[a] = 'a';
+ b = add_vertex(g);
+ name_map[b] = 'b';
+ c = add_vertex(g);
+ name_map[c] = 'c';
+ d = add_vertex(g);
+ name_map[d] = 'd';
+ e = add_vertex(g);
+ name_map[e] = 'e';
- typename graph_traits::edge_descriptor ed;
- bool inserted;
+ typename graph_traits< Graph >::edge_descriptor ed;
+ bool inserted;
- boost::tie(ed, inserted) = add_edge(a, b, g);
- delay_map[ed] = 1.2;
- boost::tie(ed, inserted) = add_edge(a, d, g);
- delay_map[ed] = 4.5;
- boost::tie(ed, inserted) = add_edge(b, d, g);
- delay_map[ed] = 1.8;
- boost::tie(ed, inserted) = add_edge(c, a, g);
- delay_map[ed] = 2.6;
- boost::tie(ed, inserted) = add_edge(c, e, g);
- delay_map[ed] = 5.2;
- boost::tie(ed, inserted) = add_edge(d, c, g);
- delay_map[ed] = 0.4;
- boost::tie(ed, inserted) = add_edge(d, e, g);
- delay_map[ed] = 3.3;
+ boost::tie(ed, inserted) = add_edge(a, b, g);
+ delay_map[ed] = 1.2;
+ boost::tie(ed, inserted) = add_edge(a, d, g);
+ delay_map[ed] = 4.5;
+ boost::tie(ed, inserted) = add_edge(b, d, g);
+ delay_map[ed] = 1.8;
+ boost::tie(ed, inserted) = add_edge(c, a, g);
+ delay_map[ed] = 2.6;
+ boost::tie(ed, inserted) = add_edge(c, e, g);
+ delay_map[ed] = 5.2;
+ boost::tie(ed, inserted) = add_edge(d, c, g);
+ delay_map[ed] = 0.4;
+ boost::tie(ed, inserted) = add_edge(d, e, g);
+ delay_map[ed] = 3.3;
}
-
-template
-class bfs_name_printer : public default_bfs_visitor {
- // inherit default (empty) event point actions
+template < typename VertexNameMap >
+class bfs_name_printer : public default_bfs_visitor
+{
+ // inherit default (empty) event point actions
public:
- bfs_name_printer(VertexNameMap n_map) : m_name_map(n_map) {
- }
- template
- void discover_vertex(Vertex u, const Graph &) const
- {
- std::cout << get(m_name_map, u) << ' ';
- }
+ bfs_name_printer(VertexNameMap n_map) : m_name_map(n_map) {}
+ template < typename Vertex, typename Graph >
+ void discover_vertex(Vertex u, const Graph&) const
+ {
+ std::cout << get(m_name_map, u) << ' ';
+ }
+
private:
- VertexNameMap m_name_map;
+ VertexNameMap m_name_map;
};
-struct VP {
- char name;
+struct VP
+{
+ char name;
};
-struct EP {
- double weight;
+struct EP
+{
+ double weight;
};
-
-int
-main()
+int main()
{
- typedef adjacency_list < listS, vecS, directedS, VP, EP> graph_t;
- graph_t g;
-
- property_map::type name_map = get(&VP::name, g);
- property_map::type delay_map = get(&EP::weight, g);
+ typedef adjacency_list< listS, vecS, directedS, VP, EP > graph_t;
+ graph_t g;
- build_router_network(g, name_map, delay_map);
+ property_map< graph_t, char VP::* >::type name_map = get(&VP::name, g);
+ property_map< graph_t, double EP::* >::type delay_map = get(&EP::weight, g);
- typedef property_map::type VertexNameMap;
- graph_traits::vertex_descriptor a = *vertices(g).first;
- bfs_name_printer vis(name_map);
- std::cout << "BFS vertex discover order: ";
- breadth_first_search(g, a, visitor(vis));
- std::cout << std::endl;
+ build_router_network(g, name_map, delay_map);
+ typedef property_map< graph_t, char VP::* >::type VertexNameMap;
+ graph_traits< graph_t >::vertex_descriptor a = *vertices(g).first;
+ bfs_name_printer< VertexNameMap > vis(name_map);
+ std::cout << "BFS vertex discover order: ";
+ breadth_first_search(g, a, visitor(vis));
+ std::cout << std::endl;
}
diff --git a/example/bfs.cpp b/example/bfs.cpp
index 1f34c1552..1c9ddc5d7 100644
--- a/example/bfs.cpp
+++ b/example/bfs.cpp
@@ -21,7 +21,7 @@
#include
/*
-
+
This examples shows how to use the breadth_first_search() GGCL
algorithm, specifically the 3 argument variant of bfs that assumes
the graph has a color property (property) stored internally.
@@ -37,17 +37,17 @@
Sample Output:
- 0 --> 2
- 1 --> 1 3 4
- 2 --> 1 3 4
- 3 --> 1 4
- 4 --> 0 1
- 0 --> 2
- 1 --> 1 3 4
- 2 --> 1 3 4
- 3 --> 1 4
- 4 --> 0 1
- distances: 0 2 1 2 2
+ 0 --> 2
+ 1 --> 1 3 4
+ 2 --> 1 3 4
+ 3 --> 1 4
+ 4 --> 0 1
+ 0 --> 2
+ 1 --> 1 3 4
+ 2 --> 1 3 4
+ 3 --> 1 4
+ 4 --> 0 1
+ distances: 0 2 1 2 2
parent[0] = 0
parent[1] = 2
parent[2] = 0
@@ -56,105 +56,104 @@
*/
-template
-struct print_parent {
- print_parent(const ParentDecorator& p_) : p(p_) { }
- template
- void operator()(const Vertex& v) const {
- std::cout << "parent[" << v << "] = " << p[v] << std::endl;
- }
- ParentDecorator p;
+template < class ParentDecorator > struct print_parent
+{
+ print_parent(const ParentDecorator& p_) : p(p_) {}
+ template < class Vertex > void operator()(const Vertex& v) const
+ {
+ std::cout << "parent[" << v << "] = " << p[v] << std::endl;
+ }
+ ParentDecorator p;
};
-
-template
-struct graph_copier
- : public boost::base_visitor >
+template < class NewGraph, class Tag >
+struct graph_copier
+: public boost::base_visitor< graph_copier< NewGraph, Tag > >
{
- typedef Tag event_filter;
+ typedef Tag event_filter;
- graph_copier(NewGraph& graph) : new_g(graph) { }
+ graph_copier(NewGraph& graph) : new_g(graph) {}
+
+ template < class Edge, class Graph > void operator()(Edge e, Graph& g)
+ {
+ boost::add_edge(boost::source(e, g), boost::target(e, g), new_g);
+ }
- template
- void operator()(Edge e, Graph& g) {
- boost::add_edge(boost::source(e, g), boost::target(e, g), new_g);
- }
private:
- NewGraph& new_g;
+ NewGraph& new_g;
};
-template
-inline graph_copier
-copy_graph(NewGraph& g, Tag) {
- return graph_copier(g);
+template < class NewGraph, class Tag >
+inline graph_copier< NewGraph, Tag > copy_graph(NewGraph& g, Tag)
+{
+ return graph_copier< NewGraph, Tag >(g);
}
-int main(int , char* [])
+int main(int, char*[])
{
- typedef boost::adjacency_list<
- boost::mapS, boost::vecS, boost::bidirectionalS,
- boost::property > > >
- > Graph;
-
- Graph G(5);
- boost::add_edge(0, 2, G);
- boost::add_edge(1, 1, G);
- boost::add_edge(1, 3, G);
- boost::add_edge(1, 4, G);
- boost::add_edge(2, 1, G);
- boost::add_edge(2, 3, G);
- boost::add_edge(2, 4, G);
- boost::add_edge(3, 1, G);
- boost::add_edge(3, 4, G);
- boost::add_edge(4, 0, G);
- boost::add_edge(4, 1, G);
-
- typedef Graph::vertex_descriptor Vertex;
-
- Graph G_copy(5);
- // Array to store predecessor (parent) of each vertex. This will be
- // used as a Decorator (actually, its iterator will be).
- std::vector p(boost::num_vertices(G));
- // VC++ version of std::vector has no ::pointer, so
- // I use ::value_type* instead.
- typedef std::vector::value_type* Piter;
-
- // Array to store distances from the source to each vertex . We use
- // a built-in array here just for variety. This will also be used as
- // a Decorator.
- boost::graph_traits::vertices_size_type d[5];
- std::fill_n(d, 5, 0);
-
- // The source vertex
- Vertex s = *(boost::vertices(G).first);
- p[s] = s;
- boost::breadth_first_search
- (G, s,
- boost::visitor(boost::make_bfs_visitor
- (std::make_pair(boost::record_distances(d, boost::on_tree_edge()),
- std::make_pair
- (boost::record_predecessors(&p[0],
- boost::on_tree_edge()),
- copy_graph(G_copy, boost::on_examine_edge())))) ));
-
- boost::print_graph(G);
- boost::print_graph(G_copy);
-
- if (boost::num_vertices(G) < 11) {
- std::cout << "distances: ";
+ typedef boost::adjacency_list< boost::mapS, boost::vecS,
+ boost::bidirectionalS,
+ boost::property< boost::vertex_color_t, boost::default_color_type,
+ boost::property< boost::vertex_degree_t, int,
+ boost::property< boost::vertex_in_degree_t, int,
+ boost::property< boost::vertex_out_degree_t, int > > > > >
+ Graph;
+
+ Graph G(5);
+ boost::add_edge(0, 2, G);
+ boost::add_edge(1, 1, G);
+ boost::add_edge(1, 3, G);
+ boost::add_edge(1, 4, G);
+ boost::add_edge(2, 1, G);
+ boost::add_edge(2, 3, G);
+ boost::add_edge(2, 4, G);
+ boost::add_edge(3, 1, G);
+ boost::add_edge(3, 4, G);
+ boost::add_edge(4, 0, G);
+ boost::add_edge(4, 1, G);
+
+ typedef Graph::vertex_descriptor Vertex;
+
+ Graph G_copy(5);
+ // Array to store predecessor (parent) of each vertex. This will be
+ // used as a Decorator (actually, its iterator will be).
+ std::vector< Vertex > p(boost::num_vertices(G));
+ // VC++ version of std::vector has no ::pointer, so
+ // I use ::value_type* instead.
+ typedef std::vector< Vertex >::value_type* Piter;
+
+ // Array to store distances from the source to each vertex . We use
+ // a built-in array here just for variety. This will also be used as
+ // a Decorator.
+ boost::graph_traits< Graph >::vertices_size_type d[5];
+ std::fill_n(d, 5, 0);
+
+ // The source vertex
+ Vertex s = *(boost::vertices(G).first);
+ p[s] = s;
+ boost::breadth_first_search(G, s,
+ boost::visitor(boost::make_bfs_visitor(
+ std::make_pair(boost::record_distances(d, boost::on_tree_edge()),
+ std::make_pair(
+ boost::record_predecessors(&p[0], boost::on_tree_edge()),
+ copy_graph(G_copy, boost::on_examine_edge()))))));
+
+ boost::print_graph(G);
+ boost::print_graph(G_copy);
+
+ if (boost::num_vertices(G) < 11)
+ {
+ std::cout << "distances: ";
#ifdef BOOST_OLD_STREAM_ITERATORS
- std::copy(d, d + 5, std::ostream_iterator(std::cout, " "));
+ std::copy(d, d + 5, std::ostream_iterator< int, char >(std::cout, " "));
#else
- std::copy(d, d + 5, std::ostream_iterator(std::cout, " "));
+ std::copy(d, d + 5, std::ostream_iterator< int >(std::cout, " "));
#endif
- std::cout << std::endl;
+ std::cout << std::endl;
- std::for_each(boost::vertices(G).first, boost::vertices(G).second,
- print_parent(&p[0]));
- }
+ std::for_each(boost::vertices(G).first, boost::vertices(G).second,
+ print_parent< Piter >(&p[0]));
+ }
- return 0;
+ return 0;
}
diff --git a/example/bfs.expected b/example/bfs.expected
index c58f0fb31..825341197 100644
--- a/example/bfs.expected
+++ b/example/bfs.expected
@@ -1,14 +1,14 @@
-0 --> 2
-1 --> 1 3 4
-2 --> 1 3 4
-3 --> 1 4
-4 --> 0 1
-0 --> 2
-1 --> 1 3 4
-2 --> 1 3 4
-3 --> 1 4
-4 --> 0 1
-distances: 0 2 1 2 2
+0 --> 2
+1 --> 1 3 4
+2 --> 1 3 4
+3 --> 1 4
+4 --> 0 1
+0 --> 2
+1 --> 1 3 4
+2 --> 1 3 4
+3 --> 1 4
+4 --> 0 1
+distances: 0 2 1 2 2
parent[0] = 0
parent[1] = 2
parent[2] = 0
diff --git a/example/bfs_basics.expected b/example/bfs_basics.expected
index 6fc6c2dbd..4a914d1ff 100644
--- a/example/bfs_basics.expected
+++ b/example/bfs_basics.expected
@@ -1,2 +1,2 @@
-order of discovery: s r w v t x u y
-order of finish: s r w v t x u y
+order of discovery: s r w v t x u y
+order of finish: s r w v t x u y
diff --git a/example/bfs_neighbor.cpp b/example/bfs_neighbor.cpp
index 050362f60..7beb9fa5d 100644
--- a/example/bfs_neighbor.cpp
+++ b/example/bfs_neighbor.cpp
@@ -21,7 +21,7 @@
#include
/*
-
+
This examples shows how to use the breadth_first_search() GGCL
algorithm, specifically the 3 argument variant of bfs that assumes
the graph has a color property (property) stored internally.
@@ -37,12 +37,12 @@
Sample Output:
- 0 --> 2
- 1 --> 1 3 4
- 2 --> 1 3 4
- 3 --> 1 4
- 4 --> 0 1
- distances: 1 2 1 2 0
+ 0 --> 2
+ 1 --> 1 3 4
+ 2 --> 1 3 4
+ 3 --> 1 4
+ 4 --> 0 1
+ distances: 1 2 1 2 0
parent[0] = 4
parent[1] = 2
parent[2] = 0
@@ -51,101 +51,100 @@
*/
-template
-struct print_parent {
- print_parent(const ParentDecorator& p_) : p(p_) { }
- template
- void operator()(const Vertex& v) const {
- std::cout << "parent[" << v << "] = " << p[v] << std::endl;
- }
- ParentDecorator p;
+template < class ParentDecorator > struct print_parent
+{
+ print_parent(const ParentDecorator& p_) : p(p_) {}
+ template < class Vertex > void operator()(const Vertex& v) const
+ {
+ std::cout << "parent[" << v << "] = " << p[v] << std::endl;
+ }
+ ParentDecorator p;
};
-
-template
-struct graph_copier
- : public boost::base_visitor >
+template < class NewGraph, class Tag >
+struct graph_copier
+: public boost::base_visitor< graph_copier< NewGraph, Tag > >
{
- typedef Tag event_filter;
+ typedef Tag event_filter;
- graph_copier(NewGraph& graph) : new_g(graph) { }
+ graph_copier(NewGraph& graph) : new_g(graph) {}
+
+ template < class Edge, class Graph > void operator()(Edge e, Graph& g)
+ {
+ boost::add_edge(boost::source(e, g), boost::target(e, g), new_g);
+ }
- template
- void operator()(Edge e, Graph& g) {
- boost::add_edge(boost::source(e, g), boost::target(e, g), new_g);
- }
private:
- NewGraph& new_g;
+ NewGraph& new_g;
};
-template
-inline graph_copier
-copy_graph(NewGraph& g, Tag) {
- return graph_copier(g);
+template < class NewGraph, class Tag >
+inline graph_copier< NewGraph, Tag > copy_graph(NewGraph& g, Tag)
+{
+ return graph_copier< NewGraph, Tag >(g);
}
-int main(int , char* [])
+int main(int, char*[])
{
- typedef boost::adjacency_list<
- boost::mapS, boost::vecS, boost::bidirectionalS,
- boost::property > > >
- > Graph;
-
- Graph G(5);
- boost::add_edge(0, 2, G);
- boost::add_edge(1, 1, G);
- boost::add_edge(1, 3, G);
- boost::add_edge(1, 4, G);
- boost::add_edge(2, 1, G);
- boost::add_edge(2, 3, G);
- boost::add_edge(2, 4, G);
- boost::add_edge(3, 1, G);
- boost::add_edge(3, 4, G);
- boost::add_edge(4, 0, G);
- boost::add_edge(4, 1, G);
-
- typedef Graph::vertex_descriptor Vertex;
-
- // Array to store predecessor (parent) of each vertex. This will be
- // used as a Decorator (actually, its iterator will be).
- std::vector p(boost::num_vertices(G));
- // VC++ version of std::vector has no ::pointer, so
- // I use ::value_type* instead.
- typedef std::vector::value_type* Piter;
-
- // Array to store distances from the source to each vertex . We use
- // a built-in array here just for variety. This will also be used as
- // a Decorator.
- boost::graph_traits::vertices_size_type d[5];
- std::fill_n(d, 5, 0);
-
- // The source vertex
- Vertex s = *(boost::vertices(G).first);
- p[s] = s;
- boost::neighbor_breadth_first_search
- (G, s,
- boost::visitor(boost::make_neighbor_bfs_visitor
- (std::make_pair(boost::record_distances(d, boost::on_tree_edge()),
- boost::record_predecessors(&p[0],
- boost::on_tree_edge())))));
-
- boost::print_graph(G);
-
- if (boost::num_vertices(G) < 11) {
- std::cout << "distances: ";
+ typedef boost::adjacency_list< boost::mapS, boost::vecS,
+ boost::bidirectionalS,
+ boost::property< boost::vertex_color_t, boost::default_color_type,
+ boost::property< boost::vertex_degree_t, int,
+ boost::property< boost::vertex_in_degree_t, int,
+ boost::property< boost::vertex_out_degree_t, int > > > > >
+ Graph;
+
+ Graph G(5);
+ boost::add_edge(0, 2, G);
+ boost::add_edge(1, 1, G);
+ boost::add_edge(1, 3, G);
+ boost::add_edge(1, 4, G);
+ boost::add_edge(2, 1, G);
+ boost::add_edge(2, 3, G);
+ boost::add_edge(2, 4, G);
+ boost::add_edge(3, 1, G);
+ boost::add_edge(3, 4, G);
+ boost::add_edge(4, 0, G);
+ boost::add_edge(4, 1, G);
+
+ typedef Graph::vertex_descriptor Vertex;
+
+ // Array to store predecessor (parent) of each vertex. This will be
+ // used as a Decorator (actually, its iterator will be).
+ std::vector< Vertex > p(boost::num_vertices(G));
+ // VC++ version of std::vector has no ::pointer, so
+ // I use ::value_type* instead.
+ typedef std::vector< Vertex >::value_type* Piter;
+
+ // Array to store distances from the source to each vertex . We use
+ // a built-in array here just for variety. This will also be used as
+ // a Decorator.
+ boost::graph_traits< Graph >::vertices_size_type d[5];
+ std::fill_n(d, 5, 0);
+
+ // The source vertex
+ Vertex s = *(boost::vertices(G).first);
+ p[s] = s;
+ boost::neighbor_breadth_first_search(G, s,
+ boost::visitor(boost::make_neighbor_bfs_visitor(
+ std::make_pair(boost::record_distances(d, boost::on_tree_edge()),
+ boost::record_predecessors(&p[0], boost::on_tree_edge())))));
+
+ boost::print_graph(G);
+
+ if (boost::num_vertices(G) < 11)
+ {
+ std::cout << "distances: ";
#ifdef BOOST_OLD_STREAM_ITERATORS
- std::copy(d, d + 5, std::ostream_iterator(std::cout, " "));
+ std::copy(d, d + 5, std::ostream_iterator< int, char >(std::cout, " "));
#else
- std::copy(d, d + 5, std::ostream_iterator(std::cout, " "));
+ std::copy(d, d + 5, std::ostream_iterator< int >(std::cout, " "));
#endif
- std::cout << std::endl;
+ std::cout << std::endl;
- std::for_each(boost::vertices(G).first, boost::vertices(G).second,
- print_parent(&p[0]));
- }
+ std::for_each(boost::vertices(G).first, boost::vertices(G).second,
+ print_parent< Piter >(&p[0]));
+ }
- return 0;
+ return 0;
}
diff --git a/example/biconnected_components.cpp b/example/biconnected_components.cpp
index 0406dcbab..8c1b58946 100644
--- a/example/biconnected_components.cpp
+++ b/example/biconnected_components.cpp
@@ -1,5 +1,5 @@
//=======================================================================
-// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -15,59 +15,61 @@
namespace boost
{
- struct edge_component_t
- {
+struct edge_component_t
+{
enum
- { num = 555 };
+ {
+ num = 555
+ };
typedef edge_property_tag kind;
- }
- edge_component;
+} edge_component;
}
-int
-main()
+int main()
{
- using namespace boost;
- typedef adjacency_list < vecS, vecS, undirectedS,
- no_property, property < edge_component_t, std::size_t > >graph_t;
- typedef graph_traits < graph_t >::vertex_descriptor vertex_t;
- graph_t g(9);
- add_edge(0, 5, g);
- add_edge(0, 1, g);
- add_edge(0, 6, g);
- add_edge(1, 2, g);
- add_edge(1, 3, g);
- add_edge(1, 4, g);
- add_edge(2, 3, g);
- add_edge(4, 5, g);
- add_edge(6, 8, g);
- add_edge(6, 7, g);
- add_edge(7, 8, g);
+ using namespace boost;
+ typedef adjacency_list< vecS, vecS, undirectedS, no_property,
+ property< edge_component_t, std::size_t > >
+ graph_t;
+ typedef graph_traits< graph_t >::vertex_descriptor vertex_t;
+ graph_t g(9);
+ add_edge(0, 5, g);
+ add_edge(0, 1, g);
+ add_edge(0, 6, g);
+ add_edge(1, 2, g);
+ add_edge(1, 3, g);
+ add_edge(1, 4, g);
+ add_edge(2, 3, g);
+ add_edge(4, 5, g);
+ add_edge(6, 8, g);
+ add_edge(6, 7, g);
+ add_edge(7, 8, g);
- property_map < graph_t, edge_component_t >::type
- component = get(edge_component, g);
+ property_map< graph_t, edge_component_t >::type component
+ = get(edge_component, g);
- std::size_t num_comps = biconnected_components(g, component);
- std::cerr << "Found " << num_comps << " biconnected components.\n";
+ std::size_t num_comps = biconnected_components(g, component);
+ std::cerr << "Found " << num_comps << " biconnected components.\n";
- std::vector art_points;
- articulation_points(g, std::back_inserter(art_points));
- std::cerr << "Found " << art_points.size() << " articulation points.\n";
+ std::vector< vertex_t > art_points;
+ articulation_points(g, std::back_inserter(art_points));
+ std::cerr << "Found " << art_points.size() << " articulation points.\n";
- std::cout << "graph A {\n" << " node[shape=\"circle\"]\n";
+ std::cout << "graph A {\n"
+ << " node[shape=\"circle\"]\n";
- for (std::size_t i = 0; i < art_points.size(); ++i) {
- std::cout << (char)(art_points[i] + 'A')
- << " [ style=\"filled\", fillcolor=\"red\" ];"
- << std::endl;
- }
+ for (std::size_t i = 0; i < art_points.size(); ++i)
+ {
+ std::cout << (char)(art_points[i] + 'A')
+ << " [ style=\"filled\", fillcolor=\"red\" ];" << std::endl;
+ }
- graph_traits < graph_t >::edge_iterator ei, ei_end;
- for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
- std::cout << (char)(source(*ei, g) + 'A') << " -- "
- << (char)(target(*ei, g) + 'A')
- << "[label=\"" << component[*ei] << "\"]\n";
- std::cout << "}\n";
+ graph_traits< graph_t >::edge_iterator ei, ei_end;
+ for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+ std::cout << (char)(source(*ei, g) + 'A') << " -- "
+ << (char)(target(*ei, g) + 'A') << "[label=\""
+ << component[*ei] << "\"]\n";
+ std::cout << "}\n";
- return 0;
+ return 0;
}
diff --git a/example/bipartite_example.cpp b/example/bipartite_example.cpp
index c8e62ad26..99ac316ff 100644
--- a/example/bipartite_example.cpp
+++ b/example/bipartite_example.cpp
@@ -18,98 +18,108 @@ using namespace boost;
/// Example to test for bipartiteness and print the certificates.
-template
-void print_bipartite (const Graph& g)
+template < typename Graph > void print_bipartite(const Graph& g)
{
- typedef graph_traits traits;
- typename traits::vertex_iterator vertex_iter, vertex_end;
+ typedef graph_traits< Graph > traits;
+ typename traits::vertex_iterator vertex_iter, vertex_end;
- /// Most simple interface just tests for bipartiteness.
+ /// Most simple interface just tests for bipartiteness.
- bool bipartite = is_bipartite (g);
+ bool bipartite = is_bipartite(g);
- if (bipartite)
- {
- typedef std::vector partition_t;
- typedef typename property_map ::type index_map_t;
- typedef iterator_property_map partition_map_t;
-
- partition_t partition (num_vertices (g));
- partition_map_t partition_map (partition.begin (), get (vertex_index, g));
-
- /// A second interface yields a bipartition in a color map, if the graph is bipartite.
-
- is_bipartite (g, get (vertex_index, g), partition_map);
-
- for (boost::tie (vertex_iter, vertex_end) = vertices (g); vertex_iter != vertex_end; ++vertex_iter)
+ if (bipartite)
{
- std::cout << "Vertex " << *vertex_iter << " has color " << (get (partition_map, *vertex_iter) == color_traits <
- default_color_type>::white () ? "white" : "black") << std::endl;
+ typedef std::vector< default_color_type > partition_t;
+ typedef
+ typename property_map< Graph, vertex_index_t >::type index_map_t;
+ typedef iterator_property_map< partition_t::iterator, index_map_t >
+ partition_map_t;
+
+ partition_t partition(num_vertices(g));
+ partition_map_t partition_map(partition.begin(), get(vertex_index, g));
+
+ /// A second interface yields a bipartition in a color map, if the graph
+ /// is bipartite.
+
+ is_bipartite(g, get(vertex_index, g), partition_map);
+
+ for (boost::tie(vertex_iter, vertex_end) = vertices(g);
+ vertex_iter != vertex_end; ++vertex_iter)
+ {
+ std::cout
+ << "Vertex " << *vertex_iter << " has color "
+ << (get(partition_map, *vertex_iter)
+ == color_traits< default_color_type >::white()
+ ? "white"
+ : "black")
+ << std::endl;
+ }
}
- }
- else
- {
- typedef std::vector vertex_vector_t;
- vertex_vector_t odd_cycle;
+ else
+ {
+ typedef std::vector< typename traits::vertex_descriptor >
+ vertex_vector_t;
+ vertex_vector_t odd_cycle;
- /// A third interface yields an odd-cycle if the graph is not bipartite.
+ /// A third interface yields an odd-cycle if the graph is not bipartite.
- find_odd_cycle (g, get (vertex_index, g), std::back_inserter (odd_cycle));
+ find_odd_cycle(g, get(vertex_index, g), std::back_inserter(odd_cycle));
- std::cout << "Odd cycle consists of the vertices:";
- for (size_t i = 0; i < odd_cycle.size (); ++i)
- {
- std::cout << " " << odd_cycle[i];
+ std::cout << "Odd cycle consists of the vertices:";
+ for (size_t i = 0; i < odd_cycle.size(); ++i)
+ {
+ std::cout << " " << odd_cycle[i];
+ }
+ std::cout << std::endl;
}
- std::cout << std::endl;
- }
}
-int main (int argc, char **argv)
+int main(int argc, char** argv)
{
- typedef adjacency_list vector_graph_t;
- typedef std::pair E;
-
- /**
- * Create the graph drawn below.
- *
- * 0 - 1 - 2
- * | |
- * 3 - 4 - 5 - 6
- * / \ /
- * | 7
- * | |
- * 8 - 9 - 10
- **/
-
- E bipartite_edges[] = { E (0, 1), E (0, 4), E (1, 2), E (2, 6), E (3, 4), E (3, 8), E (4, 5), E (4, 7), E (5, 6), E (
- 6, 7), E (7, 10), E (8, 9), E (9, 10) };
- vector_graph_t bipartite_vector_graph (&bipartite_edges[0],
- &bipartite_edges[0] + sizeof(bipartite_edges) / sizeof(E), 11);
-
- /**
- * Create the graph drawn below.
- *
- * 2 - 1 - 0
- * | |
- * 3 - 6 - 5 - 4
- * / \ /
- * | 7
- * | /
- * 8 ---- 9
- *
- **/
-
- E non_bipartite_edges[] = { E (0, 1), E (0, 4), E (1, 2), E (2, 6), E (3, 6), E (3, 8), E (4, 5), E (4, 7), E (5, 6),
- E (6, 7), E (7, 9), E (8, 9) };
- vector_graph_t non_bipartite_vector_graph (&non_bipartite_edges[0], &non_bipartite_edges[0]
- + sizeof(non_bipartite_edges) / sizeof(E), 10);
-
- /// Call test routine for a bipartite and a non-bipartite graph.
-
- print_bipartite (bipartite_vector_graph);
-
- print_bipartite (non_bipartite_vector_graph);
-
- return 0;
+ typedef adjacency_list< vecS, vecS, undirectedS > vector_graph_t;
+ typedef std::pair< int, int > E;
+
+ /**
+ * Create the graph drawn below.
+ *
+ * 0 - 1 - 2
+ * | |
+ * 3 - 4 - 5 - 6
+ * / \ /
+ * | 7
+ * | |
+ * 8 - 9 - 10
+ **/
+
+ E bipartite_edges[]
+ = { E(0, 1), E(0, 4), E(1, 2), E(2, 6), E(3, 4), E(3, 8), E(4, 5),
+ E(4, 7), E(5, 6), E(6, 7), E(7, 10), E(8, 9), E(9, 10) };
+ vector_graph_t bipartite_vector_graph(&bipartite_edges[0],
+ &bipartite_edges[0] + sizeof(bipartite_edges) / sizeof(E), 11);
+
+ /**
+ * Create the graph drawn below.
+ *
+ * 2 - 1 - 0
+ * | |
+ * 3 - 6 - 5 - 4
+ * / \ /
+ * | 7
+ * | /
+ * 8 ---- 9
+ *
+ **/
+
+ E non_bipartite_edges[] = { E(0, 1), E(0, 4), E(1, 2), E(2, 6), E(3, 6),
+ E(3, 8), E(4, 5), E(4, 7), E(5, 6), E(6, 7), E(7, 9), E(8, 9) };
+ vector_graph_t non_bipartite_vector_graph(&non_bipartite_edges[0],
+ &non_bipartite_edges[0] + sizeof(non_bipartite_edges) / sizeof(E), 10);
+
+ /// Call test routine for a bipartite and a non-bipartite graph.
+
+ print_bipartite(bipartite_vector_graph);
+
+ print_bipartite(non_bipartite_vector_graph);
+
+ return 0;
}
diff --git a/example/boost_web_graph.cpp b/example/boost_web_graph.cpp
index 04ef2187f..3d640c8df 100644
--- a/example/boost_web_graph.cpp
+++ b/example/boost_web_graph.cpp
@@ -19,195 +19,202 @@
#include
#include
-
-template
+template < class Distance >
class calc_distance_visitor : public boost::bfs_visitor<>
{
public:
- calc_distance_visitor(Distance d) : distance(d) { }
-
- template
- void tree_edge(typename boost::graph_traits::edge_descriptor e,
- Graph& g)
- {
- typename boost::graph_traits::vertex_descriptor u, v;
- u = boost::source(e, g);
- v = boost::target(e, g);
- distance[v] = distance[u] + 1;
- }
+ calc_distance_visitor(Distance d) : distance(d) {}
+
+ template < class Graph >
+ void tree_edge(
+ typename boost::graph_traits< Graph >::edge_descriptor e, Graph& g)
+ {
+ typename boost::graph_traits< Graph >::vertex_descriptor u, v;
+ u = boost::source(e, g);
+ v = boost::target(e, g);
+ distance[v] = distance[u] + 1;
+ }
+
private:
- Distance distance;
+ Distance distance;
};
-
-template
+template < class VertexNameMap, class DistanceMap >
class print_tree_visitor : public boost::dfs_visitor<>
{
public:
- print_tree_visitor(VertexNameMap n, DistanceMap d) : name(n), distance(d) { }
- template
- void
- discover_vertex(typename boost::graph_traits::vertex_descriptor v,
- Graph&)
- {
- typedef typename boost::property_traits::value_type Dist;
- // indentation based on depth
- for (Dist i = 0; i < distance[v]; ++i)
- std::cout << " ";
- std::cout << name[v] << std::endl;
- }
-
- template
- void tree_edge(typename boost::graph_traits::edge_descriptor e,
- Graph& g)
- {
- distance[boost::target(e, g)] = distance[boost::source(e, g)] + 1;
- }
+ print_tree_visitor(VertexNameMap n, DistanceMap d) : name(n), distance(d) {}
+ template < class Graph >
+ void discover_vertex(
+ typename boost::graph_traits< Graph >::vertex_descriptor v, Graph&)
+ {
+ typedef typename boost::property_traits< DistanceMap >::value_type Dist;
+ // indentation based on depth
+ for (Dist i = 0; i < distance[v]; ++i)
+ std::cout << " ";
+ std::cout << name[v] << std::endl;
+ }
+
+ template < class Graph >
+ void tree_edge(
+ typename boost::graph_traits< Graph >::edge_descriptor e, Graph& g)
+ {
+ distance[boost::target(e, g)] = distance[boost::source(e, g)] + 1;
+ }
private:
- VertexNameMap name;
- DistanceMap distance;
+ VertexNameMap name;
+ DistanceMap distance;
};
-int
-main(int argc, const char** argv)
+int main(int argc, const char** argv)
{
- using namespace boost;
-
- std::ifstream datafile(argc >= 2 ? argv[1] : "./boost_web.dat");
- if (!datafile) {
- std::cerr << "No ./boost_web.dat file" << std::endl;
- return -1;
- }
-
- //===========================================================================
- // Declare the graph type and object, and some property maps.
-
- typedef adjacency_list >,
- property >
- > Graph;
-
- typedef graph_traits Traits;
- typedef Traits::vertex_descriptor Vertex;
- typedef Traits::edge_descriptor Edge;
-
- typedef std::map NameVertexMap;
- NameVertexMap name2vertex;
- Graph g;
-
- typedef property_map::type NameMap;
- NameMap node_name = get(vertex_name, g);
- property_map::type link_name = get(edge_name, g);
-
- //===========================================================================
- // Read the data file and construct the graph.
-
- std::string line;
- while (std::getline(datafile,line)) {
-
- std::list line_toks;
- boost::stringtok(line_toks, line, "|");
-
- NameVertexMap::iterator pos;
- bool inserted;
- Vertex u, v;
-
- std::list::iterator i = line_toks.begin();
-
- boost::tie(pos, inserted) = name2vertex.insert(std::make_pair(*i, Vertex()));
- if (inserted) {
- u = add_vertex(g);
- put(node_name, u, *i);
- pos->second = u;
- } else
- u = pos->second;
- ++i;
-
- std::string hyperlink_name = *i++;
-
- boost::tie(pos, inserted) = name2vertex.insert(std::make_pair(*i, Vertex()));
- if (inserted) {
- v = add_vertex(g);
- put(node_name, v, *i);
- pos->second = v;
- } else
- v = pos->second;
-
- Edge e;
- boost::tie(e, inserted) = add_edge(u, v, g);
- if (inserted) {
- put(link_name, e, hyperlink_name);
+ using namespace boost;
+
+ std::ifstream datafile(argc >= 2 ? argv[1] : "./boost_web.dat");
+ if (!datafile)
+ {
+ std::cerr << "No ./boost_web.dat file" << std::endl;
+ return -1;
+ }
+
+ //===========================================================================
+ // Declare the graph type and object, and some property maps.
+
+ typedef adjacency_list< vecS, vecS, directedS,
+ property< vertex_name_t, std::string,
+ property< vertex_color_t, default_color_type > >,
+ property< edge_name_t, std::string, property< edge_weight_t, int > > >
+ Graph;
+
+ typedef graph_traits< Graph > Traits;
+ typedef Traits::vertex_descriptor Vertex;
+ typedef Traits::edge_descriptor Edge;
+
+ typedef std::map< std::string, Vertex > NameVertexMap;
+ NameVertexMap name2vertex;
+ Graph g;
+
+ typedef property_map< Graph, vertex_name_t >::type NameMap;
+ NameMap node_name = get(vertex_name, g);
+ property_map< Graph, edge_name_t >::type link_name = get(edge_name, g);
+
+ //===========================================================================
+ // Read the data file and construct the graph.
+
+ std::string line;
+ while (std::getline(datafile, line))
+ {
+
+ std::list< std::string > line_toks;
+ boost::stringtok(line_toks, line, "|");
+
+ NameVertexMap::iterator pos;
+ bool inserted;
+ Vertex u, v;
+
+ std::list< std::string >::iterator i = line_toks.begin();
+
+ boost::tie(pos, inserted)
+ = name2vertex.insert(std::make_pair(*i, Vertex()));
+ if (inserted)
+ {
+ u = add_vertex(g);
+ put(node_name, u, *i);
+ pos->second = u;
+ }
+ else
+ u = pos->second;
+ ++i;
+
+ std::string hyperlink_name = *i++;
+
+ boost::tie(pos, inserted)
+ = name2vertex.insert(std::make_pair(*i, Vertex()));
+ if (inserted)
+ {
+ v = add_vertex(g);
+ put(node_name, v, *i);
+ pos->second = v;
+ }
+ else
+ v = pos->second;
+
+ Edge e;
+ boost::tie(e, inserted) = add_edge(u, v, g);
+ if (inserted)
+ {
+ put(link_name, e, hyperlink_name);
+ }
}
- }
-
- //===========================================================================
- // Calculate the diameter of the graph.
-
- typedef Traits::vertices_size_type size_type;
- typedef std::vector IntVector;
- // Create N x N matrix for storing the shortest distances
- // between each vertex. Initialize all distances to zero.
- std::vector d_matrix(num_vertices(g),
- IntVector(num_vertices(g), 0));
-
- size_type i;
- for (i = 0; i < num_vertices(g); ++i) {
- calc_distance_visitor vis(&d_matrix[i][0]);
- Traits::vertex_descriptor src = vertices(g).first[i];
- breadth_first_search(g, src, boost::visitor(vis));
- }
-
- size_type diameter = 0;
- BOOST_USING_STD_MAX();
- for (i = 0; i < num_vertices(g); ++i)
- diameter = max BOOST_PREVENT_MACRO_SUBSTITUTION(diameter, *std::max_element(d_matrix[i].begin(),
- d_matrix[i].end()));
-
- std::cout << "The diameter of the boost web-site graph is " << diameter
- << std::endl << std::endl;
-
- std::cout << "Number of clicks from the home page: " << std::endl;
- Traits::vertex_iterator vi, vi_end;
- for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
- std::cout << d_matrix[0][*vi] << "\t" << node_name[*vi] << std::endl;
- std::cout << std::endl;
-
- //===========================================================================
- // Print out the breadth-first search tree starting at the home page
-
- // Create storage for a mapping from vertices to their parents
- std::vector parent(num_vertices(g));
- for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
- parent[*vi] = *vi;
-
- // Do a BFS starting at the home page, recording the parent of each
- // vertex (where parent is with respect to the search tree).
- Traits::vertex_descriptor src = vertices(g).first[0];
- breadth_first_search
- (g, src,
- boost::visitor(make_bfs_visitor(record_predecessors(&parent[0],
- on_tree_edge()))));
-
- // Add all the search tree edges into a new graph
- Graph search_tree(num_vertices(g));
- boost::tie(vi, vi_end) = vertices(g);
- ++vi;
- for (; vi != vi_end; ++vi)
- add_edge(parent[*vi], *vi, search_tree);
-
- std::cout << "The breadth-first search tree:" << std::endl;
-
- // Print out the search tree. We use DFS because it visits
- // the tree nodes in the order that we want to print out:
- // a directory-structure like format.
- std::vector dfs_distances(num_vertices(g), 0);
- print_tree_visitor
- tree_printer(node_name, &dfs_distances[0]);
- for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
- get(vertex_color, g)[*vi] = white_color;
- depth_first_visit(search_tree, src, tree_printer, get(vertex_color, g));
-
- return EXIT_SUCCESS;
+
+ //===========================================================================
+ // Calculate the diameter of the graph.
+
+ typedef Traits::vertices_size_type size_type;
+ typedef std::vector< size_type > IntVector;
+ // Create N x N matrix for storing the shortest distances
+ // between each vertex. Initialize all distances to zero.
+ std::vector< IntVector > d_matrix(
+ num_vertices(g), IntVector(num_vertices(g), 0));
+
+ size_type i;
+ for (i = 0; i < num_vertices(g); ++i)
+ {
+ calc_distance_visitor< size_type* > vis(&d_matrix[i][0]);
+ Traits::vertex_descriptor src = vertices(g).first[i];
+ breadth_first_search(g, src, boost::visitor(vis));
+ }
+
+ size_type diameter = 0;
+ BOOST_USING_STD_MAX();
+ for (i = 0; i < num_vertices(g); ++i)
+ diameter = max BOOST_PREVENT_MACRO_SUBSTITUTION(diameter,
+ *std::max_element(d_matrix[i].begin(), d_matrix[i].end()));
+
+ std::cout << "The diameter of the boost web-site graph is " << diameter
+ << std::endl
+ << std::endl;
+
+ std::cout << "Number of clicks from the home page: " << std::endl;
+ Traits::vertex_iterator vi, vi_end;
+ for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
+ std::cout << d_matrix[0][*vi] << "\t" << node_name[*vi] << std::endl;
+ std::cout << std::endl;
+
+ //===========================================================================
+ // Print out the breadth-first search tree starting at the home page
+
+ // Create storage for a mapping from vertices to their parents
+ std::vector< Traits::vertex_descriptor > parent(num_vertices(g));
+ for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
+ parent[*vi] = *vi;
+
+ // Do a BFS starting at the home page, recording the parent of each
+ // vertex (where parent is with respect to the search tree).
+ Traits::vertex_descriptor src = vertices(g).first[0];
+ breadth_first_search(g, src,
+ boost::visitor(
+ make_bfs_visitor(record_predecessors(&parent[0], on_tree_edge()))));
+
+ // Add all the search tree edges into a new graph
+ Graph search_tree(num_vertices(g));
+ boost::tie(vi, vi_end) = vertices(g);
+ ++vi;
+ for (; vi != vi_end; ++vi)
+ add_edge(parent[*vi], *vi, search_tree);
+
+ std::cout << "The breadth-first search tree:" << std::endl;
+
+ // Print out the search tree. We use DFS because it visits
+ // the tree nodes in the order that we want to print out:
+ // a directory-structure like format.
+ std::vector< size_type > dfs_distances(num_vertices(g), 0);
+ print_tree_visitor< NameMap, size_type* > tree_printer(
+ node_name, &dfs_distances[0]);
+ for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
+ get(vertex_color, g)[*vi] = white_color;
+ depth_first_visit(search_tree, src, tree_printer, get(vertex_color, g));
+
+ return EXIT_SUCCESS;
}
diff --git a/example/boost_web_graph.expected b/example/boost_web_graph.expected
index b79bbf47d..5c60774ed 100644
--- a/example/boost_web_graph.expected
+++ b/example/boost_web_graph.expected
@@ -1,6 +1,6 @@
The diameter of the boost web-site graph is 2
-Number of clicks from the home page:
+Number of clicks from the home page:
0 www.boost.org
1 Boost Libraries
1 More Information
diff --git a/example/boykov_kolmogorov-eg.cpp b/example/boykov_kolmogorov-eg.cpp
index dec3474fb..5dd8d03e4 100644
--- a/example/boykov_kolmogorov-eg.cpp
+++ b/example/boykov_kolmogorov-eg.cpp
@@ -68,44 +68,47 @@
int main()
{
- using namespace boost;
+ using namespace boost;
- typedef adjacency_list_traits < vecS, vecS, directedS > Traits;
- typedef adjacency_list < vecS, vecS, directedS,
- property < vertex_name_t, std::string,
- property < vertex_index_t, long,
- property < vertex_color_t, boost::default_color_type,
- property < vertex_distance_t, long,
- property < vertex_predecessor_t, Traits::edge_descriptor > > > > >,
+ typedef adjacency_list_traits< vecS, vecS, directedS > Traits;
+ typedef adjacency_list< vecS, vecS, directedS,
+ property< vertex_name_t, std::string,
+ property< vertex_index_t, long,
+ property< vertex_color_t, boost::default_color_type,
+ property< vertex_distance_t, long,
+ property< vertex_predecessor_t,
+ Traits::edge_descriptor > > > > >,
- property < edge_capacity_t, long,
- property < edge_residual_capacity_t, long,
- property < edge_reverse_t, Traits::edge_descriptor > > > > Graph;
+ property< edge_capacity_t, long,
+ property< edge_residual_capacity_t, long,
+ property< edge_reverse_t, Traits::edge_descriptor > > > >
+ Graph;
- Graph g;
- property_map < Graph, edge_capacity_t >::type
- capacity = get(edge_capacity, g);
- property_map < Graph, edge_residual_capacity_t >::type
- residual_capacity = get(edge_residual_capacity, g);
- property_map < Graph, edge_reverse_t >::type rev = get(edge_reverse, g);
- Traits::vertex_descriptor s, t;
- read_dimacs_max_flow(g, capacity, rev, s, t);
+ Graph g;
+ property_map< Graph, edge_capacity_t >::type capacity
+ = get(edge_capacity, g);
+ property_map< Graph, edge_residual_capacity_t >::type residual_capacity
+ = get(edge_residual_capacity, g);
+ property_map< Graph, edge_reverse_t >::type rev = get(edge_reverse, g);
+ Traits::vertex_descriptor s, t;
+ read_dimacs_max_flow(g, capacity, rev, s, t);
- std::vector color(num_vertices(g));
- std::vector distance(num_vertices(g));
- long flow = boykov_kolmogorov_max_flow(g ,s, t);
+ std::vector< default_color_type > color(num_vertices(g));
+ std::vector< long > distance(num_vertices(g));
+ long flow = boykov_kolmogorov_max_flow(g, s, t);
- std::cout << "c The total flow:" << std::endl;
- std::cout << "s " << flow << std::endl << std::endl;
+ std::cout << "c The total flow:" << std::endl;
+ std::cout << "s " << flow << std::endl << std::endl;
- std::cout << "c flow values:" << std::endl;
- graph_traits < Graph >::vertex_iterator u_iter, u_end;
- graph_traits < Graph >::out_edge_iterator ei, e_end;
- for (boost::tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter)
- for (boost::tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei)
- if (capacity[*ei] > 0)
- std::cout << "f " << *u_iter << " " << target(*ei, g) << " "
- << (capacity[*ei] - residual_capacity[*ei]) << std::endl;
+ std::cout << "c flow values:" << std::endl;
+ graph_traits< Graph >::vertex_iterator u_iter, u_end;
+ graph_traits< Graph >::out_edge_iterator ei, e_end;
+ for (boost::tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter)
+ for (boost::tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei)
+ if (capacity[*ei] > 0)
+ std::cout << "f " << *u_iter << " " << target(*ei, g) << " "
+ << (capacity[*ei] - residual_capacity[*ei])
+ << std::endl;
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
diff --git a/example/bron_kerbosch_clique_number.cpp b/example/bron_kerbosch_clique_number.cpp
index 99edab92c..bf551867f 100644
--- a/example/bron_kerbosch_clique_number.cpp
+++ b/example/bron_kerbosch_clique_number.cpp
@@ -19,11 +19,10 @@ using namespace boost;
// Declare the graph type and its vertex and edge types.
typedef undirected_graph<> Graph;
-typedef graph_traits::vertex_descriptor Vertex;
-typedef graph_traits::edge_descriptor Edge;
+typedef graph_traits< Graph >::vertex_descriptor Vertex;
+typedef graph_traits< Graph >::edge_descriptor Edge;
-int
-main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
// Create the graph and read it from standard input.
Graph g;
diff --git a/example/bron_kerbosch_print_cliques.cpp b/example/bron_kerbosch_print_cliques.cpp
index 93030edd1..21c83b690 100644
--- a/example/bron_kerbosch_print_cliques.cpp
+++ b/example/bron_kerbosch_print_cliques.cpp
@@ -17,19 +17,17 @@ using namespace boost;
// The clique_printer is a visitor that will print the vertices that comprise
// a clique. Note that the vertices are not given in any specific order.
-template
-struct clique_printer
+template < typename OutputStream > struct clique_printer
{
- clique_printer(OutputStream& stream)
- : os(stream)
- { }
+ clique_printer(OutputStream& stream) : os(stream) {}
- template
+ template < typename Clique, typename Graph >
void clique(const Clique& c, const Graph& g)
{
// Iterate over the clique and print each vertex within it.
typename Clique::const_iterator i, end = c.end();
- for(i = c.begin(); i != end; ++i) {
+ for (i = c.begin(); i != end; ++i)
+ {
os << g[*i].name << " ";
}
os << endl;
@@ -44,16 +42,15 @@ struct Actor
};
// Declare the graph type and its vertex and edge types.
-typedef undirected_graph Graph;
-typedef graph_traits::vertex_descriptor Vertex;
-typedef graph_traits::edge_descriptor Edge;
+typedef undirected_graph< Actor > Graph;
+typedef graph_traits< Graph >::vertex_descriptor Vertex;
+typedef graph_traits< Graph >::edge_descriptor Edge;
// The name map provides an abstract accessor for the names of
// each vertex. This is used during graph creation.
-typedef property_map::type NameMap;
+typedef property_map< Graph, string Actor::* >::type NameMap;
-int
-main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
// Create the graph and and its name map accessor.
Graph g;
@@ -63,7 +60,7 @@ main(int argc, char *argv[])
read_graph(g, nm, cin);
// Instantiate the visitor for printing cliques
- clique_printer vis(cout);
+ clique_printer< ostream > vis(cout);
// Use the Bron-Kerbosch algorithm to find all cliques, printing them
// as they are found.
diff --git a/example/bucket_sorter.cpp b/example/bucket_sorter.cpp
index 981bed18d..4f176a428 100644
--- a/example/bucket_sorter.cpp
+++ b/example/bucket_sorter.cpp
@@ -14,85 +14,102 @@
#include
#include
-int main() {
- using namespace std;
- using boost::bucket_sorter;
+int main()
+{
+ using namespace std;
+ using boost::bucket_sorter;
- const std::size_t N = 10;
+ const std::size_t N = 10;
- vector bucket(N);
- for (std::size_t i=0; i bucket(N);
+ for (std::size_t i = 0; i < N; i++)
+ {
+ bucket[i] = rand() % N;
+ cout.width(6);
+ cout << "Number " << i << " is in bucket " << bucket[i] << endl;
+ }
- typedef boost::identity_property_map ID;
- typedef bucket_sorter::iterator, ID> BS;
- BS my_bucket_sorter(N, N, bucket.begin());
+ typedef boost::identity_property_map ID;
+ typedef bucket_sorter< std::size_t, int, vector< std::size_t >::iterator,
+ ID >
+ BS;
+ BS my_bucket_sorter(N, N, bucket.begin());
- for (std::size_t ii=0; ii
#include
-
using namespace boost;
-
int main(int argc, char** argv)
{
- typedef adjacency_list
- < vecS,
- vecS,
- undirectedS,
- property,
- property
- >
- graph;
+ typedef adjacency_list< vecS, vecS, undirectedS,
+ property< vertex_index_t, int >, property< edge_index_t, int > >
+ graph;
+
+ // Create a maximal planar graph on 6 vertices
+ graph g(6);
- // Create a maximal planar graph on 6 vertices
- graph g(6);
+ add_edge(0, 1, g);
+ add_edge(1, 2, g);
+ add_edge(2, 3, g);
+ add_edge(3, 4, g);
+ add_edge(4, 5, g);
+ add_edge(5, 0, g);
- add_edge(0,1,g);
- add_edge(1,2,g);
- add_edge(2,3,g);
- add_edge(3,4,g);
- add_edge(4,5,g);
- add_edge(5,0,g);
+ add_edge(0, 2, g);
+ add_edge(0, 3, g);
+ add_edge(0, 4, g);
- add_edge(0,2,g);
- add_edge(0,3,g);
- add_edge(0,4,g);
+ add_edge(1, 3, g);
+ add_edge(1, 4, g);
+ add_edge(1, 5, g);
- add_edge(1,3,g);
- add_edge(1,4,g);
- add_edge(1,5,g);
+ // Initialize the interior edge index
+ property_map< graph, edge_index_t >::type e_index = get(edge_index, g);
+ graph_traits< graph >::edges_size_type edge_count = 0;
+ graph_traits< graph >::edge_iterator ei, ei_end;
+ for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+ put(e_index, *ei, edge_count++);
- // Initialize the interior edge index
- property_map::type e_index = get(edge_index, g);
- graph_traits::edges_size_type edge_count = 0;
- graph_traits::edge_iterator ei, ei_end;
- for(boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
- put(e_index, *ei, edge_count++);
-
+ // Test for planarity - we know it is planar, we just want to
+ // compute the planar embedding as a side-effect
+ typedef std::vector< graph_traits< graph >::edge_descriptor > vec_t;
+ std::vector< vec_t > embedding(num_vertices(g));
+ if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g,
+ boyer_myrvold_params::embedding = make_iterator_property_map(
+ embedding.begin(), get(vertex_index, g))))
+ std::cout << "Input graph is planar" << std::endl;
+ else
+ std::cout << "Input graph is not planar" << std::endl;
- // Test for planarity - we know it is planar, we just want to
- // compute the planar embedding as a side-effect
- typedef std::vector< graph_traits::edge_descriptor > vec_t;
- std::vector embedding(num_vertices(g));
- if (boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g,
- boyer_myrvold_params::embedding =
- make_iterator_property_map(
- embedding.begin(), get(vertex_index, g))
- )
- )
- std::cout << "Input graph is planar" << std::endl;
- else
- std::cout << "Input graph is not planar" << std::endl;
+ typedef std::vector< graph_traits< graph >::vertex_descriptor >
+ ordering_storage_t;
- typedef std::vector::vertex_descriptor>
- ordering_storage_t;
-
- ordering_storage_t ordering;
- planar_canonical_ordering(g,
- make_iterator_property_map(
- embedding.begin(), get(vertex_index, g)),
- std::back_inserter(ordering));
+ ordering_storage_t ordering;
+ planar_canonical_ordering(g,
+ make_iterator_property_map(embedding.begin(), get(vertex_index, g)),
+ std::back_inserter(ordering));
- ordering_storage_t::iterator oi, oi_end;
- oi_end = ordering.end();
- std::cout << "The planar canonical ordering is: ";
- for(oi = ordering.begin(); oi != oi_end; ++oi)
- std::cout << *oi << " ";
- std::cout << std::endl;
+ ordering_storage_t::iterator oi, oi_end;
+ oi_end = ordering.end();
+ std::cout << "The planar canonical ordering is: ";
+ for (oi = ordering.begin(); oi != oi_end; ++oi)
+ std::cout << *oi << " ";
+ std::cout << std::endl;
- return 0;
+ return 0;
}
diff --git a/example/cc-internet.cpp b/example/cc-internet.cpp
index ca3582719..929d5e236 100644
--- a/example/cc-internet.cpp
+++ b/example/cc-internet.cpp
@@ -1,5 +1,5 @@
//=======================================================================
-// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -9,8 +9,8 @@
/*
IMPORTANT!!!
~~~~~~~~~~~~
- This example uses interfaces that have been deprecated and removed from Boost.Grpah.
- Someone needs to update it, as it does NOT compile.
+ This example uses interfaces that have been deprecated and removed from
+ Boost.Grpah. Someone needs to update it, as it does NOT compile.
*/
#include
@@ -20,30 +20,28 @@
#include
#include
-int
-main()
+int main()
{
- using namespace boost;
- GraphvizGraph g;
- read_graphviz("figs/cc-internet.dot", g);
+ using namespace boost;
+ GraphvizGraph g;
+ read_graphviz("figs/cc-internet.dot", g);
- std::vector component(num_vertices(g));
+ std::vector< int > component(num_vertices(g));
- connected_components
- (g, make_iterator_property_map(component.begin(),
- get(vertex_index, g), component[0]));
-
- property_map < GraphvizGraph, vertex_attribute_t >::type
- vertex_attr_map = get(vertex_attribute, g);
- std::string color[] = {
- "white", "gray", "black", "lightgray"};
- graph_traits < GraphvizGraph >::vertex_iterator vi, vi_end;
- for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) {
- vertex_attr_map[*vi]["color"] = color[component[*vi]];
- vertex_attr_map[*vi]["style"] = "filled";
- if (vertex_attr_map[*vi]["color"] == "black")
- vertex_attr_map[*vi]["fontcolor"] = "white";
- }
- write_graphviz("figs/cc-internet-out.dot", g);
+ connected_components(g,
+ make_iterator_property_map(
+ component.begin(), get(vertex_index, g), component[0]));
+ property_map< GraphvizGraph, vertex_attribute_t >::type vertex_attr_map
+ = get(vertex_attribute, g);
+ std::string color[] = { "white", "gray", "black", "lightgray" };
+ graph_traits< GraphvizGraph >::vertex_iterator vi, vi_end;
+ for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
+ {
+ vertex_attr_map[*vi]["color"] = color[component[*vi]];
+ vertex_attr_map[*vi]["style"] = "filled";
+ if (vertex_attr_map[*vi]["color"] == "black")
+ vertex_attr_map[*vi]["fontcolor"] = "white";
+ }
+ write_graphviz("figs/cc-internet-out.dot", g);
}
diff --git a/example/city_visitor.cpp b/example/city_visitor.cpp
index 85415a6fb..ba98c25e8 100644
--- a/example/city_visitor.cpp
+++ b/example/city_visitor.cpp
@@ -19,9 +19,8 @@
#include
#include // for boost::make_list
-
/*
- Example of using a visitor with the depth first search
+ Example of using a visitor with the depth first search
and breadth first search algorithm
Sacramento ---- Reno ---- Salt Lake City
@@ -32,11 +31,11 @@
|
Los Angeles ---- Las Vegas ---- Phoenix
|
- San Diego
+ San Diego
+
+ The visitor has three main functions:
- The visitor has three main functions:
-
discover_vertex(u,g) is invoked when the algorithm first arrives at the
vertex u. This will happen in the depth first or breadth first
order depending on which algorithm you use.
@@ -47,94 +46,103 @@
visit(u).
finish_vertex(u,g) is called when after all the vertices reachable from vertex
- u have already been visited.
+ u have already been visited.
*/
using namespace std;
using namespace boost;
-
-struct city_arrival : public base_visitor
+struct city_arrival : public base_visitor< city_arrival >
{
- city_arrival(string* n) : names(n) { }
- typedef on_discover_vertex event_filter;
- template
- inline void operator()(Vertex u, Graph&) {
- cout << endl << "arriving at " << names[u] << endl
- << " neighboring cities are: ";
- }
- string* names;
+ city_arrival(string* n) : names(n) {}
+ typedef on_discover_vertex event_filter;
+ template < class Vertex, class Graph >
+ inline void operator()(Vertex u, Graph&)
+ {
+ cout << endl
+ << "arriving at " << names[u] << endl
+ << " neighboring cities are: ";
+ }
+ string* names;
};
-struct neighbor_cities : public base_visitor
+struct neighbor_cities : public base_visitor< neighbor_cities >
{
- neighbor_cities(string* n) : names(n) { }
- typedef on_examine_edge event_filter;
- template
- inline void operator()(Edge e, Graph& g) {
- cout << names[ target(e, g) ] << ", ";
- }
- string* names;
+ neighbor_cities(string* n) : names(n) {}
+ typedef on_examine_edge event_filter;
+ template < class Edge, class Graph >
+ inline void operator()(Edge e, Graph& g)
+ {
+ cout << names[target(e, g)] << ", ";
+ }
+ string* names;
};
-struct finish_city : public base_visitor
+struct finish_city : public base_visitor< finish_city >
{
- finish_city(string* n) : names(n) { }
- typedef on_finish_vertex event_filter;
- template
- inline void operator()(Vertex u, Graph&) {
- cout << endl << "finished with " << names[u] << endl;
- }
- string* names;
+ finish_city(string* n) : names(n) {}
+ typedef on_finish_vertex event_filter;
+ template < class Vertex, class Graph >
+ inline void operator()(Vertex u, Graph&)
+ {
+ cout << endl << "finished with " << names[u] << endl;
+ }
+ string* names;
};
-int main(int, char*[])
+int main(int, char*[])
{
- enum { SanJose, SanFran, LA, SanDiego, Fresno, LasVegas, Reno,
- Sacramento, SaltLake, Phoenix, N };
-
- string names[] = { "San Jose", "San Francisco", "Los Angeles", "San Diego",
- "Fresno", "Las Vegas", "Reno", "Sacramento",
- "Salt Lake City", "Phoenix" };
-
- typedef std::pair