Compare commits
448 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7913228c9d | |||
| 45b600b665 | |||
| 41dc6bc8ec | |||
| 09914913d8 | |||
| 38c0346d50 | |||
| d59e865d77 | |||
| 06184c0bfe | |||
| 15d1ce3c5b | |||
| 96e152f8e5 | |||
| 10035bd207 | |||
| d311ba1ccf | |||
| 3977e06d83 | |||
| e758310566 | |||
| 3b503707ad | |||
| 03b9b5bdfd | |||
| da0610c99b | |||
| db5c1b317c | |||
| 05a9ed31da | |||
| c1ccf73891 | |||
| 281bb94e51 | |||
| 7cb9113a61 | |||
| 56d3e72155 | |||
| 7e54f9997d | |||
| 2796c0a147 | |||
| b50fe850a2 | |||
| 529934f827 | |||
| caa8fd4568 | |||
| c7a6fdc418 | |||
| 0ce03767a8 | |||
| 8321c79d20 | |||
| 589584b4e4 | |||
| f0faaabca1 | |||
| 4b07d0b469 | |||
| cdc7f4f75b | |||
| 9249b640e4 | |||
| c0756b5ebf | |||
| a14f8df86c | |||
| 7f94230dca | |||
| ecf83843e7 | |||
| 13cea9c32b | |||
| 50cb642e94 | |||
| c112afbbad | |||
| b1a4f32b1f | |||
| f9e930f006 | |||
| a4e6f4dd78 | |||
| 753c88c484 | |||
| fa7ef591c2 | |||
| eec98072db | |||
| 48b63adf44 | |||
| b0214ec131 | |||
| ba0cf281c9 | |||
| b5171962bf | |||
| 5d8c6fd1d3 | |||
| 59aba774bc | |||
| 0eabc7ceb5 | |||
| 8729cc8a7c | |||
| 5bfc793f06 | |||
| b357a88ecd | |||
| a089d3bc35 | |||
| 04c1c99051 | |||
| d6b7a717db | |||
| b6d9a72999 | |||
| 6f5964a6bd | |||
| d155583ac2 | |||
| 6a2d45ae20 | |||
| 0e1414f46e | |||
| 189c113f04 | |||
| add3546f94 | |||
| 6416fecc90 | |||
| 8ca2084c9d | |||
| 5b84005bac | |||
| 6a33285342 | |||
| 379383b62a | |||
| a5b6a097e6 | |||
| 316445d7c9 | |||
| ed98931118 | |||
| daa2e69db1 | |||
| 6a559d3b73 | |||
| b31f6de077 | |||
| 70a2630932 | |||
| 235064c63c | |||
| 1b88c5bc8b | |||
| 887de5e2e3 | |||
| 12d334fff6 | |||
| e2da814588 | |||
| 9b7fbc1a76 | |||
| 1f2dc47fdd | |||
| fcaef7c4e3 | |||
| 07c47bca51 | |||
| b77deb851a | |||
| 86bbbf563d | |||
| f1fe4a9132 | |||
| cb26ccf2ba | |||
| cec654dedb | |||
| 983be4b9e7 | |||
| 332b49261c | |||
| a9b0657fd3 | |||
| 4af610830b | |||
| 031ce8084b | |||
| db6e8b7981 | |||
| 74564d5a1c | |||
| 91a21a559c | |||
| 73b68e32ba | |||
| 0464915a7f | |||
| 4ebf7f60fc | |||
| 4fc3cbfaae | |||
| da59145176 | |||
| bed19d5c25 | |||
| f0f1251da7 | |||
| 4f8a34090e | |||
| e096e7e5cc | |||
| 51d3fe8aed | |||
| 5922324c2b | |||
| f97c2ee746 | |||
| c40148ee94 | |||
| fdd8e41b47 | |||
| 93f232252e | |||
| 93f4a862c3 | |||
| e1bcb667b6 | |||
| 405e21d011 | |||
| a3efa1c030 | |||
| bd107e4ab5 | |||
| 85b45da7c8 | |||
| 8aa602b40d | |||
| 915b70ec05 | |||
| 5297423229 | |||
| 01a683d8ce | |||
| 5ba855f46e | |||
| d983ea89a5 | |||
| cd267de654 | |||
| 130f7129c3 | |||
| be2fc043d1 | |||
| a5a29bd065 | |||
| 73d2d7500e | |||
| d53729083f | |||
| 37bd777094 | |||
| ca70cdaa2c | |||
| 5e88d92265 | |||
| 61296c352a | |||
| 2cd57a4180 | |||
| df1a183214 | |||
| bf00bbe4f0 | |||
| b98f225d0d | |||
| 1311d1b035 | |||
| 966aa0cf48 | |||
| 67f7bcfa96 | |||
| 2c62f35e46 | |||
| 67aacbe6ef | |||
| 53bdf1db9c | |||
| 7e9b77f5fb | |||
| 535e593810 | |||
| c40a522362 | |||
| 32fa162931 | |||
| 65c9ef22c6 | |||
| 44912cc2be | |||
| f9dbc3ffb3 | |||
| 3e770e171e | |||
| 4f3e758c9c | |||
| 0e4f022d9d | |||
| 393c072c18 | |||
| 2539ea8bca | |||
| 02aaeccae5 | |||
| 3ebad4bc01 | |||
| 057a718a39 | |||
| 51a28ac04b | |||
| e8eba95d4a | |||
| afd2ee41bd | |||
| e41d96177f | |||
| 1c54f431ca | |||
| 7ea6373369 | |||
| 8caf6fc368 | |||
| f10ad0650a | |||
| 2f12c59529 | |||
| 086cd12a7e | |||
| 22b521ecf4 | |||
| 31cf899da9 | |||
| ebd636bfc0 | |||
| 8a1913f804 | |||
| f53d02e0eb | |||
| 233cc514c5 | |||
| 5f6963e0f0 | |||
| 25852f92af | |||
| 36d3d83375 | |||
| 867f8cf495 | |||
| add307aafc | |||
| 0c2db206d3 | |||
| fd7f84560b | |||
| 6aed0a5a45 | |||
| 1a9533422d | |||
| 56223ce7b0 | |||
| e39be516c2 | |||
| 55047c74c1 | |||
| d1bd08f2a3 | |||
| 74dc17ee94 | |||
| 942d3430f1 | |||
| eefb7a3d47 | |||
| 923877b3c5 | |||
| 4495a409e5 | |||
| 1bb17dab63 | |||
| f95e102060 | |||
| 0df5824004 | |||
| 3419d42acc | |||
| b5b07e13a8 | |||
| 2275b3019b | |||
| 0a990db1c5 | |||
| b4e1fe7a66 | |||
| 8c4d0b33cd | |||
| 0d1769a27c | |||
| 8f37c21e99 | |||
| 34ddb83a49 | |||
| c964747407 | |||
| b214ef2f4d | |||
| 607d866854 | |||
| f95abaa83c | |||
| ddf8a5e07e | |||
| 3009b2303c | |||
| b9e9ed2067 | |||
| f16a1b114d | |||
| 8afe81608c | |||
| 3be269ba35 | |||
| 58829e019b | |||
| 663127c3b7 | |||
| 9002628f15 | |||
| 076085fd29 | |||
| adaa84d861 | |||
| 8c83132ef7 | |||
| 60b5e07027 | |||
| 58ff2364ba | |||
| fecccdd81c | |||
| b52e49730b | |||
| 9dcbb861d6 | |||
| d2d880b4e0 | |||
| 88101e0ab0 | |||
| 4672f4d430 | |||
| 6dc5eb1d6a | |||
| 48f4d92a38 | |||
| ff872bad11 | |||
| 245e36feba | |||
| 1cdce524a2 | |||
| ba9155f89c | |||
| df80876475 | |||
| 6604e3a013 | |||
| 408469afcf | |||
| 20ab0ffec3 | |||
| 71f0ab997d | |||
| 708d8b62a5 | |||
| 616b9e7134 | |||
| 849d1538ed | |||
| 215359117a | |||
| 5cab2dcf61 | |||
| 30dd4d8f69 | |||
| 0cbdd0a40f | |||
| 38ad939f37 | |||
| cbe70511cd | |||
| 0b30767da0 | |||
| 8ff9b6c510 | |||
| b37570381b | |||
| 34ba5d36d7 | |||
| 856e0fb3ab | |||
| 48860d938c | |||
| 4e5382d828 | |||
| 2d70ac7254 | |||
| 1eb950d630 | |||
| 1441c15255 | |||
| 8e40b350e3 | |||
| 429112df7c | |||
| 0586ac290f | |||
| d42d54b54e | |||
| bec6cb4dda | |||
| 117689a3f9 | |||
| 6ea899f7ed | |||
| a64981a983 | |||
| 2a4350905b | |||
| ebdec45c4b | |||
| 97bea429fc | |||
| 01832f76c2 | |||
| 0aaf3858a0 | |||
| efd4b992cc | |||
| 706859b595 | |||
| 3d43c1a8ec | |||
| eeaee30dd3 | |||
| a4806bed3b | |||
| 8400e599ca | |||
| 28cf285c4d | |||
| 7d3b9f0b4b | |||
| aaedb9bac7 | |||
| ce845156b8 | |||
| 755c77e7c1 | |||
| 30026490ee | |||
| 63200dc0ea | |||
| 8ecd3a986c | |||
| d70d07b0ba | |||
| eaebaf87a6 | |||
| 428762da2b | |||
| 5d1e1ce628 | |||
| 771d9307cc | |||
| 7fccfd1f42 | |||
| 9092da0b8f | |||
| 118a055bc4 | |||
| 068b2916b3 | |||
| e77cd87de1 | |||
| e0c11b3116 | |||
| 8f8cd154e6 | |||
| 5aa2be67b0 | |||
| 7a2ec7c4dc | |||
| 035fac705c | |||
| 6f4b8bf204 | |||
| 57121513a7 | |||
| 7e59864546 | |||
| bbab01b9c3 | |||
| 3b7250f736 | |||
| e315856b1b | |||
| b838adfa32 | |||
| cae4628d7e | |||
| a3d25c5521 | |||
| 7cddb8febf | |||
| 908ebf506f | |||
| fee51b8cdc | |||
| 00ae7b7e72 | |||
| 5476d8d70a | |||
| c49c05f502 | |||
| e7d2639f6e | |||
| fdc5f76aca | |||
| 761f792ed4 | |||
| c1b4a409a5 | |||
| 2d41bea1c8 | |||
| ce88df48fd | |||
| 0a31d3c76b | |||
| cdef2804ea | |||
| b42b71824b | |||
| cd1186205d | |||
| 9d353c53e2 | |||
| a1fc58cc93 | |||
| f63ebe9a8b | |||
| 1c7c456e18 | |||
| e761a6b4d0 | |||
| cddab52a7b | |||
| 3af4b053be | |||
| 210e7857b2 | |||
| a4dc3d7b23 | |||
| 4b95dcfbe9 | |||
| f761059ecd | |||
| a439c48425 | |||
| 99f7ed91af | |||
| cd1fee5f7d | |||
| 231bb5dbfb | |||
| 456f4006cb | |||
| 52d7bc8d5e | |||
| 8f3dd3a4f9 | |||
| 79573b5dbd | |||
| fc1619d91e | |||
| 17f92dd61e | |||
| 2a5874c7b9 | |||
| 03193c2fb4 | |||
| 345a6b964b | |||
| 366cd32060 | |||
| a88250f76f | |||
| 2b2f2d464e | |||
| 3619e54948 | |||
| d6643f50f3 | |||
| 63249fa231 | |||
| 6f91f83d2e | |||
| 2edbcb500f | |||
| ffff89b1a2 | |||
| 3a546c9418 | |||
| 27e5672047 | |||
| 4a19d6d288 | |||
| 4778a4b359 | |||
| fd37deb67b | |||
| 90678ab0fa | |||
| 48b3020f7d | |||
| 9f29ef1a83 | |||
| b156db0c9e | |||
| 9c7f42c58a | |||
| c0bc3e3aea | |||
| fee2e45a8c | |||
| f0343d2264 | |||
| fcf6446201 | |||
| 1180386ac1 | |||
| b021084901 | |||
| c416132bfe | |||
| fec3bd2314 | |||
| 8b4ac5cc39 | |||
| b6c54fa390 | |||
| 6edd466d86 | |||
| f98a8afdd6 | |||
| 9cf1345871 | |||
| 55b82bd1f2 | |||
| 2c3505aec9 | |||
| c5780610c6 | |||
| a4af894285 | |||
| b407ea9309 | |||
| 19b05b0cae | |||
| 3131ffa454 | |||
| 1fa0cd9a26 | |||
| 4b1c5fe438 | |||
| 06bdbbcbba | |||
| f52b7df417 | |||
| 516c833574 | |||
| fd549fe0fa | |||
| b52d4724c2 | |||
| 66cd415568 | |||
| d44293d8a8 | |||
| a0c90983ab | |||
| bb1ce866f8 | |||
| ac4b12107f | |||
| a4452c3539 | |||
| 074277924a | |||
| ec5f6a655c | |||
| e5341acc43 | |||
| 19679d3851 | |||
| 3624e74d13 | |||
| ae33127eed | |||
| 43386bca5c | |||
| 287529480f | |||
| 6fb2f7edec | |||
| 4a5c105654 | |||
| f132fd060f | |||
| 595b9abbdc | |||
| 0415ceffe0 | |||
| 4000bccb3d | |||
| 2e5db3d026 | |||
| ff1775df18 | |||
| b76015210d | |||
| 086a94c8a5 | |||
| 10b41afc0f | |||
| cc07f4c201 | |||
| 904b4cc924 | |||
| e864071546 | |||
| 9bcc1b9a69 | |||
| db812aa773 | |||
| 6c48845da8 | |||
| fb567057df | |||
| 8e365de488 | |||
| a934539462 | |||
| f5b408ef7f | |||
| 7d02f7dd6b | |||
| 11187e5a25 | |||
| 55dec7c079 | |||
| a3786d7f7e | |||
| 822fc80494 | |||
| 24a2de892f | |||
| 61d37fe743 | |||
| 7ba05ec487 | |||
| f66d119969 | |||
| adc6eb0f0d | |||
| 7b97cbf393 | |||
| 89cd3d8a8a |
@@ -0,0 +1,16 @@
|
||||
BasedOnStyle: WebKit
|
||||
Standard: Cpp11
|
||||
AlignAfterOpenBracket: false
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
BreakBeforeBraces: Allman
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
ColumnLimit: 80
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 0
|
||||
IndentCaseLabels: false
|
||||
SortIncludes: false
|
||||
AlignTrailingComments: false
|
||||
|
||||
SpacesInAngles: true
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# Use, modification, and distribution are
|
||||
# subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
# Mael Valais, 2016
|
||||
# This travis file has been inspired from boostorg/geometry/circle.yml.
|
||||
#
|
||||
# This file is intended to make use of travis-ci, a continuous integration
|
||||
# service. The purpose is to build and run the tests on the graph module
|
||||
# on every push, and be able to know if those commits are "clean" or if
|
||||
# they break the build.
|
||||
#
|
||||
|
||||
# I think that we shouldn't restrict on branches: PRs must also be tested
|
||||
# So for now, I disabled the "only on branches" feature
|
||||
#branches:
|
||||
# only:
|
||||
# - master
|
||||
# - develop
|
||||
# - test
|
||||
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
|
||||
env:
|
||||
global:
|
||||
- BOOST_BRANCH=$([[ "$TRAVIS_BRANCH" = "master" ]] && echo master || echo develop)
|
||||
- BOOST=boost-local # must be different from graph/boost dir name
|
||||
addons:
|
||||
apt:
|
||||
sources: ubuntu-toolchain-r-test
|
||||
packages: g++-4.8
|
||||
|
||||
before_install:
|
||||
# Clone boost repository
|
||||
- cd
|
||||
- mkdir $BOOST && cd $BOOST
|
||||
- git init .
|
||||
- git remote add --no-tags -t $BOOST_BRANCH origin https://github.com/boostorg/boost.git
|
||||
- git fetch --depth=1
|
||||
- git checkout $BOOST_BRANCH
|
||||
- git submodule update --init --merge
|
||||
- git remote set-branches --add origin $BOOST_BRANCH
|
||||
- git pull --recurse-submodules
|
||||
- git submodule update --init
|
||||
- git checkout $BOOST_BRANCH
|
||||
- git submodule foreach "git reset --quiet --hard; git clean -fxd"
|
||||
- git reset --hard; git clean -fxd
|
||||
- git status
|
||||
|
||||
# replace the content of the library with the currently tested repo
|
||||
- cd && pwd && ls
|
||||
- rm -rf $BOOST/libs/graph
|
||||
- cd $TRAVIS_BUILD_DIR && cd ..
|
||||
- mv graph $HOME/$BOOST/libs/
|
||||
|
||||
# build b2 and create headers
|
||||
- cd && cd $BOOST
|
||||
- ./bootstrap.sh
|
||||
- ./b2 headers
|
||||
|
||||
# This part is meant for unit tests
|
||||
script:
|
||||
- cd $HOME/$BOOST/libs/graph/test
|
||||
- ../../../b2 toolset=gcc-4.8 cxxflags=-std=c++11
|
||||
@@ -0,0 +1,44 @@
|
||||
Boost Graph Library
|
||||
===================
|
||||
|
||||
A generic interface for traversing graphs, using C++ templates.
|
||||
|
||||
The full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/graph/doc/index.html).
|
||||
|
||||
## Support, bugs and feature requests ##
|
||||
|
||||
Bugs and feature requests can be reported through the [Trac issue tracker](https://svn.boost.org/trac/boost/query?component=graph&desc=1&order=id)
|
||||
(see [open issues](https://svn.boost.org/trac/boost/query?status=!closed&component=graph&desc=1&order=id) and
|
||||
[closed issues](https://svn.boost.org/trac/boost/query?status=closed&component=graph&col=id&col=summary&col=status&col=owner&col=type&col=milestone&col=version&desc=1&order=id)). [Here](http://lists.boost.org/Archives/boost/2015/04/221780.php) is why Trac is still in use.
|
||||
|
||||
You can submit your changes through a [pull request](https://github.com/boostorg/graph/pulls). One of the maintainers will take a look (remember that it can take some time).
|
||||
|
||||
There is no mailing-list specific to Boost Graph, although you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users) using the tag [graph].
|
||||
|
||||
|
||||
## 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)):
|
||||
|
||||
git clone https://github.com/boostorg/boost
|
||||
cd boost
|
||||
git submodule update --init
|
||||
|
||||
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
|
||||
./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`.
|
||||
You can either run all the 300+ tests listed in `Jamfile.v2` or run a single test:
|
||||
|
||||
../../../b2 <- run all tests
|
||||
../../../b2 cycle_canceling_test <- single test
|
||||
|
||||
You can also check the [regression tests reports](http://beta.boost.org/development/tests/develop/developer/graph.html).
|
||||
@@ -21,6 +21,7 @@ lib boost_graph
|
||||
# Without these flags, MSVC 7.1 and 8.0 crash
|
||||
# User reports that VC++ 8.0 does not fail anymore, so that is removed
|
||||
<toolset>msvc-7.1:<cxxflags>-GR-
|
||||
<toolset>sun:<build>no
|
||||
:
|
||||
:
|
||||
;
|
||||
|
||||
@@ -116,7 +116,7 @@ Called for the target of every out edge of a vertex being examined.
|
||||
struct AStarHeuristicConcept {
|
||||
void constraints()
|
||||
{
|
||||
function_requires< CopyConstructibleConcept<Heuristic> >();
|
||||
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Heuristic> ));
|
||||
h(u);
|
||||
}
|
||||
Heuristic h;
|
||||
|
||||
@@ -112,8 +112,7 @@ The <TT>adjacent_vertices()</TT> function must return in constant time.
|
||||
typedef typename boost::graph_traits<G>::adjacency_iterator
|
||||
adjacency_iterator;
|
||||
void constraints() {
|
||||
function_requires< IncidenceGraphConcept<G> >();
|
||||
function_requires< MultiPassInputIteratorConcept<adjacency_iterator> >();
|
||||
BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept<adjacency_iterator> ));
|
||||
|
||||
p = adjacent_vertices(v, g);
|
||||
v = *p.first;
|
||||
|
||||
@@ -145,20 +145,25 @@ undirected graphs).
|
||||
typedef typename boost::graph_traits<G>::in_edge_iterator
|
||||
in_edge_iterator;
|
||||
void constraints() {
|
||||
function_requires< IncidenceGraphConcept<G> >();
|
||||
function_requires< MultiPassInputIteratorConcept<in_edge_iterator> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<G> ));
|
||||
BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept<in_edge_iterator> ));
|
||||
|
||||
p = in_edges(v, g);
|
||||
n = in_degree(v, g);
|
||||
n = degree(v, g);
|
||||
e = *p.first;
|
||||
const_constraints(g);
|
||||
}
|
||||
void const_constraints(const G& g) {
|
||||
p = in_edges(v, g);
|
||||
n = in_degree(v, g);
|
||||
n = degree(v, g);
|
||||
e = *p.first;
|
||||
}
|
||||
std::pair<in_edge_iterator, in_edge_iterator> p;
|
||||
typename boost::graph_traits<G>::vertex_descriptor v;
|
||||
typename boost::graph_traits<G>::edge_descriptor e;
|
||||
typename boost::graph_traits<G>::degree_size_type n;
|
||||
G g;
|
||||
};
|
||||
</PRE>
|
||||
|
||||
@@ -150,6 +150,15 @@ undirected graph this method is never called.
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Finish Edge</td>
|
||||
<td><tt>vis.finish_edge(e, g)</tt></td>
|
||||
<td><tt>void</tt></td>
|
||||
<td>
|
||||
This is invoked on each non-tree edge as well as on each tree edge after
|
||||
<tt>finish_vertex</tt> has been called on its target vertex.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Finish Vertex</td>
|
||||
<td><tt>vis.finish_vertex(u, g)</tt></td>
|
||||
<td><tt>void</tt></td>
|
||||
|
||||
@@ -80,7 +80,7 @@ the search.
|
||||
|
||||
<TR>
|
||||
<TD><tt>w</tt></TD>
|
||||
<TD>An object of type <tt>DistanceMap</tt>.</TD>
|
||||
<TD>An object of type <tt>WeightMap</tt>.</TD>
|
||||
</TR>
|
||||
|
||||
</table>
|
||||
|
||||
@@ -146,8 +146,8 @@ must all return in constant time.
|
||||
typedef typename boost::graph_traits<G>::edge_iterator
|
||||
edge_iterator;
|
||||
void constraints() {
|
||||
function_requires< GraphConcept<G> >();
|
||||
function_requires< MultiPassInputIteratorConcept<edge_iterator> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<G> ));
|
||||
BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept<edge_iterator> ));
|
||||
|
||||
p = edges(g);
|
||||
E = num_edges(g);
|
||||
|
||||
@@ -121,12 +121,12 @@ any vertex of graph object which type is <tt>G</tt>.
|
||||
typedef typename boost::graph_traits<G>::traversal_category traversal_category;
|
||||
|
||||
void constraints() {
|
||||
function_requires< DefaultConstructibleConcept<vertex_descriptor> >();
|
||||
function_requires< EqualityComparableConcept<vertex_descriptor> >();
|
||||
function_requires< AssignableConcept<vertex_descriptor> >();
|
||||
function_requires< DefaultConstructibleConcept<edge_descriptor> >();
|
||||
function_requires< EqualityComparableConcept<edge_descriptor> >();
|
||||
function_requires< AssignableConcept<edge_descriptor> >();
|
||||
BOOST_CONCEPT_ASSERT(( DefaultConstructibleConcept<vertex_descriptor> ));
|
||||
BOOST_CONCEPT_ASSERT(( EqualityComparableConcept<vertex_descriptor> ));
|
||||
BOOST_CONCEPT_ASSERT(( AssignableConcept<vertex_descriptor> ));
|
||||
BOOST_CONCEPT_ASSERT(( DefaultConstructibleConcept<edge_descriptor> ));
|
||||
BOOST_CONCEPT_ASSERT(( EqualityComparableConcept<edge_descriptor> ));
|
||||
BOOST_CONCEPT_ASSERT(( AssignableConcept<edge_descriptor> ));
|
||||
}
|
||||
G g;
|
||||
};
|
||||
|
||||
@@ -162,8 +162,8 @@ Therefore, the extra requirement is added that the out-edge connecting
|
||||
{
|
||||
typedef typename boost::graph_traits<G>::out_edge_iterator out_edge_iterator;
|
||||
void constraints() {
|
||||
function_requires< GraphConcept<G> >();
|
||||
function_requires< MultiPassInputIteratorConcept<out_edge_iterator> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<G> ));
|
||||
BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept<out_edge_iterator> ));
|
||||
|
||||
p = out_edges(u, g);
|
||||
e = *p.first;
|
||||
|
||||
@@ -63,8 +63,8 @@ in addition to the members that are required of types that model <a href="./Upda
|
||||
typedef typename Q::key_map key_map;
|
||||
|
||||
void constraints() {
|
||||
function_requires< UpdatableQueue<Q> >();
|
||||
function_requires< ReadWritePropertyMap< key_map, typename Buffer<Q>::value_type > >();
|
||||
BOOST_CONCEPT_ASSERT(( UpdatableQueue<Q> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMap< key_map, typename Buffer<Q>::value_type > ));
|
||||
}
|
||||
|
||||
void const_constraints(const Q& cq) {
|
||||
|
||||
@@ -250,7 +250,7 @@ is no longer a valid vertex descriptor.
|
||||
struct MutableIncidenceGraphConcept
|
||||
{
|
||||
void constraints() {
|
||||
function_requires< MutableGraph<G> >();
|
||||
BOOST_CONCEPT_ASSERT(( MutableGraph<G> ));
|
||||
remove_edge(iter, g);
|
||||
remove_out_edge_if(u, p, g);
|
||||
}
|
||||
@@ -265,7 +265,7 @@ is no longer a valid vertex descriptor.
|
||||
struct MutableBidirectionalGraphConcept
|
||||
{
|
||||
void constraints() {
|
||||
function_requires< MutableIncidenceGraph<G> >();
|
||||
BOOST_CONCEPT_ASSERT(( MutableIncidenceGraph<G> ));
|
||||
remove_in_edge_if(u, p, g);
|
||||
}
|
||||
G g;
|
||||
@@ -278,7 +278,7 @@ is no longer a valid vertex descriptor.
|
||||
struct MutableEdgeListGraphConcept
|
||||
{
|
||||
void constraints() {
|
||||
function_requires< MutableGraph<G> >();
|
||||
BOOST_CONCEPT_ASSERT(( MutableGraph<G> ));
|
||||
remove_edge_if(p, g);
|
||||
}
|
||||
G g;
|
||||
|
||||
@@ -125,7 +125,7 @@ Return type: <TT>vertex_descriptor</TT>
|
||||
{
|
||||
typedef typename boost::graph_traits<G>::edge_descriptor edge_descriptor;
|
||||
void constraints() {
|
||||
function_requires< MutableGraphConcept<G> >();
|
||||
BOOST_CONCEPT_ASSERT(( MutableGraphConcept<G> ));
|
||||
v = add_vertex(vp, g);
|
||||
p = add_edge(u, v, ep, g);
|
||||
}
|
||||
|
||||
@@ -173,9 +173,9 @@ The <tt>get()</tt> property map function must be constant time.
|
||||
typedef typename property_map<G, PropertyTag>::type Map;
|
||||
typedef typename property_map<G, PropertyTag>::const_type const_Map;
|
||||
void constraints() {
|
||||
function_requires< GraphConcept<G> >();
|
||||
function_requires< ReadWritePropertyMapConcept<Map, X> >();
|
||||
function_requires< ReadablePropertyMapConcept<const_Map, X> >();
|
||||
BOOST_CONCEPT_ASSERT(( GraphConcept<G> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<Map, X> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<const_Map, X> ));
|
||||
|
||||
Map pmap = get(PropertyTag(), g);
|
||||
pval = get(PropertyTag(), g, x);
|
||||
|
||||
@@ -58,7 +58,7 @@ in addition to the members that are required of types that model <a href="./Buff
|
||||
struct UpdatableQueueConcept
|
||||
{
|
||||
void constraints() {
|
||||
function_requires< Buffer<Q> >();
|
||||
BOOST_CONCEPT_ASSERT(( Buffer<Q> ));
|
||||
|
||||
q.update(g_ct);
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ requirements are added.
|
||||
struct VertexAndEdgeListGraphConcept
|
||||
{
|
||||
void constraints() {
|
||||
function_requires< VertexListGraphConcept<G> >();
|
||||
function_requires< EdgeListGraphConcept<G> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<G> ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<G> ));
|
||||
}
|
||||
};
|
||||
</PRE>
|
||||
|
||||
@@ -121,9 +121,9 @@ groups these requirements together, hence the VertexListGraph concept.
|
||||
typedef typename boost::graph_traits<G>::vertex_iterator
|
||||
vertex_iterator;
|
||||
void constraints() {
|
||||
function_requires< IncidenceGraphConcept<G> >();
|
||||
function_requires< AdjacencyGraphConcept<G> >();
|
||||
function_requires< MultiPassInputIteratorConcept<vertex_iterator> >();
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<G> ));
|
||||
BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<G> ));
|
||||
BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept<vertex_iterator> ));
|
||||
|
||||
p = vertices(g);
|
||||
V = num_vertices(g);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Copyright (c) Jeremy Siek 2000
|
||||
|
||||
|
||||
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)
|
||||
@@ -214,12 +214,12 @@ example, the following code will result in undefined (bad) behavior:
|
||||
|
||||
<b>// Attempt to remove all the vertices. Wrong!</b>
|
||||
graph_traits<Graph>::vertex_iterator vi, vi_end;
|
||||
for (tie(vi, vi_end) = vertices(G); vi != vi_end; ++vi)
|
||||
for (boost::tie(vi, vi_end) = vertices(G); vi != vi_end; ++vi)
|
||||
remove_vertex(*vi, G);
|
||||
|
||||
<b>// Remove all the vertices. This is still wrong!</b>
|
||||
graph_traits<Graph>::vertex_iterator vi, vi_end, next;
|
||||
tie(vi, vi_end) = vertices(G);
|
||||
boost::tie(vi, vi_end) = vertices(G);
|
||||
for (next = vi; vi != vi_end; vi = next) {
|
||||
++next;
|
||||
remove_vertex(*vi, G);
|
||||
@@ -247,12 +247,12 @@ actual vertex that was removed. The following code demonstrates this.
|
||||
|
||||
<b>// Attempt to remove all the vertices. Wrong!</b>
|
||||
graph_traits<Graph>::vertex_iterator vi, vi_end;
|
||||
for (tie(vi, vi_end) = vertices(G); vi != vi_end; ++vi)
|
||||
for (boost::tie(vi, vi_end) = vertices(G); vi != vi_end; ++vi)
|
||||
remove_vertex(*vi, G);
|
||||
|
||||
<b>// Remove all the vertices. This is OK.</b>
|
||||
graph_traits<Graph>::vertex_iterator vi, vi_end, next;
|
||||
tie(vi, vi_end) = vertices(G);
|
||||
boost::tie(vi, vi_end) = vertices(G);
|
||||
for (next = vi; vi != vi_end; vi = next) {
|
||||
++next;
|
||||
remove_vertex(*vi, G);
|
||||
@@ -281,7 +281,7 @@ vertex descriptors have become invalid, the result is incorrect.
|
||||
remove_vertex(s, G); <b>// Bad idea! Invalidates vertex descriptors in parent vector.</b>
|
||||
|
||||
<b>// The following will produce incorrect results</b>
|
||||
for(tie(vi, vend) = vertices(G); vi != vend; ++vi)
|
||||
for(boost::tie(vi, vend) = vertices(G); vi != vend; ++vi)
|
||||
std::cout << p[*vi] << " is the parent of " << *vi << std::endl;
|
||||
</pre>
|
||||
|
||||
@@ -459,7 +459,7 @@ and<br>
|
||||
<br><br>
|
||||
This describes whether the graph class allows the insertion of
|
||||
parallel edges (edges with the same source and target). The two tags
|
||||
are <TT>allow_parallel_edge-_tag</TT> and
|
||||
are <TT>allow_parallel_edge_tag</TT> and
|
||||
<TT>disallow_parallel_edge_tag</TT>. The
|
||||
<TT>setS</TT> and <TT>hash_setS</TT> variants disallow
|
||||
parallel edges while the others allow parallel edges.
|
||||
@@ -474,9 +474,9 @@ The type used for dealing with the number of vertices in the graph.
|
||||
|
||||
<hr>
|
||||
|
||||
<tt>graph_traits<adjacency_list>::edge_size_type</tt><br>
|
||||
<tt>graph_traits<adjacency_list>::edges_size_type</tt><br>
|
||||
and<br>
|
||||
<tt>adjacency_list_traits<OutEdgeList, VertexList, Directed_list, EdgeList>::edge_size_type</tt><br>
|
||||
<tt>adjacency_list_traits<OutEdgeList, VertexList, Directed_list, EdgeList>::edges_size_type</tt><br>
|
||||
<br><br>
|
||||
The type used for dealing with the number of edges in the graph.
|
||||
|
||||
@@ -836,7 +836,7 @@ add_edge(vertex_descriptor u, vertex_descriptor v,
|
||||
</pre>
|
||||
Adds edge <i>(u,v)</i> to the graph and attaches <TT>p</TT> as the
|
||||
value of the edge's internal property storage. Also see the previous
|
||||
<TT>add_edge()</TT> member function for more details.
|
||||
<TT>add_edge()</TT> non-member function for more details.
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ matrix representation of an undirected graph.
|
||||
<P></P>
|
||||
<DIV ALIGN="center"><A NAME="fig:undir-adj-matrix-graph"></A>
|
||||
<TABLE>
|
||||
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 1:</STRONG> Adjacency Matrix Representation of an Undirected Graph.</CAPTION>
|
||||
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 2:</STRONG> Adjacency Matrix Representation of an Undirected Graph.</CAPTION>
|
||||
<TR><TD><IMG SRC="./figs/undir-adj-matrix-graph3.gif" width="260" height="240"></TD>
|
||||
<TD><IMG SRC="./figs/undir-adj-matrix2.gif" width="135" height="136"></TD></TR>
|
||||
</TABLE>
|
||||
|
||||
@@ -37,10 +37,28 @@ template <typename VertexListGraph,
|
||||
typename P, typename T, typename R>
|
||||
void
|
||||
astar_search_no_init
|
||||
(const IncidenceGraph &g,
|
||||
typename graph_traits<VertexListGraph>::vertex_descriptor s,
|
||||
<a href="AStarHeuristic.html">AStarHeuristic</a> h, const bgl_named_params<P, T, R>& params);
|
||||
|
||||
template <typename VertexListGraph,
|
||||
typename AStarHeuristic,
|
||||
typename P, typename T, typename R>
|
||||
void
|
||||
astar_search_tree
|
||||
(const VertexListGraph &g,
|
||||
typename graph_traits<VertexListGraph>::vertex_descriptor s,
|
||||
<a href="AStarHeuristic.html">AStarHeuristic</a> h, const bgl_named_params<P, T, R>& params);
|
||||
|
||||
template <typename VertexListGraph,
|
||||
typename AStarHeuristic,
|
||||
typename P, typename T, typename R>
|
||||
void
|
||||
astar_search_no_init_tree
|
||||
(const IncidenceGraph &g,
|
||||
typename graph_traits<VertexListGraph>::vertex_descriptor s,
|
||||
<a href="AStarHeuristic.html">AStarHeuristic</a> h, const bgl_named_params<P, T, R>& params);
|
||||
|
||||
<i>// Non-named parameter interface</i>
|
||||
template <typename VertexListGraph, typename AStarHeuristic,
|
||||
typename <a href="AStarVisitor.html">AStarVisitor</a>, typename PredecessorMap,
|
||||
@@ -60,7 +78,23 @@ astar_search
|
||||
CompareFunction compare, CombineFunction combine,
|
||||
CostInf inf, CostZero zero);
|
||||
|
||||
<i>// Version that does not initialize property maps (used for implicit graphs)</i>
|
||||
template <typename VertexListGraph, typename AStarHeuristic,
|
||||
typename <a href="AStarVisitor.html">AStarVisitor</a>, typename PredecessorMap,
|
||||
typename CostMap, typename DistanceMap,
|
||||
typename WeightMap,
|
||||
typename <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">CompareFunction</a>, typename <a href="http://www.sgi.com/tech/stl/BinaryFunction.html">CombineFunction</a>,
|
||||
typename CostInf, typename CostZero>
|
||||
inline void
|
||||
astar_search_tree
|
||||
(const VertexListGraph &g,
|
||||
typename graph_traits<VertexListGraph>::vertex_descriptor s,
|
||||
AStarHeuristic h, AStarVisitor vis,
|
||||
PredecessorMap predecessor, CostMap cost,
|
||||
DistanceMap distance, WeightMap weight,
|
||||
CompareFunction compare, CombineFunction combine,
|
||||
CostInf inf, CostZero zero);
|
||||
|
||||
<i>// Versions that do not initialize property maps (used for implicit graphs)</i>
|
||||
template <typename IncidenceGraph, typename AStarHeuristic,
|
||||
typename <a href="AStarVisitor.html">AStarVisitor</a>, typename PredecessorMap,
|
||||
typename CostMap, typename DistanceMap,
|
||||
@@ -82,6 +116,22 @@ astar_search_no_init
|
||||
<b>Note that the index_map and color parameters are swapped in
|
||||
astar_search_no_init() relative to astar_search(); the named parameter
|
||||
interfaces are not affected.</b>
|
||||
|
||||
template <typename IncidenceGraph, typename AStarHeuristic,
|
||||
typename <a href="AStarVisitor.html">AStarVisitor</a>, typename PredecessorMap,
|
||||
typename CostMap, typename DistanceMap,
|
||||
typename WeightMap,
|
||||
typename <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">CompareFunction</a>, typename <a href="http://www.sgi.com/tech/stl/BinaryFunction.html">CombineFunction</a>,
|
||||
typename CostInf, typename CostZero>
|
||||
inline void
|
||||
astar_search_no_init_tree
|
||||
(const IncidenceGraph &g,
|
||||
typename graph_traits<IncidenceGraph>::vertex_descriptor s,
|
||||
AStarHeuristic h, AStarVisitor vis,
|
||||
PredecessorMap predecessor, CostMap cost,
|
||||
DistanceMap distance, WeightMap weight,
|
||||
CompareFunction compare, CombineFunction combine,
|
||||
CostInf inf, CostZero zero);
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
@@ -125,7 +175,8 @@ useful for searching large state spaces -- in game-playing scenarios
|
||||
the entire graph. Implicit searches can be performed with this
|
||||
implementation of A* by creating special visitors that generate
|
||||
neighbors of newly-expanded vertices. Please note that
|
||||
<tt>astar_search_no_init()</tt> must be used for implicit graphs; the basic
|
||||
<tt>astar_search_no_init()</tt> or <tt>astar_search_no_init_tree()</tt> must be
|
||||
used for implicit graphs; the basic
|
||||
<tt>astar_search()</tt> function requires a graph that models
|
||||
the <a href="VertexListGraph.html">Vertex List Graph</a> concept. Both
|
||||
versions
|
||||
@@ -134,8 +185,9 @@ href="IncidenceGraph.html">Incidence Graph</a> concept.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
This implementation of A* is based on an OPEN/CLOSED list formulation
|
||||
of the algorithm. Vertices on the OPEN list have been ``discovered''
|
||||
For the non-tree versions of the algorithm,
|
||||
this implementation of A* is based on an OPEN/CLOSED list formulation.
|
||||
Vertices on the OPEN list have been ``discovered''
|
||||
by the algorithm, but not ``expanded'' (we have not discovered their
|
||||
adjacent vertices). Vertices on the CLOSED list have been completely
|
||||
examined by our search (we have expanded them and added their children
|
||||
@@ -146,7 +198,11 @@ avoids ``cycles'' in the state space; the search will not become
|
||||
trapped by loops in the graph. The OPEN/CLOSED lists are implemented
|
||||
using BGL's vertex coloring mechanisms. Vertices in OPEN are colored
|
||||
gray, vertices in CLOSED are colored black, and undiscovered vertices
|
||||
are colored white.
|
||||
are colored white. For the versions of the algorithm whose names end in
|
||||
<tt>_tree</tt>, all vertices are assumed to always be white, leading to
|
||||
checking for repeated vertices being done using the distance map. If a dummy
|
||||
value is used for the distance map and the graph contains cycles, the algorithm
|
||||
will probably enter an infinite loop.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
@@ -292,7 +348,8 @@ IN: <tt>weight_map(WeightMap w_map)</tt>
|
||||
IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<blockquote>
|
||||
This maps each vertex to an integer in the range <tt>[0,
|
||||
num_vertices(g))</tt>. This is necessary for efficient updates of
|
||||
num_vertices(g))</tt>. This is necessary in non-tree versions of the
|
||||
algorithm for efficient updates of
|
||||
the heap data structure when an edge is relaxed. The type
|
||||
<tt>VertexIndexMap</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadablePropertyMap.html"><tt>Readable
|
||||
@@ -338,7 +395,10 @@ UTIL/OUT: <tt>distance_map(DistanceMap d_map)</tt>
|
||||
<tt>combine</tt> function object and the zero object for the
|
||||
identity element. Also the distance value type must have a <a
|
||||
href="http://www.sgi.com/tech/stl/StrictWeakOrdering.html"><tt>StrictWeakOrdering</tt></a>
|
||||
provided by the <tt>compare</tt> function object.<br>
|
||||
provided by the <tt>compare</tt> function object. A
|
||||
<tt>constant_writable_property_map</tt> returning the infinity value can be
|
||||
used for this parameter in tree versions of the algorithm when the graph does
|
||||
not contain a directed cycle.<br>
|
||||
|
||||
<b>Default:</b> <tt>shared_array_property_map</tt>
|
||||
with the same value type as the
|
||||
@@ -355,7 +415,10 @@ UTIL/OUT: <tt>rank_map(CostMap c_map)</tt>
|
||||
<tt>h</tt>) from the vertex to a goal. The type <tt>CostMap</tt>
|
||||
must be a model of <a
|
||||
href="../../property_map/doc/ReadWritePropertyMap.html"><tt>Read/Write
|
||||
Property Map</tt></a>. The vertex descriptor type of the graph
|
||||
Property Map</tt></a> in non-tree versions of the algorithm, and <a
|
||||
href="../../property_map/doc/WritablePropertyMap.html"><tt>Writable Property
|
||||
Map</tt></a> in tree versions of the algorithm. The vertex descriptor type
|
||||
of the graph
|
||||
needs to be usable as the key type of the distance map. The value
|
||||
type of the distance map is the element type of a <a
|
||||
href="./Monoid.html"><tt>Monoid</tt></a> formed with the
|
||||
@@ -364,7 +427,8 @@ UTIL/OUT: <tt>rank_map(CostMap c_map)</tt>
|
||||
href="http://www.sgi.com/tech/stl/StrictWeakOrdering.html"><tt>StrictWeakOrdering</tt></a>
|
||||
provided by the <tt>compare</tt> function object. The value type
|
||||
for this map must be the same as the value type for the distance
|
||||
map.<br>
|
||||
map. In tree versions of the algorithm, <tt>null_property_map</tt> can be
|
||||
used for this parameter.<br>
|
||||
|
||||
<b>Default:</b> <tt>shared_array_property_map</tt>
|
||||
with the same value type as the
|
||||
@@ -375,7 +439,8 @@ UTIL/OUT: <tt>rank_map(CostMap c_map)</tt>
|
||||
UTIL/OUT: <tt>color_map(ColorMap c_map)</tt>
|
||||
<blockquote>
|
||||
|
||||
This is used during the execution of the algorithm to mark the
|
||||
This is used during the execution of non-tree versions of the algorithm to
|
||||
mark the
|
||||
vertices, indicating whether they are on the OPEN or CLOSED lists.
|
||||
The vertices start out white and become gray when they are inserted
|
||||
into the OPEN list. They then turn black when they are examined and
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
bandwidth(const Graph& g, VertexIndexMap index_map)
|
||||
</pre>
|
||||
|
||||
The <b><i>bandwidth</i></b> of an undirected graph is the maximum
|
||||
The <b><i>bandwidth</i></b> of a graph is the maximum
|
||||
distance between two adjacent vertices, with distance measured on a
|
||||
line upon which the vertices have been placed at unit intervals. To
|
||||
put it another way, if the vertices of an undirected graph
|
||||
put it another way, if the vertices of a graph
|
||||
<i>G=(V,E)</i> are each assigned an index from zero to <i>|V| - 1</i>
|
||||
given by <i>index[v]</i>, then the bandwidth of <i>G</i> is<br>
|
||||
<br>
|
||||
|
||||
@@ -120,7 +120,7 @@ IN: <tt>VertexIndexMap vertex_index</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>.
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.<br>
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
</blockquote>
|
||||
|
||||
@@ -266,7 +266,7 @@ IN: <tt>vertex_index_map(VertexIndexMap vertex_index)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>.
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.<br>
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
</blockquote>
|
||||
|
||||
@@ -156,11 +156,11 @@ template.
|
||||
|
||||
@d Concept checking of type parameters
|
||||
@{
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
function_requires< IncidenceGraphConcept<Graph> >();
|
||||
function_requires< WritablePropertyMapConcept<ComponentMap, edge_t> >();
|
||||
function_requires< ReadWritePropertyMapConcept<DiscoverTimeMap, vertex_t> >();
|
||||
function_requires< ReadWritePropertyMapConcept<LowPointMap, vertex_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<ComponentMap, edge_t> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<DiscoverTimeMap, vertex_t> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<LowPointMap, vertex_t> ));
|
||||
@}
|
||||
|
||||
The first step of the algorithm is to initialize the discover times of
|
||||
@@ -286,6 +286,7 @@ S.pop();
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
@<Biconnected Components Algorithm@>
|
||||
|
||||
@@ -338,8 +338,8 @@ main()
|
||||
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 (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter)
|
||||
for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei)
|
||||
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;
|
||||
|
||||
@@ -223,7 +223,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>.
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.<br>
|
||||
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
@@ -305,7 +305,7 @@ The example in <a
|
||||
href="../example/bfs-example.cpp"><TT>example/bfs-example.cpp</TT></a>
|
||||
demonstrates using the BGL Breadth-first search algorithm on the graph
|
||||
from <A HREF="./graph_theory_review.html#fig:bfs-example">Figure
|
||||
5</A>. The file
|
||||
6</A>. The file
|
||||
<a href="../example/bfs-example2.cpp"><TT>example/bfs-example2.cpp</TT></a>
|
||||
contains the same example, except that the <tt>adacency_list</tt>
|
||||
class used has <tt>VertexList</tt> and <tt>EdgeList</tt> set
|
||||
|
||||
@@ -93,7 +93,7 @@ typedef boost::adjacency_list<
|
||||
boost::property<zipcodes_t, std::vector<int> > > >,
|
||||
// Edge properties
|
||||
boost::property<boost::edge_name_t, std::string,
|
||||
boost::property<boost::edge_length_t, double,
|
||||
boost::property<boost::edge_weight_t, double,
|
||||
boost::property<edge_speed_limit_t, int,
|
||||
boost::property<edge_lanes_t, int,
|
||||
boost::property<edge_divided, bool> > > > > >
|
||||
|
||||
@@ -101,8 +101,8 @@ function address(host, user) {
|
||||
<pre>
|
||||
namespace boost {
|
||||
|
||||
template<typename <a href="#Directed">Directed</a> = directedS, typename <a href="#VertexProperty">VertexProperty</a> = void,
|
||||
typename <a href="#EdgeProperty">EdgeProperty</a> = void, typename <a href="#GraphProperty">GraphProperty</a> = no_property,
|
||||
template<typename <a href="#Directed">Directed</a> = directedS, typename <a href="#VertexProperty">VertexProperty</a> = no_property,
|
||||
typename <a href="#EdgeProperty">EdgeProperty</a> = no_property, typename <a href="#GraphProperty">GraphProperty</a> = no_property,
|
||||
typename <a href="#Vertex">Vertex</a> = std::size_t, typename <a href="#EdgeIndex">EdgeIndex</a> = Vertex>
|
||||
class compressed_sparse_row_graph
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>.
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.<br>
|
||||
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
|
||||
@@ -79,7 +79,7 @@ those types that model <a
|
||||
href="./VertexListGraph.html">VertexListGraph</a>. This is enforced by
|
||||
the use of those graph operations in the algorithm, and furthermore by
|
||||
our explicit requirement added as a concept check with
|
||||
<TT>function_requires()</TT> (see Section <A
|
||||
<TT>BOOST_CONCEPT_ASSERT()</TT> (see Section <A
|
||||
HREF="../../concept_check/concept_check.htm">Concept
|
||||
Checking</A> for more details about concept checking).
|
||||
|
||||
@@ -106,7 +106,7 @@ hence the return type of the function is the graph's
|
||||
graph algorithm as a template function, the concept checks, and some
|
||||
typedefs. The implementation is straightforward, the only step not
|
||||
discussed above is the color initialization step, where we set the
|
||||
color of all the vertices to ``uncolored''.
|
||||
color of all the vertices to "uncolored."
|
||||
|
||||
<P>
|
||||
<PRE>
|
||||
@@ -122,11 +122,11 @@ namespace boost {
|
||||
typedef typename property_traits<Color>::value_type ColorType;
|
||||
typedef typename property_traits<Order>::value_type OrderType;
|
||||
|
||||
function_requires< VertexListGraphConcept<VertexListGraph> >();
|
||||
function_requires< ReadWritePropertyMapConcept<Color, vertex_descriptor> >();
|
||||
function_requires< IntegerConcept<ColorType> >();
|
||||
function_requires< size_type, ReadablePropertyMapConcept<Order> >();
|
||||
typedef typename same_type<OrderType, vertex_descriptor>::type req_same;
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<VertexListGraph> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<Color, vertex_descriptor> ));
|
||||
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);
|
||||
@@ -134,7 +134,7 @@ namespace boost {
|
||||
mark(V, numeric_limits_max(max_color));
|
||||
|
||||
typename GraphTraits::vertex_iterator v, vend;
|
||||
for (tie(v, vend) = vertices(G); v != vend; ++v)
|
||||
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++) {
|
||||
@@ -142,7 +142,7 @@ namespace boost {
|
||||
|
||||
// mark all the colors of the adjacent vertices
|
||||
typename GraphTraits::adjacency_iterator ai, aend;
|
||||
for (tie(ai, aend) = adjacent_vertices(current, G); ai != aend; ++ai)
|
||||
for (boost::tie(ai, aend) = adjacent_vertices(current, G); ai != aend; ++ai)
|
||||
mark[color[*ai]] = i;
|
||||
|
||||
// find the smallest color unused by the adjacent vertices
|
||||
|
||||
@@ -80,7 +80,7 @@ integers in the half-open range <tt>[0,num_vertices(G))</tt>.<br>
|
||||
<b>Default:</b> <tt>get(vertex_index, G)</tt>.
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
</blockquote>
|
||||
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Copyright (c) Piotr Wygocki 2013
|
||||
|
||||
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)
|
||||
-->
|
||||
<Head>
|
||||
<Title>Boost Graph Library: Cycle Canceling for Min Cost Max Flow</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
|
||||
<BR Clear>
|
||||
|
||||
<H1><A NAME="sec:cycle_canceling">
|
||||
<TT>cycle_canceling</TT>
|
||||
</H1>
|
||||
|
||||
<PRE>
|
||||
<i>// named parameter version</i>
|
||||
template <class <a href="./Graph.html">Graph</a>, class P, class T, class R>
|
||||
void cycle_canceling(
|
||||
Graph &g,
|
||||
const bgl_named_params<P, T, R> & params = <i>all defaults</i>)
|
||||
|
||||
<i>// non-named parameter version</i>
|
||||
template <class <a href="./Graph.html">Graph</a>, 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)
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
The <tt>cycle_canceling()</tt> function calculates the minimum cost flow of a network with given flow. See Section <a
|
||||
href="./graph_theory_review.html#sec:network-flow-algorithms">Network
|
||||
Flow Algorithms</a> for a description of maximum flow.
|
||||
For given flow values <i> f(u,v)</i> function minimizes flow cost in such a way, that for each <i>v in V</i> the
|
||||
<i> sum<sub> u in V</sub> f(v,u) </i> is preserved. Particularly if the input flow was the maximum flow, the function produces min cost max flow.
|
||||
|
||||
|
||||
The function calculates the flow values <i>f(u,v)</i> for all <i>(u,v)</i> in
|
||||
<i>E</i>, which are returned in the form of the residual capacity
|
||||
<i>r(u,v) = c(u,v) - f(u,v)</i>.
|
||||
|
||||
<p>
|
||||
There are several special requirements on the input graph and property
|
||||
map parameters for this algorithm. First, the directed graph
|
||||
<i>G=(V,E)</i> that represents the network must be augmented to
|
||||
include the reverse edge for every edge in <i>E</i>. That is, the
|
||||
input graph should be <i>G<sub>in</sub> = (V,{E U
|
||||
E<sup>T</sup>})</i>. The <tt>ReverseEdgeMap</tt> argument <tt>rev</tt>
|
||||
must map each edge in the original graph to its reverse edge, that is
|
||||
<i>(u,v) -> (v,u)</i> for all <i>(u,v)</i> in <i>E</i>.
|
||||
The <tt>WeightMap</tt> has to map each edge from <i>E<sup>T</sup></i> to <i>-weight</i> of its reversed edge.
|
||||
Note that edges from <i>E</i> can have negative weights.
|
||||
<p>
|
||||
If weights in the graph are nonnegative, the
|
||||
<a href="./successive_shortest_path_nonnegative_weights.html"><tt>successive_shortest_path_nonnegative_weights()</tt></a>
|
||||
might be better choice for min cost max flow.
|
||||
|
||||
<p>
|
||||
The algorithm is described in <a
|
||||
href="./bibliography.html#ahuja93:_network_flows">Network Flows</a>.
|
||||
|
||||
<p>
|
||||
In each round algorithm augments the negative cycle (in terms of weight) in the residual graph.
|
||||
If there is no negative cycle in the network, the cost is optimized.
|
||||
|
||||
<p>
|
||||
Note that, although we mention capacity in the problem description, the actual algorithm doesn't have to now it.
|
||||
|
||||
<p>
|
||||
In order to find the cost of the result flow use:
|
||||
<a href="./find_flow_cost.html"><tt>find_flow_cost()</tt></a>.
|
||||
|
||||
|
||||
<H3>Where Defined</H3>
|
||||
|
||||
<P>
|
||||
<a href="../../../boost/graph/successive_shortest_path_nonnegative_weights.hpp"><TT>boost/graph/successive_shortest_path_nonnegative_weights.hpp</TT></a>
|
||||
|
||||
<P>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
IN: <tt>Graph& g</tt>
|
||||
<blockquote>
|
||||
A directed graph. The
|
||||
graph's type must be a model of <a
|
||||
href="./VertexListGraph.html">VertexListGraph</a> and <a href="./IncidenceGraph.html">IncidenceGraph</a> For each edge
|
||||
<i>(u,v)</i> in the graph, the reverse edge <i>(v,u)</i> must also
|
||||
be in the graph.
|
||||
</blockquote>
|
||||
|
||||
<h3>Named Parameters</h3>
|
||||
|
||||
|
||||
IN/OUT: <tt>residual_capacity_map(ResidualCapacityEdgeMap res)</tt>
|
||||
<blockquote>
|
||||
This maps edges to their residual capacity. The type must be a model
|
||||
of a mutable <a
|
||||
href="../../property_map/doc/LvaluePropertyMap.html">Lvalue Property
|
||||
Map</a>. The key type of the map must be the graph's edge descriptor
|
||||
type.<br>
|
||||
<b>Default:</b> <tt>get(edge_residual_capacity, g)</tt>
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>reverse_edge_map(ReverseEdgeMap rev)</tt>
|
||||
<blockquote>
|
||||
An edge property map that maps every edge <i>(u,v)</i> in the graph
|
||||
to the reverse edge <i>(v,u)</i>. The map must be a model of
|
||||
constant <a href="../../property_map/doc/LvaluePropertyMap.html">Lvalue
|
||||
Property Map</a>. The key type of the map must be the graph's edge
|
||||
descriptor type.<br>
|
||||
<b>Default:</b> <tt>get(edge_reverse, g)</tt>
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>weight_map(WeightMap w)</tt>
|
||||
<blockquote>
|
||||
The weight (also know as ``length'' or ``cost'') of each edge in the
|
||||
graph. The <tt>WeightMap</tt> type must be a model of <a
|
||||
href="../../property_map/doc/ReadablePropertyMap.html">Readable Property
|
||||
Map</a>. The key type for this property map must be the edge
|
||||
descriptor of the graph. The value type for the weight map must be
|
||||
<i>Addable</i> with the distance map's value type. <br>
|
||||
<b>Default:</b> <tt>get(edge_weight, g)</tt><br>
|
||||
</blockquote>
|
||||
|
||||
UTIL: <tt>predecessor_map(PredEdgeMap pred)</tt>
|
||||
<blockquote>
|
||||
Use by the algorithm to store augmenting paths. The map must be a
|
||||
model of mutable <a
|
||||
href="../../property_map/doc/LvaluePropertyMap.html">Lvalue Property Map</a>.
|
||||
The key type must be the graph's vertex descriptor type and the
|
||||
value type must be the graph's edge descriptor type.<br>
|
||||
|
||||
<b>Default:</b> an <a
|
||||
href="../../property_map/doc/iterator_property_map.html">
|
||||
<tt>iterator_property_map</tt></a> created from a <tt>std::vector</tt>
|
||||
of edge descriptors of size <tt>num_vertices(g)</tt> and
|
||||
using the <tt>i_map</tt> for the index map.
|
||||
</blockquote>
|
||||
|
||||
UTIL: <tt>distance_map(DistanceMap d_map)</tt>
|
||||
<blockquote>
|
||||
The shortest path weight from the source vertex <tt>s</tt> to each
|
||||
vertex in the graph <tt>g</tt> is recorded in this property map. The
|
||||
shortest path weight is the sum of the edge weights along the
|
||||
shortest path. The type <tt>DistanceMap</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadWritePropertyMap.html">Read/Write
|
||||
Property Map</a>. The vertex descriptor type of the graph needs to
|
||||
be usable as the key type of the distance map.
|
||||
|
||||
<b>Default:</b> <a
|
||||
href="../../property_map/doc/iterator_property_map.html">
|
||||
<tt>iterator_property_map</tt></a> created from a
|
||||
<tt>std::vector</tt> of the <tt>WeightMap</tt>'s value type of size
|
||||
<tt>num_vertices(g)</tt> and using the <tt>i_map</tt> for the index
|
||||
map.<br>
|
||||
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<blockquote>
|
||||
Maps each vertex of the graph to a unique integer in the range
|
||||
<tt>[0, num_vertices(g))</tt>. This property map is only needed
|
||||
if the default for the distance or predecessor map is used.
|
||||
The vertex index map must be a model of <a
|
||||
href="../../property_map/doc/ReadablePropertyMap.html">Readable Property
|
||||
Map</a>. The key type of the map must be the graph's vertex
|
||||
descriptor type.<br>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
</blockquote>
|
||||
|
||||
<h3>Complexity</h3>
|
||||
In the integer capacity and weight case, if <i>C</i> is the initial cost of the flow, then the complexity is <i> O(C * |V| * |E|)</i>,
|
||||
where <i>O(|E|* |V|)</i> is the complexity of the bellman ford shortest paths algorithm and <i>C</i> is upper bound on number of iteration.
|
||||
In many real world cases number of iterations is much smaller than <i>C</i>.
|
||||
|
||||
|
||||
<h3>Example</h3>
|
||||
|
||||
The program in <a
|
||||
href="../example/cycle_canceling_example.cpp"><tt>example/cycle_canceling_example.cpp</tt></a>.
|
||||
|
||||
|
||||
<h3>See Also</h3>
|
||||
|
||||
<a href="./successive_shortest_path_nonnegative_weights.html"><tt>successive_shortest_path_nonnegative_weights()</tt></a><br>
|
||||
<a href="./find_flow_cost.html"><tt>find_flow_cost()</tt></a>.
|
||||
|
||||
<br>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR valign=top>
|
||||
<TD nowrap>Copyright © 2013</TD><TD>
|
||||
Piotr Wygocki, University of Warsaw (<A HREF="mailto:wygos@mimuw.edu.pl">wygos at mimuw.edu.pl</A>)
|
||||
</TD></TR></TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
<!-- LocalWords: HTML Siek Edmonds BGCOLOR ffffff ee VLINK ALINK ff IMG SRC
|
||||
-->
|
||||
<!-- LocalWords: gif ALT BR sec edmonds karp TT DIV CELLPADDING TR TD PRE lt
|
||||
-->
|
||||
<!-- LocalWords: typename VertexListGraph CapacityEdgeMap ReverseEdgeMap gt
|
||||
-->
|
||||
<!-- LocalWords: ResidualCapacityEdgeMap VertexIndexMap src rev ColorMap pred
|
||||
-->
|
||||
<!-- LocalWords: PredEdgeMap tt href html hpp ul li nbsp br LvaluePropertyMap
|
||||
-->
|
||||
<!-- LocalWords: num ColorValue DIMACS cpp pre config iostream dimacs int std
|
||||
-->
|
||||
<!-- LocalWords: namespace vecS directedS cout endl iter ei HR valign nowrap
|
||||
-->
|
||||
<!-- LocalWords: jeremy siek htm Univ mailto jsiek lsc edu
|
||||
p -->
|
||||
|
||||
@@ -118,7 +118,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>.
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.<br>
|
||||
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
|
||||
@@ -107,6 +107,7 @@ DFS-VISIT(<i>G</i>, <i>u</i>)
|
||||
<i>...</i>
|
||||
<b>else if</b> (<i>color[v] =</i> BLACK)
|
||||
<i>...</i>
|
||||
<i>...</i>
|
||||
<b>end for</b>
|
||||
<i>color[u] :=</i> BLACK
|
||||
<i>f_time[u] := time := time + 1</i>
|
||||
@@ -140,6 +141,8 @@ examine edge <i>(u,v)</i>
|
||||
-
|
||||
<i>(u,v)</i> is a cross or forward edge
|
||||
-
|
||||
finish edge <i>(u,v)</i>
|
||||
-
|
||||
finish vertex <i>u</i>
|
||||
-
|
||||
</pre>
|
||||
@@ -266,6 +269,9 @@ The time complexity is <i>O(E + V)</i>.
|
||||
<li><b><tt>vis.forward_or_cross_edge(e, g)</tt></b> is invoked on
|
||||
forward or cross edges in the graph. In an undirected graph this
|
||||
method is never called.
|
||||
|
||||
<li><b><tt>vis.finish_edge(e, g)</tt></b> is invoked on the non-tree edges in
|
||||
the graph as well as on each tree edge after its target vertex is finished.
|
||||
|
||||
<li><b><tt>vis.finish_vertex(u, g)</tt></b> is invoked on a vertex after
|
||||
all of its out edges have been added to the search tree and all of
|
||||
|
||||
@@ -239,7 +239,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>.
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
|
||||
@@ -330,7 +330,9 @@ IN: <tt>distance_inf(D inf)</tt>
|
||||
<blockquote>
|
||||
The <tt>inf</tt> object must be the greatest value of any <tt>D</tt> object.
|
||||
That is, <tt>compare(d, inf) == true</tt> for any <tt>d != inf</tt>.
|
||||
The type <tt>D</tt> is the value type of the <tt>DistanceMap</tt>.<br>
|
||||
The type <tt>D</tt> is the value type of the <tt>DistanceMap</tt>. Edges
|
||||
are assumed to have a weight less than (using <tt>distance_compare</tt> for
|
||||
comparison) this value.<br>
|
||||
<b>Default:</b> <tt>std::numeric_limits<D>::max()</tt><br>
|
||||
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
|
||||
@@ -69,7 +69,7 @@ Algorithms</A> for some background to the shortest-path problem.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
<tt>dijkstra_shortest_paths_no_color_map</tt> differs from the original <tt>dijkstra_shortest_paths</tt> algorithm by not using a color map to identify vertices as discovered or undiscovered. Instead, this is done with the distance map: a vertex <i>u</i> such that <i>distance_compare(distance_map[u], distance_infinity) == false</i> is considered to be undiscovered.
|
||||
<tt>dijkstra_shortest_paths_no_color_map</tt> differs from the original <tt>dijkstra_shortest_paths</tt> algorithm by not using a color map to identify vertices as discovered or undiscovered. Instead, this is done with the distance map: a vertex <i>u</i> such that <i>distance_compare(distance_map[u], distance_infinity) == false</i> is considered to be undiscovered. Note that this means that edges with infinite weight will not work correctly in this algorithm.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
@@ -116,10 +116,6 @@ indicated by the labels on the right.
|
||||
<td valign="top">
|
||||
<pre>
|
||||
DIJKSTRA(<i>G</i>, <i>s</i>, <i>w</i>)
|
||||
<b>for</b> each vertex <i>u in V</i> <b>(This loop is not run in dijkstra_shortest_paths_no_color_map_no_init)</b>
|
||||
<i>d[u] := infinity</i>
|
||||
<i>p[u] := u</i>
|
||||
<b>end for</b>
|
||||
<i>d[s] := 0</i>
|
||||
INSERT(<i>Q</i>, <i>s</i>)
|
||||
<b>while</b> (<i>Q != Ø</i>)
|
||||
@@ -128,11 +124,12 @@ DIJKSTRA(<i>G</i>, <i>s</i>, <i>w</i>)
|
||||
<b>if</b> (<i>w(u,v) + d[u] < d[v]</i>)
|
||||
<i>d[v] := w(u,v) + d[u]</i>
|
||||
<i>p[v] := u</i>
|
||||
DECREASE-KEY(<i>Q</i>, <i>v</i>)
|
||||
<b>if</b> (<i>d[v]</i> was originally infinity)
|
||||
INSERT(<i>Q</i>, <i>v</i>)
|
||||
<b>else</b>
|
||||
DECREASE-KEY(<i>Q</i>, <i>v</i>)
|
||||
<b>else</b>
|
||||
...
|
||||
<b>if</b> (<i>d[v]</i> was originally infinity)
|
||||
INSERT(<i>Q</i>, <i>v</i>)
|
||||
<b>end for</b>
|
||||
<b>end while</b>
|
||||
return (<i>d</i>, <i>p</i>)
|
||||
@@ -141,10 +138,6 @@ DIJKSTRA(<i>G</i>, <i>s</i>, <i>w</i>)
|
||||
<td valign="top">
|
||||
<pre>
|
||||
|
||||
initialize vertex <i>u</i>
|
||||
|
||||
|
||||
|
||||
|
||||
discover vertex <i>s</i>
|
||||
|
||||
@@ -154,10 +147,11 @@ examine edge <i>(u,v)</i>
|
||||
edge <i>(u,v)</i> relaxed
|
||||
|
||||
|
||||
discover vertex <i>v</i>
|
||||
|
||||
|
||||
edge <i>(u,v)</i> not relaxed
|
||||
|
||||
discover vertex <i>v</i>
|
||||
finish vertex <i>u</i>
|
||||
</pre>
|
||||
</td>
|
||||
@@ -214,7 +208,7 @@ IN: <tt>index_map(VertexIndexMap index_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, graph)</tt>.
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
</blockquote>
|
||||
@@ -293,7 +287,9 @@ IN: <tt>distance_inf(D distance_infinity)</tt>
|
||||
<blockquote>
|
||||
The <tt>distance_infinity</tt> object must be the greatest value of any <tt>D</tt> object.
|
||||
That is, <tt>distance_compare(d, distance_infinity) == true</tt> for any <tt>d != distance_infinity</tt>.
|
||||
The type <tt>D</tt> is the value type of the <tt>DistanceMap</tt>.<br>
|
||||
The type <tt>D</tt> is the value type of the <tt>DistanceMap</tt>. All edges
|
||||
are assumed to have weight less than (by <tt>distance_compare</tt>) this
|
||||
value.<br>
|
||||
<b>Default:</b> <tt>std::numeric_limits<D>::max()</tt><br>
|
||||
</blockquote>
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Copyright (c) David Doria 2012
|
||||
|
||||
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)
|
||||
-->
|
||||
<Head>
|
||||
<Title>Boost Graph Library: Directed Graph</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
|
||||
<BR Clear>
|
||||
|
||||
<H1><A NAME="sec:directed-graph-class"></A>
|
||||
<pre>
|
||||
directed_graph<VertexProp, EdgeProp, GraphProp>
|
||||
</pre>
|
||||
</H1>
|
||||
|
||||
|
||||
<P>
|
||||
The <tt>directed_graph</tt> class template is a simplified version
|
||||
of the BGL adjacency list. This class is provided for ease of use, but
|
||||
may not perform as well as custom-defined adjacency list classes. Instances
|
||||
of this template model the BidirectionalGraph, VertexIndexGraph, and
|
||||
EdgeIndexGraph concepts.
|
||||
|
||||
<H3>Example</H3>
|
||||
|
||||
A simple examples of creating a directed_graph is available here <a href="../../../libs/graph/example/directed_graph.cpp"><tt>libs/graph/example/directed_graph.cpp</tt></a>.
|
||||
<P>
|
||||
|
||||
|
||||
<PRE>
|
||||
typedef boost::directed_graph<> Graph;
|
||||
Graph g;
|
||||
boost::graph_traits<Graph>::vertex_descriptor v0 = g.add_vertex();
|
||||
boost::graph_traits<Graph>::vertex_descriptor v1 = g.add_vertex();
|
||||
|
||||
g.add_edge(v0, v1);
|
||||
</PRE>
|
||||
|
||||
<H3>Template Parameters</H3>
|
||||
|
||||
<P>
|
||||
<TABLE border>
|
||||
<TR>
|
||||
<th>Parameter</th><th>Description</th><th>Default</th>
|
||||
</tr>
|
||||
|
||||
<TR><TD><TT>VertexProp</TT></TD>
|
||||
<TD>A property map for the graph vertices.</TD>
|
||||
<TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><TT>EdgeProp</TT></TD>
|
||||
<TD>A property map for the graph edges.</TD>
|
||||
<TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><TT>GraphProp</TT></TD>
|
||||
<TD>A property map for the graph itself.</TD>
|
||||
</TR>
|
||||
|
||||
</TABLE>
|
||||
<P>
|
||||
|
||||
<H3>Where Defined</H3>
|
||||
|
||||
<P>
|
||||
<a href="../../../boost/graph/directed_graph.hpp"><TT>boost/graph/directed_graph.hpp</TT></a>
|
||||
|
||||
<P>
|
||||
|
||||
<br>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR valign=top>
|
||||
<TD nowrap>Copyright © 2000-2001</TD><TD>
|
||||
<A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>,
|
||||
Indiana University (<A
|
||||
HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br>
|
||||
<A HREF="http://www.boost.org/people/liequan_lee.htm">Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee@cs.indiana.edu">llee@cs.indiana.edu</A>)<br>
|
||||
<A HREF="http://www.osl.iu.edu/~lums">Andrew Lumsdaine</A>,
|
||||
Indiana University (<A
|
||||
HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>)
|
||||
</TD></TR></TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -153,7 +153,7 @@ A convenient way to create a <tt>distance_recorder</tt>.
|
||||
<a href="./visitor_concepts.html">Visitor concepts</a>
|
||||
<p>
|
||||
The following are other event visitors: <a
|
||||
href="./distance_recorder.html"><tt>predecessor_recorder</tt></a>,
|
||||
href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a>,
|
||||
<a href="./time_stamper.html"><tt>time_stamper</tt></a>,
|
||||
and <a href="./property_writer.html"><tt>property_writer</tt></a>.
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<HTML>
|
||||
<!--
|
||||
~~ Copyright (c) Maciej Piechotka 2013
|
||||
~~
|
||||
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)
|
||||
-->
|
||||
|
||||
|
||||
<Head>
|
||||
<Title>Boost Graph Library: Edge Coloring</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
|
||||
<BR Clear>
|
||||
|
||||
<H1>
|
||||
<!-- <img src="figs/python.gif" alt="(Python)"/> -->
|
||||
<TT>edge_coloring</TT>
|
||||
</H1>
|
||||
|
||||
|
||||
<P>
|
||||
<DIV ALIGN="LEFT">
|
||||
<TABLE CELLPADDING=3 border>
|
||||
<TR><TH ALIGN="LEFT"><B>Graphs:</B></TH>
|
||||
<TD ALIGN="LEFT">undirected, loop-free</TD>
|
||||
</TR>
|
||||
<TR><TH ALIGN="LEFT"><B>Properties:</B></TH>
|
||||
<TD ALIGN="LEFT">color</TD>
|
||||
</TR>
|
||||
<TR><TH ALIGN="LEFT"><B>Complexity:</B></TH>
|
||||
<TD ALIGN="LEFT">time: <i>O(|E| |V|)</i> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</DIV>
|
||||
|
||||
|
||||
<pre>
|
||||
template <class Graph, class ColorMap>
|
||||
typename boost::property_traits<ColorMap>::value_type
|
||||
edge_coloring(const Graph &g, ColorMap color);
|
||||
</pre>
|
||||
|
||||
<p>Computes an edge coloring for the vertices in the graph, using
|
||||
an algorithm proposed by Misra et al. []. Given edges ordered
|
||||
e<sub>1</sub>, e<sub>2</sub>, ..., e<sub>n</sub> it assignes a
|
||||
colors c<sub>1</sub>, c<sub>2</sub>, ..., c<sub>n</sub> in a way
|
||||
that no vertex connects with 2 edges of the same color. Furthermore
|
||||
at most m + 1 colors are used.
|
||||
|
||||
<!-- King, I.P. An automatic reordering scheme for simultaneous equations derived from network analysis. Int. J. Numer. Methods Engrg. 2 (1970), 523-533 -->
|
||||
|
||||
<h3>Where defined</h3>
|
||||
<a href="../../../boost/graph/edge_coloring.hpp"><tt>boost/graph/edge_coloring.hpp</tt></a>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
IN: <tt>const Graph& g</tt>
|
||||
<blockquote>
|
||||
The graph object on which the algorithm will be applied. The type
|
||||
<tt>Graph</tt> must be a model of <a href="EdgeListGraph.html">
|
||||
Edge List Graph</a> and <a href="IncidenceGraph.html">Incidence
|
||||
Graph</a>.
|
||||
</blockquote>
|
||||
|
||||
OUT: <tt>ColorMap color</tt>
|
||||
<blockquote>
|
||||
This property map records the colors of each edges. It must be a
|
||||
model of <A HREF="../../property_map/doc/ReadWritePropertyMap.html">
|
||||
Read/Write Property Map</A> whose key type is the same as the edge
|
||||
descriptor type of the graph and whose value type is an integral type
|
||||
that can store all values smaller or equal to m.
|
||||
</blockquote>
|
||||
|
||||
|
||||
<h3>Example</h3>
|
||||
|
||||
See <A
|
||||
href="../example/edge_coloring.cpp"><tt>example/king_ordering.cpp</tt></A>.
|
||||
|
||||
<h3>See Also</h3>
|
||||
|
||||
<A href="./sequential_vertex_coloring.html">sequential vertex ordering</tt></A>.
|
||||
|
||||
<br>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR valign=top>
|
||||
<TD nowrap>Copyright © 2013</TD><TD>
|
||||
Maciej Piechotka (<A HREF="mailto:uzytkownik2@gmail.com">uzytkownik2@gmail.com</A>)
|
||||
</TD></TR></TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -0,0 +1,197 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
|
||||
|
||||
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)
|
||||
-->
|
||||
<Head>
|
||||
<Title>Boost Graph Library: edge_predecessor_recorder</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
|
||||
<BR Clear>
|
||||
|
||||
<H1>
|
||||
<pre>
|
||||
edge_predecessor_recorder<PredEdgeMap, EventTag>
|
||||
</pre>
|
||||
</H1>
|
||||
|
||||
This is an <a href="./EventVisitor.html">EventVisitor</a> that records
|
||||
the predecessor (or parent) edge of a vertex in a property
|
||||
map. This is particularly useful in graph search algorithms where
|
||||
recording the predecessors is an efficient way to encode the search
|
||||
tree that was traversed during the search. The edge predecessor recorder is
|
||||
typically used with the <tt>on_tree_edge</tt> or
|
||||
<tt>on_relax_edge</tt> events and cannot be used with vertex events. This
|
||||
visitor is meant to be used instead of <a
|
||||
href="predecessor_recorder.html"><tt>predecessor_recorder</tt></a> when a
|
||||
graph has parallel edges and it is necessary to know which incoming edge a
|
||||
search algorithm
|
||||
used to get to a particular vertex.
|
||||
|
||||
<p>
|
||||
<tt>edge_predecessor_recorder</tt> can be used with graph algorithms by
|
||||
wrapping it with an algorithm-specific adaptor, such as <a
|
||||
href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a
|
||||
href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event
|
||||
visitor can be combined with other event visitors using
|
||||
<tt>std::pair</tt> to form an EventVisitorList.
|
||||
|
||||
<p>
|
||||
Algorithms such as Dijkstra's and breadth-first search will not assign
|
||||
a predecessor edge to the source vertex (which is the root of the search
|
||||
tree). It is often useful to initialize the source vertex's
|
||||
predecessor to a special value, thereby identifying the root vertex.
|
||||
When using an algorithm like
|
||||
depth-first search that creates a forest (multiple search trees) it
|
||||
is useful to do the same for every vertex. This
|
||||
way all the root nodes can be distinguished.
|
||||
|
||||
|
||||
<!-- <h3>Example</h3>
|
||||
|
||||
See the example for <a href="./bfs_visitor.html"><tt>bfs_visitor</tt></a>.
|
||||
-->
|
||||
|
||||
<h3>Model of</h3>
|
||||
|
||||
<a href="./EventVisitor.html">EventVisitor</a>
|
||||
|
||||
|
||||
<H3>Where Defined</H3>
|
||||
|
||||
<P>
|
||||
<a href="../../../boost/graph/visitors.hpp">
|
||||
<TT>boost/graph/visitors.hpp</TT></a>
|
||||
|
||||
<H3>Template Parameters</H3>
|
||||
|
||||
<P>
|
||||
<TABLE border>
|
||||
<TR>
|
||||
<th>Parameter</th><th>Description</th><th>Default</th>
|
||||
</tr>
|
||||
|
||||
<TR><TD><TT>PredEdgeMap</TT></TD>
|
||||
<TD>
|
||||
A <a
|
||||
href="../../property_map/doc/WritablePropertyMap.html">WritablePropertyMap</a>
|
||||
where the key and value types are the vertex and edge descriptor types, respectively, of the graph.
|
||||
</TD>
|
||||
<TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD><TT>EventTag</TT></TD>
|
||||
<TD>
|
||||
The tag to specify when the <tt>edge_predecessor_recorder</tt> should be
|
||||
applied during the graph algorithm. <tt>EventTag</tt> must be an
|
||||
edge event.
|
||||
</TD>
|
||||
<TD> </TD>
|
||||
</TR>
|
||||
|
||||
</table>
|
||||
|
||||
<H2>Associated Types</H2>
|
||||
|
||||
<table border>
|
||||
|
||||
<tr>
|
||||
<th>Type</th><th>Description</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><tt>edge_predecessor_recorder::event_filter</tt></td>
|
||||
<td>
|
||||
This will be the same type as the template parameter <tt>EventTag</tt>.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h3>Member Functions</h3>
|
||||
|
||||
<p>
|
||||
|
||||
<table border>
|
||||
<tr>
|
||||
<th>Member</th><th>Description</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><tt>
|
||||
edge_predecessor_recorder(PredEdgeMap pa);
|
||||
</tt></td>
|
||||
<td>
|
||||
Construct an edge predecessor recorder object with predecessor property map
|
||||
<tt>pa</tt>.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><tt>
|
||||
template <class Edge, class Graph><br>
|
||||
void operator()(Edge e, const Graph& g);
|
||||
</tt></td>
|
||||
<td>
|
||||
Given edge <i>e = (u,v)</i>, this records <i>e</i> as the
|
||||
predecessor (or parent) edge of <i>v</i>.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h3>Non-Member Functions</h3>
|
||||
|
||||
<table border>
|
||||
<tr>
|
||||
<th>Function</th><th>Description</th>
|
||||
</tr>
|
||||
|
||||
<tr><td><tt>
|
||||
template <class PredEdgeMap, class Tag><br>
|
||||
edge_predecessor_recorder<PredEdgeMap, Tag> <br>
|
||||
record_edge_predecessors(PredEdgeMap pa, Tag);
|
||||
</tt></td><td>
|
||||
A convenient way to create a <tt>edge_predecessor_recorder</tt>.
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h3>See Also</h3>
|
||||
|
||||
<a href="./visitor_concepts.html">Visitor concepts</a>
|
||||
<p>
|
||||
The following are other event visitors: <a
|
||||
<a href="./distance_recorder.html"><tt>distance_recorder</tt></a>,
|
||||
<a href="./time_stamper.html"><tt>time_stamper</tt></a>,
|
||||
and <a href="./property_writer.html"><tt>property_writer</tt></a>.
|
||||
|
||||
|
||||
<br>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR valign=top>
|
||||
<TD nowrap>Copyright © 2000-2001</TD><TD>
|
||||
<A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>,
|
||||
Indiana University (<A
|
||||
HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br>
|
||||
<A HREF="http://www.boost.org/people/liequan_lee.htm">Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee@cs.indiana.edu">llee@cs.indiana.edu</A>)<br>
|
||||
<A HREF="http://www.osl.iu.edu/~lums">Andrew Lumsdaine</A>,
|
||||
Indiana University (<A
|
||||
HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>)
|
||||
</TD></TR></TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
<!-- LocalWords: PredEdgeMap EventTag EventVisitor map bfs dfs const
|
||||
-->
|
||||
<!-- LocalWords: EventVisitorList WritablePropertyMap Siek Univ Quan
|
||||
-->
|
||||
<!-- LocalWords: Lumsdaine
|
||||
-->
|
||||
@@ -195,7 +195,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
</blockquote>
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ library. OO was hip in the 80s and 90s, but its time we moved beyond!
|
||||
// initialize the vertex_index property values
|
||||
graph_traits<graph_t>::vertex_iterator vi, vend;
|
||||
graph_traits<graph_t>::vertices_size_type cnt = 0;
|
||||
for(tie(vi,vend) = vertices(G); vi != vend; ++vi)
|
||||
for(boost::tie(vi,vend) = vertices(G); vi != vend; ++vi)
|
||||
put(index, *vi, cnt++);
|
||||
</pre>
|
||||
</li>
|
||||
@@ -124,8 +124,8 @@ library. OO was hip in the 80s and 90s, but its time we moved beyond!
|
||||
not being found, such as:
|
||||
<pre>
|
||||
../../../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 & ==
|
||||
boost::detail::error_property_not_found &'
|
||||
</pre>
|
||||
or a message such as:
|
||||
<pre>
|
||||
|
||||
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
@@ -233,7 +233,7 @@ it depends on.
|
||||
if (in_degree (*i, g) > 0) {
|
||||
Graph::in_edge_iterator j, j_end;
|
||||
int maxdist = 0;
|
||||
for (tie(j, j_end) = in_edges(*i, g); j != j_end; ++j)
|
||||
for (boost::tie(j, j_end) = in_edges(*i, g); j != j_end; ++j)
|
||||
maxdist = std::max(time[source(*j, g)], maxdist);
|
||||
time[*i]=maxdist+1;
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ The type used for dealing with the number of vertices in the graph.
|
||||
|
||||
<hr>
|
||||
|
||||
<tt>graph_traits<filtered_graph>::edge_size_type</tt>
|
||||
<tt>graph_traits<filtered_graph>::edges_size_type</tt>
|
||||
<br><br>
|
||||
The type used for dealing with the number of edges in the graph.
|
||||
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Copyright (c) Piotr Wygocki 2013
|
||||
|
||||
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)
|
||||
-->
|
||||
<Head>
|
||||
<Title>Boost Graph Library: Find Flow Cost</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
|
||||
<BR Clear>
|
||||
|
||||
<H1><A NAME="sec:find_flow_cost">
|
||||
<TT>find_flow_cost</TT>
|
||||
</H1>
|
||||
|
||||
<PRE>
|
||||
<i>// named parameter version</i>
|
||||
template <class <a href="./Graph.html">Graph</a>>
|
||||
typename property_traits<typename property_map < Graph, edge_capacity_t >::type>::value_type
|
||||
find_flow_cost(const Graph & g,
|
||||
const bgl_named_params<P, T, R> & params = <i>all defaults</i>)
|
||||
|
||||
<i>// non-named parameter version</i>
|
||||
template<class <a href="./Graph.html">Graph</a>, 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)
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
The <tt>find_flow_cost()</tt> function calculates the minimum cost maximum flow value of a network and given flow. See Section <a
|
||||
href="./graph_theory_review.html#sec:network-flow-algorithms">Network
|
||||
Flow Algorithms</a> for a description of maximum flow.
|
||||
The function calculates the cost from the flow values <i>f(u,v)</i> for <i>(u,v)</i> in
|
||||
<i>E</i>, which are passed in the form of the residual capacity
|
||||
<i>r(u,v) = c(u,v) - f(u,v)</i>.
|
||||
|
||||
<p>
|
||||
In order to compute the min cost max flow use :
|
||||
<a href="./successive_shortest_path_nonnegative_weights.html"><tt>successive_shortest_path_nonnegative_weights()</tt></a> or
|
||||
<a href="./cycle_canceling.html"><tt>cycle_canceling()</tt></a>.
|
||||
|
||||
<H3>Where Defined</H3>
|
||||
|
||||
<P>
|
||||
<a href="../../../boost/graph/successive_shortest_path_nonnegative_weights.hpp"><TT>boost/graph/successive_shortest_path_nonnegative_weights.hpp</TT></a>
|
||||
|
||||
<P>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
IN: <tt>const Graph& g</tt>
|
||||
<blockquote>
|
||||
A directed graph. The
|
||||
graph's type must be a model of <a
|
||||
href="./VertexListGraph.html">VertexListGraph</a> and <a href="./IncidenceGraph.html">IncidenceGraph</a> For each edge
|
||||
<i>(u,v)</i> in the graph, the reverse edge <i>(v,u)</i> must also
|
||||
be in the graph.
|
||||
</blockquote>
|
||||
<h3>Named Parameters</h3>
|
||||
|
||||
|
||||
IN: <tt>capacity_map(CapacityEdgeMap cap)</tt>
|
||||
<blockquote>
|
||||
The edge capacity property map. The type must be a model of a
|
||||
constant <a
|
||||
href="../../property_map/doc/LvaluePropertyMap.html">Lvalue Property Map</a>. The
|
||||
key type of the map must be the graph's edge descriptor type.<br>
|
||||
<b>Default:</b> <tt>get(edge_capacity, g)</tt>
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>residual_capacity_map(ResidualCapacityEdgeMap res)</tt>
|
||||
<blockquote>
|
||||
This maps edges to their residual capacity. The type must be a model
|
||||
of a mutable <a
|
||||
href="../../property_map/doc/LvaluePropertyMap.html">Lvalue Property
|
||||
Map</a>. The key type of the map must be the graph's edge descriptor
|
||||
type.<br>
|
||||
<b>Default:</b> <tt>get(edge_residual_capacity, g)</tt>
|
||||
</blockquote>
|
||||
|
||||
|
||||
IN: <tt>weight_map(WeightMap w_map)</tt>
|
||||
<blockquote>
|
||||
The weight or ``cost'' of each edge in the graph.
|
||||
The type <tt>WeightMap</tt> must be a model of
|
||||
<a href="../../property_map/doc/ReadablePropertyMap.html">Readable Property Map</a>. The edge descriptor type of
|
||||
the graph needs to be usable as the key type for the weight
|
||||
map. The value type for this map must be
|
||||
the same as the value type of the distance map.<br>
|
||||
<b>Default:</b> <tt>get(edge_weight, g)</tt><br>
|
||||
|
||||
</blockquote>
|
||||
|
||||
<h3>Complexity</h3>
|
||||
The complexity is <i> O(|E|)</i>,
|
||||
|
||||
<h3>Example</h3>
|
||||
|
||||
The function is used in the successive_shortest_path_nonnegative_weights example. The program in <a
|
||||
href="../example/successive_shortest_path_nonnegative_weights_example.cpp"><tt>example/successive_shortest_path_nonnegative_weights_example.cpp</tt></a>.
|
||||
|
||||
<h3>See Also</h3>
|
||||
|
||||
<a href="./cycle_canceling.html"><tt>cycle_canceling()</tt></a><br>
|
||||
<a href="./successive_shortest_path_nonnegative_weights.html"><tt>successive_shortest_path_nonnegative_weights()</tt></a>.
|
||||
|
||||
<br>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR valign=top>
|
||||
<TD nowrap>Copyright © 2013</TD><TD>
|
||||
Piotr Wygocki, University of Warsaw (<A HREF="mailto:wygos@mimuw.edu.pl">wygos at mimuw.edu.pl</A>)
|
||||
</TD></TR></TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
<!-- LocalWords: HTML Siek Edmonds BGCOLOR ffffff ee VLINK ALINK ff IMG SRC
|
||||
-->
|
||||
<!-- LocalWords: gif ALT BR sec edmonds karp TT DIV CELLPADDING TR TD PRE lt
|
||||
-->
|
||||
<!-- LocalWords: typename VertexListGraph CapacityEdgeMap ReverseEdgeMap gt
|
||||
-->
|
||||
<!-- LocalWords: ResidualCapacityEdgeMap VertexIndexMap src rev ColorMap pred
|
||||
-->
|
||||
<!-- LocalWords: PredEdgeMap tt href html hpp ul li nbsp br LvaluePropertyMap
|
||||
-->
|
||||
<!-- LocalWords: num ColorValue DIMACS cpp pre config iostream dimacs int std
|
||||
-->
|
||||
<!-- LocalWords: namespace vecS directedS cout endl iter ei HR valign nowrap
|
||||
-->
|
||||
<!-- LocalWords: jeremy siek htm Univ mailto jsiek lsc edu
|
||||
p -->
|
||||
|
||||
@@ -198,7 +198,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
<b>Python:</b> Unsupported parameter.
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace boost {
|
||||
const size_type num = num_vertices(G);
|
||||
|
||||
typename GraphTraits::vertex_iterator v, vend;
|
||||
for (tie(v, vend) = vertices(G); v != vend; ++v) {
|
||||
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);
|
||||
@@ -152,7 +152,7 @@ namespace boost {
|
||||
put(marker, node, 0); //node has been ordered.
|
||||
|
||||
typename GraphTraits::adjacency_iterator v, vend;
|
||||
for (tie(v,vend) = adjacent_vertices(node, G); v != vend; ++v)
|
||||
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
|
||||
|
||||
@@ -396,7 +396,7 @@ disregard the directionality in the function names. The example below
|
||||
demonstrates using the <TT>out_edges()</TT>, <TT>source()</TT>, and
|
||||
<TT>target()</TT> with an undirected graph. The source code for this
|
||||
example and the following one can be found in <a
|
||||
href="../example/undirected.cpp"><TT>examples/undirected.cpp</TT></a>.
|
||||
href="../example/undirected_adjacency_list.cpp"><TT>example/undirected_adjacency_list.cpp</TT></a>.
|
||||
|
||||
<P>
|
||||
<PRE>
|
||||
@@ -408,7 +408,7 @@ href="../example/undirected.cpp"><TT>examples/undirected.cpp</TT></a>.
|
||||
boost::graph_traits<UndirectedGraph>::out_edge_iterator e, e_end;
|
||||
boost::graph_traits<UndirectedGraph>::vertex_descriptor
|
||||
s = vertex(0, undigraph);
|
||||
for (tie(e, e_end) = out_edges(s, undigraph); e != e_end; ++e)
|
||||
for (boost::tie(e, e_end) = out_edges(s, undigraph); e != e_end; ++e)
|
||||
std::cout << "(" << source(*e, undigraph)
|
||||
<< "," << target(*e, undigraph) << ")" << endl;
|
||||
</PRE>
|
||||
@@ -447,8 +447,8 @@ of <i>(v,u)</i> since they are the same edge.
|
||||
add_edge(digraph, v, u, Weight(2.4));
|
||||
boost::graph_traits<DirectedGraph>::edge_descriptor e1, e2;
|
||||
bool found;
|
||||
tie(e1, found) = edge(u, v, digraph);
|
||||
tie(e2, found) = edge(v, u, digraph);
|
||||
boost::tie(e1, found) = edge(u, v, digraph);
|
||||
boost::tie(e2, found) = edge(v, u, digraph);
|
||||
std::cout << "in a directed graph is ";
|
||||
std::cout << "(u,v) == (v,u) ? " << (e1 == e2) << std::endl;
|
||||
|
||||
@@ -464,8 +464,8 @@ of <i>(v,u)</i> since they are the same edge.
|
||||
add_edge(undigraph, u, v, Weight(3.1));
|
||||
boost::graph_traits<UndirectedGraph>::edge_descriptor e1, e2;
|
||||
bool found;
|
||||
tie(e1, found) = edge(u, v, undigraph);
|
||||
tie(e2, found) = edge(v, u, undigraph);
|
||||
boost::tie(e1, found) = edge(u, v, undigraph);
|
||||
boost::tie(e2, found) = edge(v, u, undigraph);
|
||||
std::cout << "in an undirected graph is ";
|
||||
std::cout << "(u,v) == (v,u) ? " << (e1 == e2) << std::endl;
|
||||
|
||||
|
||||
@@ -552,6 +552,9 @@ f(u,v)</i>. The edges with <i>r(u,v) > 0</i> are residual edges
|
||||
The <b><i>maximum flow problem</i></b> is to determine the maximum
|
||||
possible value for <i>|f|</i> and the corresponding flow values for
|
||||
every vertex pair in the graph.
|
||||
<p>
|
||||
The <b><i>minimum cost maximum flow problem</i></b> is to determine the maximum flow which minimizes <i> sum<sub>(u,v) in E</sub>
|
||||
cost(u,v) * f(u,v) </i>.
|
||||
|
||||
<p>
|
||||
A flow network is shown in <a href="#fig:max-flow">Figure
|
||||
|
||||
@@ -218,7 +218,7 @@ vertices in the graph.
|
||||
|
||||
<tr>
|
||||
<td><tt>
|
||||
edge_size_type
|
||||
edges_size_type
|
||||
</tt></td>
|
||||
<td>
|
||||
The unsigned integer type used for representing the number of
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<p>
|
||||
Defined in
|
||||
<a href="../../../boost/graph/grid_graph.hpp"><tt>boost/graph/grid_graph.hpp</tt></a>
|
||||
with all functions in the <tt>boost</tt> namespace. All examples are available in a single program file in <a href="../../../libs/graph/example/grid_graph_example.cpp"><tt>libs/graph/example/grid_graph_example.cpp</tt></a>
|
||||
with all functions in the <tt>boost</tt> namespace. A simple examples of creating and iterating over a grid_graph is available here <a href="../../../libs/graph/example/grid_graph_example.cpp"><tt>libs/graph/example/grid_graph_example.cpp</tt></a>. An example of adding properties to a grid_graph is also available <a href="../../../libs/graph/example/grid_graph_example.cpp"><tt>libs/graph/example/grid_graph_properties.cpp</tt></a>
|
||||
</p>
|
||||
|
||||
<h4>Template Parameters</h4>
|
||||
@@ -81,13 +81,13 @@
|
||||
</pre>
|
||||
<ul>
|
||||
<li>
|
||||
<tt>Dimensions</tt> - Number of dimensions in the graph, <b>must be greater than 2</b>
|
||||
<tt>Dimensions</tt> - Number of dimensions in the graph
|
||||
</li>
|
||||
<li>
|
||||
<tt>VertexIndex</tt> - Type used for vertex indices, defaults to std::size_t
|
||||
<tt>VertexIndex</tt> - Type used for vertex indices, defaults to <tt>std::size_t</tt>
|
||||
</li>
|
||||
<li>
|
||||
<tt>EdgeIndex</tt> - Type used for edge indices, defaults to the same type as VertexIndex
|
||||
<tt>EdgeIndex</tt> - Type used for edge indices, defaults to the same type as <tt>VertexIndex</tt>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -161,7 +161,8 @@ IN: <tt>double learning_constant_final</tt>
|
||||
IN: <tt>VertexIndexMap vertex_index_map</tt>
|
||||
<blockquote>
|
||||
This maps each vertex to an integer in the range <tt>[0,
|
||||
num_vertices(g))</tt>.
|
||||
num_vertices(g))</tt>. This is only necessary when no
|
||||
displacement map is provided.
|
||||
The type <tt>VertexIndexMap</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadablePropertyMap.html">Readable Property
|
||||
Map</a>. The value type of the map must be an integer type. The
|
||||
@@ -170,15 +171,13 @@ IN: <tt>VertexIndexMap vertex_index_map</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>EdgeWeightMap weight</tt>
|
||||
<blockquote>
|
||||
This maps each edge to an weight.
|
||||
num_vertices(g))</tt>. This is only necessary when no
|
||||
displacement map is provided.
|
||||
This maps each edge to a weight.
|
||||
The type <tt>EdgeWeightMap</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadablePropertyMap.html">Readable Property
|
||||
Map</a>. The value type of the map must be an floating-point type
|
||||
@@ -221,7 +220,7 @@ Equivalent to the non-named <tt>vertex_index_map</tt> parameter.<br>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
</blockquote>
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<!--
|
||||
Copyright (c) 2013-2015 Louis Dionne
|
||||
|
||||
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)
|
||||
-->
|
||||
|
||||
<p><body bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b" alink="#ff0000"></p>
|
||||
|
||||
<p><img src="../../../boost.png" alt="C++ Boost" /></p>
|
||||
|
||||
<h1 id="hawick_circuits"><code>hawick_circuits</code></h1>
|
||||
|
||||
<pre><code>template <typename Graph, typename Visitor, typename VertexIndexMap>
|
||||
void hawick_circuits(Graph const& graph, Visitor visitor, VertexIndexMap const& vim = get(vertex_index, graph));
|
||||
|
||||
template <typename Graph, typename Visitor, typename VertexIndexMap>
|
||||
void hawick_unique_circuits(Graph const& graph, Visitor visitor, VertexIndexMap const& vim = get(vertex_index, graph));
|
||||
</code></pre>
|
||||
|
||||
<p>Enumerate all the elementary circuits in a directed multigraph. Specifically,
|
||||
self-loops and redundant circuits caused by parallel edges are enumerated too.
|
||||
<code>hawick_unique_circuits</code> may be used if redundant circuits caused by parallel
|
||||
edges are not desired.</p>
|
||||
|
||||
<p>The algorithm is described in detail in
|
||||
<a href="http://complexity.massey.ac.nz/cstn/013/cstn-013.pdf">http://complexity.massey.ac.nz/cstn/013/cstn-013.pdf</a>.</p>
|
||||
|
||||
<h3 id="where-defined">Where defined</h3>
|
||||
|
||||
<p><a href="../../../boost/graph/hawick_circuits.hpp"><code>#include <boost/graph/hawick_circuits.hpp></code></a></p>
|
||||
|
||||
<h3 id="parameters">Parameters</h3>
|
||||
|
||||
<p><strong>IN:</strong> <code>Graph const& graph</code></p>
|
||||
|
||||
<blockquote>
|
||||
<p>The graph on which the algorithm is to be performed. It must be a model of
|
||||
the <code>VertexListGraph</code> and <code>AdjacencyGraph</code> concepts.</p>
|
||||
</blockquote>
|
||||
|
||||
<p><strong>IN:</strong> <code>Visitor visitor</code></p>
|
||||
|
||||
<blockquote>
|
||||
<p>The visitor that will be notified on each circuit found by the algorithm.
|
||||
The <code>visitor.cycle(circuit, graph)</code> expression must be valid, with <code>circuit</code>
|
||||
being a <code>const</code>-reference to a random access sequence of <code>vertex_descriptor</code>s.</p>
|
||||
|
||||
<p>For example, if a circuit <code>u -> v -> w -> u</code> exists in the graph, the
|
||||
visitor will be called with a sequence consisting of <code>(u, v, w)</code>.</p>
|
||||
</blockquote>
|
||||
|
||||
<p><strong>IN:</strong> <code>VertexIndexMap const& vim = get(vertex_index, graph)</code></p>
|
||||
|
||||
<blockquote>
|
||||
<p>A model of the <code>ReadablePropertyMap</code> concept mapping each <code>vertex_descriptor</code>
|
||||
to an integer in the range <code>[0, num_vertices(graph))</code>. It defaults to using
|
||||
the vertex index map provided by the <code>graph</code>.</p>
|
||||
</blockquote>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="footer">
|
||||
© 2013-2015 Louis Dionne
|
||||
</div>
|
||||
@@ -57,7 +57,7 @@ is the target. This function is equivalent to the expression
|
||||
edge_descriptor e;
|
||||
vertex_descriptor u, v;
|
||||
...
|
||||
tie(u, v) = incident(e, g);
|
||||
boost::tie(u, v) = incident(e, g);
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
@@ -388,31 +388,31 @@ unsigned integers.
|
||||
@d Concept checking
|
||||
@{
|
||||
// Graph requirements
|
||||
function_requires< VertexListGraphConcept<Graph1> >();
|
||||
function_requires< EdgeListGraphConcept<Graph1> >();
|
||||
function_requires< VertexListGraphConcept<Graph2> >();
|
||||
function_requires< BidirectionalGraphConcept<Graph2> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph1> ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph1> ));
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph2> ));
|
||||
BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph2> ));
|
||||
|
||||
typedef typename graph_traits<Graph1>::vertex_descriptor vertex1_t;
|
||||
typedef typename graph_traits<Graph2>::vertex_descriptor vertex2_t;
|
||||
typedef typename graph_traits<Graph1>::vertices_size_type size_type;
|
||||
|
||||
// Vertex invariant requirement
|
||||
function_requires< AdaptableUnaryFunctionConcept<Invariant1,
|
||||
size_type, vertex1_t> >();
|
||||
function_requires< AdaptableUnaryFunctionConcept<Invariant2,
|
||||
size_type, vertex2_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( AdaptableUnaryFunctionConcept<Invariant1,
|
||||
size_type, vertex1_t> ));
|
||||
BOOST_CONCEPT_ASSERT(( AdaptableUnaryFunctionConcept<Invariant2,
|
||||
size_type, vertex2_t> ));
|
||||
|
||||
// Property map requirements
|
||||
function_requires< ReadWritePropertyMapConcept<IsoMapping, vertex1_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<IsoMapping, vertex1_t> ));
|
||||
typedef typename property_traits<IsoMapping>::value_type IsoMappingValue;
|
||||
BOOST_STATIC_ASSERT((is_same<IsoMappingValue, vertex2_t>::value));
|
||||
|
||||
function_requires< ReadablePropertyMapConcept<IndexMap1, vertex1_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<IndexMap1, vertex1_t> ));
|
||||
typedef typename property_traits<IndexMap1>::value_type IndexMap1Value;
|
||||
BOOST_STATIC_ASSERT((is_convertible<IndexMap1Value, size_type>::value));
|
||||
|
||||
function_requires< ReadablePropertyMapConcept<IndexMap2, vertex2_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<IndexMap2, vertex2_t> ));
|
||||
typedef typename property_traits<IndexMap2>::value_type IndexMap2Value;
|
||||
BOOST_STATIC_ASSERT((is_convertible<IndexMap2Value, size_type>::value));
|
||||
@}
|
||||
|
||||
@@ -507,31 +507,31 @@ unsigned integers.
|
||||
@d Concept checking
|
||||
@{
|
||||
// Graph requirements
|
||||
function_requires< VertexListGraphConcept<Graph1> >();
|
||||
function_requires< EdgeListGraphConcept<Graph1> >();
|
||||
function_requires< VertexListGraphConcept<Graph2> >();
|
||||
function_requires< BidirectionalGraphConcept<Graph2> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph1> ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph1> ));
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph2> ));
|
||||
BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph2> ));
|
||||
|
||||
typedef typename graph_traits<Graph1>::vertex_descriptor vertex1_t;
|
||||
typedef typename graph_traits<Graph2>::vertex_descriptor vertex2_t;
|
||||
typedef typename graph_traits<Graph1>::vertices_size_type size_type;
|
||||
|
||||
// Vertex invariant requirement
|
||||
function_requires< AdaptableUnaryFunctionConcept<Invariant1,
|
||||
size_type, vertex1_t> >();
|
||||
function_requires< AdaptableUnaryFunctionConcept<Invariant2,
|
||||
size_type, vertex2_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( AdaptableUnaryFunctionConcept<Invariant1,
|
||||
size_type, vertex1_t> ));
|
||||
BOOST_CONCEPT_ASSERT(( AdaptableUnaryFunctionConcept<Invariant2,
|
||||
size_type, vertex2_t> ));
|
||||
|
||||
// Property map requirements
|
||||
function_requires< ReadWritePropertyMapConcept<IsoMapping, vertex1_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<IsoMapping, vertex1_t> ));
|
||||
typedef typename property_traits<IsoMapping>::value_type IsoMappingValue;
|
||||
BOOST_STATIC_ASSERT((is_same<IsoMappingValue, vertex2_t>::value));
|
||||
|
||||
function_requires< ReadablePropertyMapConcept<IndexMap1, vertex1_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<IndexMap1, vertex1_t> ));
|
||||
typedef typename property_traits<IndexMap1>::value_type IndexMap1Value;
|
||||
BOOST_STATIC_ASSERT((is_convertible<IndexMap1Value, size_type>::value));
|
||||
|
||||
function_requires< ReadablePropertyMapConcept<IndexMap2, vertex2_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<IndexMap2, vertex2_t> ));
|
||||
typedef typename property_traits<IndexMap2>::value_type IndexMap2Value;
|
||||
BOOST_STATIC_ASSERT((is_convertible<IndexMap2Value, size_type>::value));
|
||||
@}
|
||||
|
||||
@@ -174,7 +174,7 @@ need to consider those vertices that have the same vertex invariant
|
||||
number. The number of vertices in a graph with the same vertex
|
||||
invariant number $i$ is called the \emph{invariant multiplicity} for
|
||||
$i$. In this implementation, by default we use the out-degree of the
|
||||
vertex as the vertex invariant, though the user can also supply there
|
||||
vertex as the vertex invariant, though the user can also supply their
|
||||
own invariant function. The ability of the invariant function to prune
|
||||
the search space varies widely with the type of graph.
|
||||
|
||||
@@ -301,21 +301,21 @@ unsigned integers.
|
||||
@d Concept checking
|
||||
@{
|
||||
// Graph requirements
|
||||
function_requires< VertexListGraphConcept<Graph1> >();
|
||||
function_requires< EdgeListGraphConcept<Graph1> >();
|
||||
function_requires< VertexListGraphConcept<Graph2> >();
|
||||
function_requires< BidirectionalGraphConcept<Graph2> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph1> ));
|
||||
BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph1> ));
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph2> ));
|
||||
BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph2> ));
|
||||
|
||||
// Property map requirements
|
||||
function_requires< ReadWritePropertyMapConcept<IndexMapping, vertex1_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<IndexMapping, vertex1_t> ));
|
||||
typedef typename property_traits<IndexMapping>::value_type IndexMappingValue;
|
||||
BOOST_STATIC_ASSERT((is_same<IndexMappingValue, vertex2_t>::value));
|
||||
|
||||
function_requires< ReadablePropertyMapConcept<IndexMap1, vertex1_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<IndexMap1, vertex1_t> ));
|
||||
typedef typename property_traits<IndexMap1>::value_type IndexMap1Value;
|
||||
BOOST_STATIC_ASSERT((is_convertible<IndexMap1Value, size_type>::value));
|
||||
|
||||
function_requires< ReadablePropertyMapConcept<IndexMap2, vertex2_t> >();
|
||||
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<IndexMap2, vertex2_t> ));
|
||||
typedef typename property_traits<IndexMap2>::value_type IndexMap2Value;
|
||||
BOOST_STATIC_ASSERT((is_convertible<IndexMap2Value, size_type>::value));
|
||||
@}
|
||||
|
||||
@@ -59,7 +59,7 @@ The current implementation is based on descriptions of a backtracking
|
||||
algorithm in [<a
|
||||
href="./bibliography.html#fortin96:_graph_iso_prob">46</a>,<a
|
||||
href="./bibliography.html#reingold77:_combin_algo">48</a>]. The file
|
||||
<a href="./isomorphism-impl.pdf">isomorphism-impl.pdf</a> contains a
|
||||
<a href="./isomorphism-impl.pdf">isomorphism-impl.pdf</a> contains a (somewhat out-of-date)
|
||||
"literate" description of the implementation. The algorithm
|
||||
used is simple but slow. A more efficient (and much more complex)
|
||||
algorithm is described in [<a
|
||||
@@ -101,31 +101,24 @@ descriptor type and the vertex index map for graph 1.<br>
|
||||
<b>Python</b>: Must be a <tt>vertex_vertex_map</tt> for the first graph.
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>vertex_invariant1(VertexInvariant1 i)</tt>
|
||||
IN: <tt>vertex_invariant1(VertexInvariant1 i1)</tt>
|
||||
IN: <tt>vertex_invariant2(VertexInvariant2 i2)</tt>
|
||||
<blockquote>
|
||||
A mapping <i>i</i> from vertices to integers such that if there is
|
||||
some isomorphism that maps <i>v</i> onto <i>v'</i> then <i>i(v) ==
|
||||
i(v')</i>. The <tt>VertexInvariant</tt> type must be a <a
|
||||
href="http://www.sgi.com/tech/stl/BinaryFunction.html">BinaryFunction</a>
|
||||
where the first argument is a vertex descriptor, the second argument is a
|
||||
graph, and the result type is an integer. The vertex invariant must
|
||||
work with the types for graph 1.
|
||||
Mappings from vertices to integers which restrict which vertices may be
|
||||
considered isomorphic. If a candidate isomorphism maps <i>v1</i> to <i>v2</i>
|
||||
but <i>i1</i>(<i>v1</i>) != <i>i2</i>(<i>v2</i>), that candidate is rejected.
|
||||
This mapping can be used either to speed up the search (as is done by the
|
||||
default value, which requires that the degrees of <i>v1</i> and <i>v2</i> are
|
||||
equal) or to impose extra conditions on the result. The
|
||||
<tt>VertexInvariant1</tt> and <tt>VertexInvariant2</tt> types must model <a
|
||||
href="http://www.sgi.com/tech/stl/UnaryFunction.html">UnaryFunction</a>, with
|
||||
the argument type of <tt>vertex_invariant1</tt> being <tt>Graph1</tt>'s vertex
|
||||
descriptor type, the argument type of <tt>vertex_invariant2</tt> being
|
||||
<tt>Graph2</tt>'s vertex descriptor type, and both functions having integral
|
||||
result types. The values returned by these two functions must be in the range
|
||||
[0, <tt>vertex_max_invariant</tt>).
|
||||
<br>
|
||||
<b>Default:</b> <tt>degree_vertex_invariant</tt><br>
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>vertex_invariant2(VertexInvariant2 i)</tt>
|
||||
<blockquote>
|
||||
A mapping <i>i</i> from vertices to integers such that if there is
|
||||
some isomorphism that maps <i>v</i> onto <i>v'</i> then <i>i(v) ==
|
||||
i(v')</i>. The <tt>VertexInvariant</tt> type must be a <a
|
||||
href="http://www.sgi.com/tech/stl/BinaryFunction.html">BinaryFunction</a>
|
||||
where the first argument is a vertex descriptor, the second argument is a
|
||||
graph, and the result type is an integer. The vertex invariant must
|
||||
work with the types for both graph 2.
|
||||
<br>
|
||||
<b>Default:</b> <tt>degree_vertex_invariant</tt><br>
|
||||
<b>Default:</b> <tt>degree_vertex_invariant</tt> for both arguments<br>
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
</blockquote>
|
||||
|
||||
@@ -154,7 +147,7 @@ map.<br>
|
||||
<b>Default:</b> <tt>get(vertex_index, g1)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
@@ -173,7 +166,7 @@ map.<br>
|
||||
<b>Default:</b> <tt>get(vertex_index, g2)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<BR Clear>
|
||||
|
||||
<H1><A NAME="sec:johnson">
|
||||
<H1><A NAME="sec:johnson"></A>
|
||||
<TT>johnson_all_pairs_shortest_paths</TT>
|
||||
</H1>
|
||||
|
||||
@@ -75,10 +75,12 @@ and <a href="IncidenceGraph.html">Incidence Graph</a>.
|
||||
OUT: <tt>DistanceMatrix& D</tt>
|
||||
<blockquote>
|
||||
The length of the shortest path between each pair of vertices
|
||||
<i>u,v</i> in the graph is stored in <tt>D[u][v]</tt>. The set of
|
||||
types {<tt>DistanceMatrix, vertices_size_type, D</tt>} must be a model
|
||||
<i>u,v</i> in the graph is stored in <tt>D[u][v]</tt>. The tuple of
|
||||
types (<tt>DistanceMatrix, vertices_size_type, D</tt>) must be a model
|
||||
of <a href="BasicMatrix.html">BasicMatrix</a> where <tt>D</tt> is the
|
||||
value type of the <tt>DistanceMap</tt>.
|
||||
value type of the <tt>DistanceMap</tt>. There must be implicit conversions
|
||||
between the value type of the distance matrix and the value type of the weight
|
||||
map.
|
||||
</blockquote>
|
||||
|
||||
|
||||
@@ -86,12 +88,11 @@ value type of the <tt>DistanceMap</tt>.
|
||||
|
||||
IN: <tt>weight_map(WeightMap w_map)</tt>
|
||||
<blockquote>
|
||||
The weight or ``length'' of each edge in the graph.
|
||||
The weight or "length" of each edge in the graph.
|
||||
The type <tt>WeightMap</tt> must be a model of
|
||||
<a href="../../property_map/doc/ReadablePropertyMap.html">Readable Property Map</a>. The edge descriptor type of
|
||||
the graph needs to be usable as the key type for the weight
|
||||
map. The value type for the map must be
|
||||
<i>Addable</i> with the value type of the distance map.<br>
|
||||
map. The value type of the weight map must support a subtraction operation.<br>
|
||||
<b>Default:</b> <tt>get(edge_weight, g)</tt>
|
||||
</blockquote>
|
||||
|
||||
@@ -112,7 +113,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
</blockquote>
|
||||
@@ -128,7 +129,8 @@ IN: <tt>distance_compare(CompareFunction cmp)</tt>
|
||||
This function is use to compare distances to determine
|
||||
which vertex is closer to the source vertex.
|
||||
The <tt>CompareFunction</tt> type must be a model of
|
||||
\stlconcept{BinaryPredicate} and have argument types that
|
||||
<a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">Binary Predicate</a>
|
||||
and have argument types that
|
||||
match the value type of the <tt>WeightMap</tt> property map.<br>
|
||||
<b>Default:</b> <tt>std::less<DT></tt> with
|
||||
<tt>DT=typename property_traits<WeightMap>::value_type</tt>
|
||||
@@ -139,11 +141,8 @@ IN: <tt>distance_combine(CombineFunction cmb)</tt>
|
||||
This function is used to combine distances to compute the distance
|
||||
of a path. The <tt>CombineFunction</tt> type must be a model of <a
|
||||
href="http://www.sgi.com/tech/stl/BinaryFunction.html">Binary
|
||||
Function</a>. The first argument type of the binary function must
|
||||
match the value type of the <tt>DistanceMap</tt> property map and
|
||||
the second argument type must match the value type of the
|
||||
<tt>WeightMap</tt> property map. The result type must be the same
|
||||
type as the distance value type.<br>
|
||||
Function</a>. Both argument types and the return type of the binary function
|
||||
must match the value type of the <tt>WeightMap</tt> property map. This operation is required to act as the sum operation for the weight type; in particular, it must be the inverse of the binary <tt>-</tt> operator on that type.<br>
|
||||
<b>Default:</b> <tt>std::plus<DT></tt> with
|
||||
<tt>DT=typename property_traits<WeightMap>::value_type</tt>
|
||||
</blockquote>
|
||||
@@ -152,7 +151,7 @@ IN: <tt>distance_inf(DT inf)</tt>
|
||||
<blockquote>
|
||||
This value is used to initialize the distance for each
|
||||
vertex before the start of the algorithm.
|
||||
The type <tt>DT</tt> must be the value type of the <tt>WeigthMap</tt>.<br>
|
||||
The type <tt>DT</tt> must be the value type of the <tt>WeightMap</tt>.<br>
|
||||
<b>Default:</b> <tt>std::numeric_limits::max()</tt>
|
||||
</blockquote>
|
||||
|
||||
@@ -160,7 +159,7 @@ IN: <tt>distance_zero(DT zero)</tt>
|
||||
<blockquote>
|
||||
This value is used to initialize the distance for the source
|
||||
vertex before the start of the algorithm. The type <tt>DT</tt>
|
||||
must be the value type of the <tt>WeigthMap</tt>.<br>
|
||||
must be the value type of the <tt>WeightMap</tt>.<br>
|
||||
<b>Default:</b> <tt>0</tt>
|
||||
</blockquote>
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ As a mapping from vertices to index values between 0 and
|
||||
<b>Default</b>:<tt class="computeroutput">get(vertex_index,g)</tt>.
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
|
||||
@@ -156,7 +156,7 @@ descriptor from the map's <TT>pos</TT> iterator.
|
||||
tokenizer<>::iterator i = line_toks.begin();
|
||||
std::string actors_name = *i++;
|
||||
|
||||
tie(pos, inserted) = actors.insert(std::make_pair(actors_name, Vertex()));
|
||||
boost::tie(pos, inserted) = actors.insert(std::make_pair(actors_name, Vertex()));
|
||||
if (inserted) {
|
||||
u = add_vertex(g);
|
||||
actor_name[u] = actors_name;
|
||||
@@ -174,7 +174,7 @@ actor into the graph.
|
||||
<PRE>
|
||||
std::string movie_name = *i++;
|
||||
|
||||
tie(pos, inserted) = actors.insert(std::make_pair(*i, Vertex()));
|
||||
boost::tie(pos, inserted) = actors.insert(std::make_pair(*i, Vertex()));
|
||||
if (inserted) {
|
||||
v = add_vertex(g);
|
||||
actor_name[v] = *i;
|
||||
@@ -190,7 +190,7 @@ the name of the connecting movie.
|
||||
<P>
|
||||
<PRE>
|
||||
graph_traits<Graph>::edge_descriptor e;
|
||||
tie(e, inserted) = add_edge(u, v, g);
|
||||
boost::tie(e, inserted) = add_edge(u, v, g);
|
||||
if (inserted)
|
||||
connecting_movie[e] = movie_name;
|
||||
</PRE>
|
||||
|
||||
@@ -166,7 +166,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
|
||||
|
||||
@@ -236,9 +236,9 @@ href="../test/graph.cpp"><TT>test/graph.cpp</TT></a>.
|
||||
main(int,char*[])
|
||||
{
|
||||
typedef GRAPH<int,int> Graph;
|
||||
function_requires< VertexListGraphConcept<Graph> >();
|
||||
function_requires< BidirectionalGraphConcept<Graph> >();
|
||||
function_requires< MutableGraphConcept<Graph> >();
|
||||
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
|
||||
BOOST_CONCEPT_ASSERT(( MutableGraphConcept<Graph> ));
|
||||
return 0;
|
||||
}
|
||||
</PRE>
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
<html>
|
||||
<!--
|
||||
Copyright (c) Fernando Vilas 2013
|
||||
|
||||
|
||||
Some content from the Stoer-Wagner Min Cut documentation,
|
||||
Copyright (c) Daniel Trebbien 2010
|
||||
|
||||
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)
|
||||
-->
|
||||
<head>
|
||||
<title>Boost Graph Library: Maximum Adjacency Search</Title>
|
||||
<body>
|
||||
<img src="../../../boost.png" alt="C++ Boost" width="277" height="86">
|
||||
|
||||
<h1><a name="sec:maximum-adjacency-search"></a>
|
||||
<tt>maximum_adjacency_search</tt>
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
<pre>
|
||||
<em>// named parameter versions</em>
|
||||
template <class Graph, class class P, class T, class R>
|
||||
void
|
||||
maximum_adjacency_search(const Graph& g,
|
||||
const bgl_named_params<P, T, R>& params);
|
||||
|
||||
<i>// non-named parameter versions</i>
|
||||
template <class Graph, class WeightMap, class MASVisitor>
|
||||
void
|
||||
maximum_adjacency_search(const Graph& g, WeightMap weights, MASVisitor vis,
|
||||
const typename graph_traits<Graph>::vertex_descriptor start);
|
||||
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The <tt>maximum_adjacency_search()</tt> function performs a traversal
|
||||
of the vertices in an undirected graph. The next vertex visited is the
|
||||
vertex that has the most visited neighbors at any time. In the case of
|
||||
an unweighted, undirected graph, the number of visited neighbors of the
|
||||
very last vertex visited in the graph is also the number of edge-disjoint
|
||||
paths between that vertex and the next-to-last vertex visited. These can be
|
||||
retrieved from a visitor, an example of which is in the test harness
|
||||
mas_test.cpp.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <tt>maximum_adjacency_search()</tt> function invokes user-defined
|
||||
actions at certain event-points within the algorithm. This provides a
|
||||
mechanism for adapting the generic MAS algorithm to the many situations
|
||||
in which it can be used. In the pseudo-code below, the event points
|
||||
for MAS are the labels on the right. The user-defined actions must be
|
||||
provided in the form of a visitor object, that is, an object whose type
|
||||
meets the requirements for a MAS Visitor.
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<pre>
|
||||
MAS(<i>G</i>)
|
||||
<b>for</b> each vertex <i>u in V</i>
|
||||
<i>reach_count[u] := 0</i>
|
||||
<b>end for</b>
|
||||
// for the starting vertex s
|
||||
<i>reach_count[s] := 1</i>
|
||||
<b>for</b> each unvisited vertex <i>u in V</i>
|
||||
<b>call</b> MAS-VISIT(<i>G</i>, <i>u</i>)
|
||||
remove u from the list on unvisited vertices
|
||||
<b>for</b> each out edge from <i>u</i> to <i>t</i>
|
||||
<b>if</b> <i>t</i> has not yet been visited
|
||||
increment <i>reach_count[t]</i>
|
||||
<b>end if</b>
|
||||
<b>end for</b> each out edge
|
||||
<b>call</b> MAS-VISIT(<i>G</i>, <i>u</i>)
|
||||
<b>end for</b> each unvisited vertex
|
||||
<pre>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<pre>
|
||||
-
|
||||
-
|
||||
initialize vertex <i>u</i>
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
examine vertex <i>u</i>
|
||||
-
|
||||
examine edge <i>(u,t)</i>
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
finish vertex <i>u</i>
|
||||
-
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Where Defined</h3>
|
||||
|
||||
<p>
|
||||
<a href="../../../boost/graph/maximum_adjacency_search.hpp"><tt>boost/graph/maximum_adjacency_search.hpp</tt></a></p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
IN: <tt>const UndirectedGraph& g</tt></p>
|
||||
<blockquote>
|
||||
A connected, directed graph. The graph type must
|
||||
be a model of <a href="./IncidenceGraph.html">Incidence Graph</a>
|
||||
and <a href="./VertexListGraph.html">Vertex List Graph</a>.<br>
|
||||
</blockquote>
|
||||
|
||||
<h3>Named Parameters</h3>
|
||||
|
||||
<p>IN: <tt>WeightMap weights</tt></p>
|
||||
<blockquote>
|
||||
The weight or length of each edge in the graph. The
|
||||
<tt>WeightMap</tt> type must be a model of
|
||||
<a href="../../property_map/doc/ReadablePropertyMap.html">Readable
|
||||
Property Map</a> and its value type must be <a class="external"
|
||||
href="http://www.sgi.com/tech/stl/LessThanComparable.html">
|
||||
Less Than Comparable</a> and summable. The key type of this map
|
||||
needs to be the graph's edge descriptor type.
|
||||
<b>Default:</b> <tt>get(edge_weight, g)</tt><br>
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>visitor(MASVisitor vis)</tt></p>
|
||||
<blockquote>
|
||||
A visitor object that is invoked inside the algorithm at the
|
||||
event-points specified by the MAS Visitor concept. The visitor
|
||||
object is passed by value <a href="#1">[1]</a>. <br>
|
||||
<b>Default:</b> <tt>mas_visitor<null_visitor></tt><br>
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>root_vertex(typename
|
||||
graph_traits<VertexListGraph>::vertex_descriptor start)</tt></p>
|
||||
<blockquote>
|
||||
This specifies the vertex that the depth-first search should
|
||||
originate from. The type is the type of a vertex descriptor for the
|
||||
given graph.<br>
|
||||
<b>Default:</b> <tt>*vertices(g).first</tt><br>
|
||||
</blockquote>
|
||||
|
||||
<h4>Expert Parameters</h4>
|
||||
|
||||
<p>IN: <tt>vertex_index_map(VertexIndexMap vertexIndices)</tt> </p>
|
||||
<blockquote>
|
||||
This maps each vertex to an integer in the range
|
||||
[0, <tt>num_vertices(g)</tt>). This is only necessary if the default is
|
||||
used for the assignment, index-in-heap, or distance maps.
|
||||
<tt>VertexIndexMap</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadablePropertyMap.html">Readable Property
|
||||
Map</a>. The value type of the map must be an integer type. The
|
||||
key type must be the graph's vertex descriptor type.<br>
|
||||
<b>Default:</b> <tt>get(boost::vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
</blockquote>
|
||||
|
||||
<p>UTIL: <tt>vertex_assignment_map(AssignmentMap assignments)</tt></p>
|
||||
<blockquote>
|
||||
<tt>AssignmentMap</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadWritePropertyMap.html">Read/Write Property
|
||||
Map</a>. The key and value types must be the graph's vertex descriptor
|
||||
type.<br>
|
||||
<b>Default:</b> A <tt>boost::iterator_property_map</tt> using a
|
||||
<tt>std::vector</tt> of <tt>num_vertices(g)</tt> vertex descriptors and
|
||||
<tt>vertexIndices</tt> for the index map.
|
||||
</blockquote>
|
||||
|
||||
<p>UTIL: <tt>max_priority_queue(MaxPriorityQueue& pq)</tt></p>
|
||||
<blockquote>
|
||||
<tt>MaxPriorityQueue</tt> must be a model of <a
|
||||
href="./KeyedUpdatableQueue.html">Keyed Updatable Queue</a> and a
|
||||
max-<a href="./UpdatableQueue.html#concept%3AUpdatablePriorityQueue">
|
||||
Updatable Priority Queue</a>. The value type must be the graph's vertex
|
||||
descriptor and the key type must be the weight type.
|
||||
<b>Default:</b> A <tt>boost::d_ary_heap_indirect</tt> using a default
|
||||
index-in-heap and distance map.
|
||||
</blockquote>
|
||||
|
||||
<p>UTIL: <tt>index_in_heap_map(IndexInHeapMap indicesInHeap)</tt></p>
|
||||
<blockquote>
|
||||
This parameter only has an effect when the default max-priority queue is used.<br>
|
||||
<tt>IndexInHeapMap</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadWritePropertyMap.html">Read/Write Property
|
||||
Map</a>. The key type must be the graph's vertex descriptor type. The
|
||||
value type must be a size type
|
||||
(<tt>typename std::vector<vertex_descriptor>::size_type</tt>).<br>
|
||||
<b>Default:</b> A <tt>boost::iterator_property_map</tt> using a
|
||||
<tt>std::vector</tt> of <tt>num_vertices(g)</tt> size type objects and
|
||||
<tt>vertexIndices</tt> for the index map.
|
||||
</blockquote>
|
||||
|
||||
<p>UTIL: <tt>distance_map(DistanceMap wAs)</tt></p>
|
||||
<blockquote>
|
||||
This parameter only has an effect when the default max-priority queue is used.<br>
|
||||
<tt>DistanceMap</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadWritePropertyMap.html">Read/Write Property
|
||||
Map</a>. The key type must be the graph's vertex descriptor type. The
|
||||
value type must be the weight type
|
||||
(<tt>typename boost::property_traits<WeightMap>::value_type</tt>).
|
||||
<br>
|
||||
<b>Default:</b> A <tt>boost::iterator_property_map</tt> using a
|
||||
<tt>std::vector</tt> of <tt>num_vertices(g)</tt> weight type objects
|
||||
and <tt>vertexIndices</tt> for the index map.
|
||||
</blockquote>
|
||||
|
||||
<h3>Returns</h3>
|
||||
<p>void</p>
|
||||
|
||||
<h3>Throws</h3>
|
||||
|
||||
<p><tt>bad_graph</tt>
|
||||
<blockquote>
|
||||
If <tt>num_vertices(g)</tt> is less than 2
|
||||
</blockquote></p>
|
||||
|
||||
<p><tt>std::invalid_argument</tt>
|
||||
<blockquote>
|
||||
If a max-priority queue is given as an argument and it is not empty
|
||||
</blockquote>.
|
||||
|
||||
<h3><a name="SECTION001340300000000000000">
|
||||
Complexity</a>
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
The time complexity is <i>O(E + V)</i>.
|
||||
</p>
|
||||
|
||||
<h3>References</h3>
|
||||
<ul>
|
||||
<li>David Matula (1993). <q><a href="http://dl.acm.org/citation.cfm?id=313872&dl=ACM&coll=DL&CFID=85991501&CFTOKEN=44461131">A linear time 2 + epsilon approximation algorightm for edge connectivity</a></q>
|
||||
</li>
|
||||
<li>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</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
<h3>Visitor Event Points</h3>
|
||||
|
||||
<ul>
|
||||
<li><b><tt>vis.initialize_vertex(s, g)</tt></b> is invoked on every
|
||||
vertex of the graph before the start of the graph search.</li>
|
||||
|
||||
<li><b><tt>vis.start_vertex(s, g)</tt></b> is invoked on the source
|
||||
vertex once before processing its out edges.</li>
|
||||
|
||||
<li><b><tt>vis.examine_edge(e, g)</tt></b> is invoked on every out-edge
|
||||
of each vertex after it is started.</li>
|
||||
|
||||
<li><b><tt>vis.finish_vertex(u, g)</tt></b> is invoked on a vertex after
|
||||
all of its out edges have been examined and the reach counts of the
|
||||
unvisited targets have been updated.</li>
|
||||
</ul>
|
||||
|
||||
<h3>Notes</h3>
|
||||
|
||||
<p><a name="1">[1]</a>
|
||||
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.</p>
|
||||
|
||||
<hr>
|
||||
<table>
|
||||
<tr valign=top>
|
||||
<td nowrap>Copyright © 2012</td><td>
|
||||
Fernando Vilas
|
||||
</td></tr></table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -143,7 +143,7 @@ IN: <tt>VertexIndexMap indexmap</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
</blockquote>
|
||||
|
||||
@@ -56,7 +56,7 @@ target, then this function returns the source vertex.
|
||||
edge_descriptor e;
|
||||
...
|
||||
vertex_descriptor u, v;
|
||||
tie(u, v) = incident(e, g);
|
||||
boost::tie(u, v) = incident(e, g);
|
||||
assert(v == opposite(e, u, g));
|
||||
assert(u == opposite(e, v, g));
|
||||
</pre>
|
||||
|
||||
@@ -97,7 +97,7 @@ and might produce the output
|
||||
New face: 1 2 5 4
|
||||
New face: 2 3 4 5
|
||||
New face: 3 0 1 4
|
||||
New face: 2 3 0 1
|
||||
New face: 1 0 3 2
|
||||
</pre>
|
||||
|
||||
<h3>Visitor Event Points</h3>
|
||||
|
||||
@@ -31,7 +31,7 @@ typically used with the <tt>on_tree_edge</tt> or
|
||||
|
||||
<p>
|
||||
<tt>predecessor_recorder</tt> can be used with graph algorithms by
|
||||
wrapping it with the algorithm specific adaptor, such as <a
|
||||
wrapping it with an algorithm-specific adaptor, such as <a
|
||||
href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a
|
||||
href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event
|
||||
visitor can be combined with other event visitors using
|
||||
@@ -44,7 +44,7 @@ tree). It is often useful to initialize the source vertex's
|
||||
predecessor to itself, thereby identifying the root vertex as the only
|
||||
vertex which is its own parent. When using an algorithm like
|
||||
depth-first search that creates a forest (multiple search trees) it
|
||||
is useful to intialize the predecessor of every vertex to itself. This
|
||||
is useful to initialize the predecessor of every vertex to itself. This
|
||||
way all the root nodes can be distinguished.
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ PRIM-MST(<i>G</i>, <i>s</i>, <i>w</i>)
|
||||
<b>for</b> each vertex <i>u</i> <i>in</i> <i>V[G]</i>
|
||||
<i>color[u] :=</i> WHITE
|
||||
<i>d[u] :=</i> <i>infinity</i>
|
||||
<b>end for</b>
|
||||
<i>color[s] :=</i> GRAY
|
||||
<i>d[s] := 0</i>
|
||||
ENQUEUE(<i>PQ</i>, <i>s</i>)
|
||||
@@ -171,7 +172,9 @@ IN: <tt>weight_map(WeightMap w_map)</tt>
|
||||
<a href="../../property_map/doc/ReadablePropertyMap.html">Readable Property Map</a>. The edge descriptor type of
|
||||
the graph needs to be usable as the key type for the weight
|
||||
map. The value type for the map must be
|
||||
<i>Addable</i> with the value type of the distance map.<br>
|
||||
the same as the value type of the distance map, and that type must be <a
|
||||
href="http://www.sgi.com/tech/stl/LessThanComparable.html">Less Than
|
||||
Comparable</a>.<br>
|
||||
<b>Default:</b> <tt>get(edge_weight, g)</tt><br>
|
||||
<b>Python</b>: Must be an <tt>edge_double_map</tt> for the graph.<br>
|
||||
<b>Python default</b>: <tt>graph.get_edge_double_map("weight")</tt>
|
||||
@@ -189,7 +192,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
<b>Python</b>: Unsupported parameter.
|
||||
@@ -203,10 +206,9 @@ UTIL/OUT: <tt>distance_map(DistanceMap d_map)</tt>
|
||||
The type <tt>DistanceMap</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadWritePropertyMap.html">Read/Write
|
||||
Property Map</a>. The vertex descriptor type of the
|
||||
graph needs to be usable as the key type of the distance map. The
|
||||
value type of the distance map must be <a
|
||||
href="http://www.sgi.com/tech/stl/LessThanComparable.html">Less Than
|
||||
Comparable</a>.<br>
|
||||
graph needs to be usable as the key type of the distance map, and the value
|
||||
type needs to be the same as the value type of the <tt>weight_map</tt>
|
||||
argument.<br>
|
||||
<b>Default:</b> <a href="../../property_map/doc/iterator_property_map.html">
|
||||
<tt>iterator_property_map</tt></a> created from a
|
||||
<tt>std::vector</tt> of the <tt>WeightMap</tt>'s value type of size
|
||||
|
||||
@@ -77,7 +77,7 @@ The time complexity is <i>O(V<sup>3</sup>)</i>.
|
||||
<H3>Where Defined</H3>
|
||||
|
||||
<P>
|
||||
<a href="../../../boost/graph/push_relabel_max_flow.hpp"><TT>boost/graph/preflow_push_max_flow.hpp</TT></a>
|
||||
<a href="../../../boost/graph/push_relabel_max_flow.hpp"><TT>boost/graph/push_relabel_max_flow.hpp</TT></a>
|
||||
|
||||
<P>
|
||||
|
||||
@@ -141,7 +141,7 @@ IN: <tt>vertex_index_map(VertexIndexMap index_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
</blockquote>
|
||||
@@ -158,7 +158,7 @@ href="../example/max_flow.cpp"><tt>example/max_flow.cpp</tt></a>.
|
||||
#include <boost/config.hpp>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <boost/graph/push_relabel_map_flow.hpp>
|
||||
#include <boost/graph/push_relabel_max_flow.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/read_dimacs.hpp>
|
||||
|
||||
@@ -196,8 +196,8 @@ main()
|
||||
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 (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter)
|
||||
for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei)
|
||||
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;
|
||||
|
||||
@@ -160,6 +160,8 @@ call <tt>get(vertex_index, g)</tt> returns the actual property map object.
|
||||
{
|
||||
// ...
|
||||
|
||||
typedef graph_traits<Graph>::vertex_descriptor Vertex;
|
||||
|
||||
// get the property map for vertex indices
|
||||
typedef property_map<Graph, vertex_index_t>::type IndexMap;
|
||||
IndexMap index = get(vertex_index, g);
|
||||
@@ -167,8 +169,10 @@ call <tt>get(vertex_index, g)</tt> returns the actual property map object.
|
||||
std::cout << "vertices(g) = ";
|
||||
typedef graph_traits<Graph>::vertex_iterator vertex_iter;
|
||||
std::pair<vertex_iter, vertex_iter> vp;
|
||||
for (vp = vertices(g); vp.first != vp.second; ++vp.first)
|
||||
std::cout << index[*vp.first] << " ";
|
||||
for (vp = vertices(g); vp.first != vp.second; ++vp.first) {
|
||||
Vertex v = *vp.first;
|
||||
std::cout << index[v] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
// ...
|
||||
return 0;
|
||||
@@ -187,7 +191,7 @@ but in this case the iterators are <i>edge iterators</i>. Dereferencing an edge
|
||||
iterator gives an edge object. The <tt>source()</tt> and <tt>target()</tt>
|
||||
functions return the two vertices that are connected by the edge. Instead of
|
||||
explicitly creating a <tt>std::pair</tt> for the iterators, this time we will
|
||||
use the <a href="../../tuple/doc/tuple_users_guide.html#tiers"><tt>tie()</tt></a> helper function.
|
||||
use the <a href="../../tuple/doc/tuple_users_guide.html#tiers"><tt>boost::tie()</tt></a> helper function.
|
||||
This handy function can be used to assign the parts of a <tt>std::pair</tt> into
|
||||
two separate variables, in this case <tt>ei</tt> and <tt>ei_end</tt>. This is
|
||||
usually more convenient than creating a <tt>std::pair</tt> and is our method of
|
||||
@@ -200,7 +204,7 @@ choice for the BGL.
|
||||
// ...
|
||||
std::cout << "edges(g) = ";
|
||||
graph_traits<Graph>::edge_iterator ei, ei_end;
|
||||
for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
|
||||
for (boost::tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
|
||||
std::cout << "(" << index[source(*ei, g)]
|
||||
<< "," << index[target(*ei, g)] << ") ";
|
||||
std::cout << std::endl;
|
||||
@@ -303,7 +307,7 @@ out-edge of vertex <tt>v</tt>.
|
||||
std::cout << "out-edges: ";
|
||||
typename GraphTraits::out_edge_iterator out_i, out_end;
|
||||
typename GraphTraits::edge_descriptor e;
|
||||
for (tie(out_i, out_end) = out_edges(v, g);
|
||||
for (boost::tie(out_i, out_end) = out_edges(v, g);
|
||||
out_i != out_end; ++out_i) {
|
||||
e = *out_i;
|
||||
Vertex src = source(e, g), targ = target(e, g);
|
||||
@@ -337,7 +341,7 @@ specified instead of <tt>directedS</tt>.
|
||||
std::cout << "in-edges: ";
|
||||
typedef typename graph_traits<Graph> GraphTraits;
|
||||
typename GraphTraits::in_edge_iterator in_i, in_end;
|
||||
for (tie(in_i, in_end) = in_edges(v,g);
|
||||
for (boost::tie(in_i, in_end) = in_edges(v,g);
|
||||
in_i != in_end; ++in_i) {
|
||||
e = *in_i;
|
||||
Vertex src = source(e, g), targ = target(e, g);
|
||||
@@ -373,7 +377,7 @@ descriptor for an adjacent vertex.
|
||||
std::cout << "adjacent vertices: ";
|
||||
typename graph_traits<Graph>::adjacency_iterator ai;
|
||||
typename graph_traits<Graph>::adjacency_iterator ai_end;
|
||||
for (tie(ai, ai_end) = adjacent_vertices(v, g);
|
||||
for (boost::tie(ai, ai_end) = adjacent_vertices(v, g);
|
||||
ai != ai_end; ++ai)
|
||||
std::cout << index[*ai] << " ";
|
||||
std::cout << std::endl;
|
||||
|
||||
@@ -123,7 +123,7 @@ in:<br>
|
||||
Desaulniers, G.; Desrosiers, J.; Solomon, M. (eds.) (2005):<br>
|
||||
Column Generation<br>
|
||||
Springer, New York, pp. 33–65<br>
|
||||
(available online <a href="http://www.dpor.rwth-aachen.de/de/publikationen/pdf/or_2004-01.pdf">
|
||||
(available online <a href="http://logistik.bwl.uni-mainz.de/Dateien/or_2004-01.pdf">
|
||||
here</a>)
|
||||
<p>
|
||||
|
||||
@@ -466,7 +466,7 @@ A <a href="http://www.sgi.com/tech/stl/functors.html">function object</a> or fun
|
||||
</blockquote>
|
||||
IN: <tt>Label_Allocator la</tt>
|
||||
<blockquote>
|
||||
An object of type <tt>Label_Allocator</tt> specifying a strategy for the memory management of the labels. It must offer the same interface as <tt>std::allocator<lt;r_c_shortest_paths_label<Graph, Resource_Container> ></tt>. There is a default type <tt>default_r_c_shortest_paths_allocator</tt> for this parameter using the STL standard allocator. If the third or the fourth overload of the function is used, an object of this type is used as <tt>Label_Allocator</tt> parameter. If the first or the second overload is used, one must specify both a <tt>Label_Allocator</tt> and a <tt>Visitor</tt> parameter. If one wants to develop a user-defined type only for <tt>Visitor</tt>, one can use <tt>default_r_c_shortest_paths_allocator</tt> as <tt>Label_Allocator</tt> parameter. If one wants to use a specialized allocator, one can specify an arbitrary type as template parameter for the value type to the allocator; it is rebound to the correct type.
|
||||
An object of type <tt>Label_Allocator</tt> specifying a strategy for the memory management of the labels. It must offer the same interface as <tt>std::allocator<r_c_shortest_paths_label<Graph, Resource_Container> ></tt>. There is a default type <tt>default_r_c_shortest_paths_allocator</tt> for this parameter using the STL standard allocator. If the third or the fourth overload of the function is used, an object of this type is used as <tt>Label_Allocator</tt> parameter. If the first or the second overload is used, one must specify both a <tt>Label_Allocator</tt> and a <tt>Visitor</tt> parameter. If one wants to develop a user-defined type only for <tt>Visitor</tt>, one can use <tt>default_r_c_shortest_paths_allocator</tt> as <tt>Label_Allocator</tt> parameter. If one wants to use a specialized allocator, one can specify an arbitrary type as template parameter for the value type to the allocator; it is rebound to the correct type.
|
||||
</blockquote>
|
||||
IN: <tt>Visitor vis</tt>
|
||||
<blockquote>
|
||||
|
||||
@@ -20,7 +20,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
Authors: Tiago de Paula Peixoto -->
|
||||
<pre class="literal-block">
|
||||
void read_graphml(std::istream& in, MutableGraph& graph,
|
||||
dynamic_properties& dp);
|
||||
dynamic_properties& dp, size_t graph_index = 0);
|
||||
</pre>
|
||||
<p>The <tt class="docutils literal"><span class="pre">read_graphml</span></tt> function interprets a graph described using the
|
||||
<a class="reference external" href="http://graphml.graphdrawing.org/">GraphML</a> format and builds a BGL graph that captures that
|
||||
@@ -39,6 +39,10 @@ this object, using the GraphML attribute names as the property names,
|
||||
and with the appropriate C++ value type based on the GraphML attribute type
|
||||
definition. Graph properties are also set with the same
|
||||
<a class="reference external" href="../../property_map/doc/dynamic_property_map.html">dynamic_properties</a> object, where the key type is the type of the graph itself.</p>
|
||||
<p>If the file contains multiple graphs, the <tt class="docutils literal"><span class="pre">graph_index</span></tt> parameter controls
|
||||
which graph will be loaded. It defaults to <tt class="docutils literal"><span class="pre">0</span></tt>, meaning that the first graph
|
||||
in the file will be loaded. If <tt class="docutils literal"><span class="pre">graph_index</span></tt> is greater than or equal to the
|
||||
number of graphs in the file, an empty graph will be returned.</p>
|
||||
<dl class="docutils">
|
||||
<dt>Requirements:</dt>
|
||||
<dd><ul class="first last simple">
|
||||
@@ -156,7 +160,7 @@ graph.</li>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr class="footer" />
|
||||
Generated on: 2009-06-12 00:41 UTC.
|
||||
Generated on: 2012-11-12 22:25 UTC.
|
||||
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@ __ ../../../index.htm
|
||||
::
|
||||
|
||||
void read_graphml(std::istream& in, MutableGraph& graph,
|
||||
dynamic_properties& dp);
|
||||
dynamic_properties& dp, size_t graph_index = 0);
|
||||
|
||||
|
||||
The ``read_graphml`` function interprets a graph described using the
|
||||
@@ -42,6 +42,11 @@ and with the appropriate C++ value type based on the GraphML attribute type
|
||||
definition. Graph properties are also set with the same
|
||||
dynamic_properties_ object, where the key type is the type of the graph itself.
|
||||
|
||||
If the file contains multiple graphs, the ``graph_index`` parameter controls
|
||||
which graph will be loaded. It defaults to ``0``, meaning that the first graph
|
||||
in the file will be loaded. If ``graph_index`` is greater than or equal to the
|
||||
number of graphs in the file, an empty graph will be returned.
|
||||
|
||||
Requirements:
|
||||
- The type of the graph must model the `Mutable Graph`_ concept.
|
||||
- The type of the iterator must model the `Multi-Pass Iterator`_
|
||||
|
||||
@@ -181,8 +181,8 @@ bool status = read_graphviz(gvgraph,graph,dp,"node_id");
|
||||
<div class="section" id="building-the-graphviz-readers">
|
||||
<h1><a class="toc-backref" href="#id5">Building the GraphViz Readers</a></h1>
|
||||
<p>To use the GraphViz readers, you will need to build and link against
|
||||
the "boost_graph" library. The library can be built by following the
|
||||
<a class="reference external" href="../../../more/getting_started.html#Build_Install">Boost Jam Build Instructions</a> for the subdirectory <tt class="docutils literal"><span class="pre">libs/graph/build</span></tt>.</p>
|
||||
the "boost_graph" and "boost_regex" libraries. These libraries can be built by following the
|
||||
<a class="reference external" href="../../../more/getting_started.html#Build_Install">Boost Jam Build Instructions</a> for the subdirectories <tt class="docutils literal"><span class="pre">libs/graph/build</span></tt> and <tt class="docutils literal"><span class="pre">libs/regex/build</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="notes">
|
||||
<h1><a class="toc-backref" href="#id6">Notes</a></h1>
|
||||
|
||||
@@ -182,8 +182,8 @@ GraphViz reader to populate an ``adjacency_list`` graph
|
||||
Building the GraphViz Readers
|
||||
-----------------------------
|
||||
To use the GraphViz readers, you will need to build and link against
|
||||
the "boost_graph" library. The library can be built by following the
|
||||
`Boost Jam Build Instructions`_ for the subdirectory ``libs/graph/build``.
|
||||
the "boost_graph" and "boost_regex" libraries. These libraries can be built by following the
|
||||
`Boost Jam Build Instructions`_ for the subdirectories ``libs/graph/build`` and ``libs/regex/build``.
|
||||
|
||||
|
||||
Notes
|
||||
|
||||
@@ -27,7 +27,7 @@ The <tt>reverse_graph</tt> adaptor flips the in-edges and out-edges of
|
||||
a <a href="./BidirectionalGraph.html">BidirectionalGraph</a>,
|
||||
effectively transposing the graph. The construction of the
|
||||
<tt>reverse_graph</tt> is constant time, providing a highly efficient
|
||||
way to obtain a transposed-view of a graph.
|
||||
way to obtain a transposed view of a graph.
|
||||
|
||||
|
||||
<H3>Example</H3>
|
||||
@@ -190,7 +190,7 @@ The type used for dealing with the number of vertices in the graph.
|
||||
|
||||
<hr>
|
||||
|
||||
<tt>graph_traits<reverse_graph>::edge_size_type</tt>
|
||||
<tt>graph_traits<reverse_graph>::edges_size_type</tt>
|
||||
<br><br>
|
||||
The type used for dealing with the number of edges in the graph.
|
||||
|
||||
@@ -215,6 +215,16 @@ and must match one of the properties specified in the
|
||||
<hr>
|
||||
|
||||
|
||||
<tt>property_map<reverse_graph, edge_underlying_t>::type</tt><br>
|
||||
and<br>
|
||||
<tt>property_map<reverse_graph, edge_underlying_t>::const_type</tt>
|
||||
<br><br>
|
||||
An edge property type mapping from edge descriptors in the <tt>reverse_graph</tt> to
|
||||
edge descriptors in the underlying <tt>BidirectionalGraph</tt> object.
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
<H2>Member Functions</H2>
|
||||
|
||||
<hr>
|
||||
@@ -358,6 +368,16 @@ argument.
|
||||
|
||||
<hr>
|
||||
|
||||
<pre>
|
||||
property_map<reverse_graph, edge_underlying_t>::const_type
|
||||
get(PropertyTag, const reverse_graph& g)
|
||||
</pre>
|
||||
Returns a property map object that converts from edge descriptors in the
|
||||
<tt>reverse_graph</tt> to edge descriptors in the underlying
|
||||
<tt>BidirectionalGraph</tt> object.
|
||||
|
||||
<hr>
|
||||
|
||||
<pre>
|
||||
template <class <a href="./PropertyTag.html">PropertyTag</a>, class X>
|
||||
typename property_traits<property_map<reverse_graph, PropertyTag>::const_type>::value_type
|
||||
@@ -367,6 +387,13 @@ This returns the property value for <tt>x</tt>, which is either
|
||||
a vertex or edge descriptor.
|
||||
<hr>
|
||||
|
||||
<pre>
|
||||
typename graph_traits<BidirectionalGraph>::edge_descriptor
|
||||
get(edge_underlying_t, const reverse_graph& g, edge_descriptor e)
|
||||
</pre>
|
||||
This returns the underlying edge descriptor for the edge <tt>e</tt> in the <tt>reverse_graph</tt>.
|
||||
<hr>
|
||||
|
||||
<pre>
|
||||
template <class <a href="./PropertyTag.html">PropertyTag</a>, class X, class Value>
|
||||
void
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
small_world_iterator();
|
||||
small_world_iterator(RandomGenerator& gen, vertices_size_type n,
|
||||
vertices_size_type k, double probability,
|
||||
vertices_size_type k, double probability = 0.,
|
||||
bool allow_self_loops = false);
|
||||
// Iterator operations
|
||||
reference operator*() const;
|
||||
@@ -82,7 +82,7 @@ Constructs a past-the-end iterator.
|
||||
|
||||
<pre>
|
||||
small_world_iterator(RandomGenerator& gen, vertices_size_type n,
|
||||
vertices_size_type k, double probability,
|
||||
vertices_size_type k, double probability = 0.,
|
||||
bool allow_self_loops = false);
|
||||
</pre>
|
||||
<blockquote>
|
||||
|
||||
@@ -63,7 +63,7 @@ graphs, suitable for initializing an <a
|
||||
href="adjacency_list.html"><tt>adjacency_list</tt></a> or other graph
|
||||
structure with iterator-based initialization. An Erdös-Renyi
|
||||
graph <em>G = (n, p)</em> is a graph with <em>n</em> vertices
|
||||
that. The probability of having an edge <em>(u, v)</em> in <em>G</em>
|
||||
such that the probability of having an edge <em>(u, v)</em> in <em>G</em>
|
||||
is <em>p</em> for any vertices <em>u</em> and <em>v</em>. Typically,
|
||||
there are no self-loops, but the generator can optionally introduce
|
||||
self-loops with probability <em>p</em>.</p>
|
||||
@@ -93,7 +93,7 @@ sorted_erdos_renyi_iterator(RandomGenerator& gen, vertices_size_type n,
|
||||
Constructs an Erdös-Renyi generator iterator that creates a
|
||||
graph with <tt>n</tt> vertices and a given <tt>probability</tt> of the
|
||||
total number of edges that a simple graph may have.
|
||||
<tt>probability</tt>. Random vertices and edges are selected using the
|
||||
Random vertices and edges are selected using the
|
||||
random number generator <tt>gen</tt>. Self-loops are permitted only when
|
||||
<tt>allow_self_loops</tt> is <tt>true</tt>.
|
||||
</blockquote>
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace boost {
|
||||
rcm_queue<Vertex, Degree> Q(degree);
|
||||
|
||||
typename boost::graph_traits<Graph>::vertex_iterator ui, ui_end;
|
||||
for (tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui)
|
||||
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);
|
||||
|
||||
@@ -214,7 +214,7 @@ from BGL can be reused.
|
||||
CMVisitor cm_visitor(inverse_permutation);
|
||||
|
||||
typename boost::graph_traits<Graph>::vertex_iterator ui, ui_end;
|
||||
for (tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Copyright (c) Jeremy Siek 2000
|
||||
|
||||
|
||||
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)
|
||||
-->
|
||||
<Head>
|
||||
<Title>Boost Graph Library: Subgraph</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
|
||||
<BR Clear>
|
||||
|
||||
@@ -187,7 +187,7 @@ the underlying <tt>Graph</tt> type.
|
||||
<pre>
|
||||
graph_traits<subgraph>::vertex_descriptor
|
||||
</pre>
|
||||
The type for the vertex descriptors.
|
||||
The type for the vertex descriptors.
|
||||
(Required by <a href="Graph.html">Graph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -195,7 +195,7 @@ graph_traits<subgraph>::vertex_descriptor
|
||||
<pre>
|
||||
graph_traits<subgraph>::edge_descriptor
|
||||
</pre>
|
||||
The type for the edge descriptors.
|
||||
The type for the edge descriptors.
|
||||
(Required by <a href="Graph.html">Graph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -203,7 +203,7 @@ graph_traits<subgraph>::edge_descriptor
|
||||
<pre>
|
||||
graph_traits<subgraph>::vertex_iterator
|
||||
</pre>
|
||||
The type for the iterators returned by <tt>vertices</tt>.
|
||||
The type for the iterators returned by <tt>vertices</tt>.
|
||||
(Required by <a href="VertexListGraph.html">VertexListGraph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -211,14 +211,14 @@ graph_traits<subgraph>::vertex_iterator
|
||||
<pre>
|
||||
graph_traits<subgraph>::edge_iterator
|
||||
</pre>
|
||||
The type for the iterators returned by <tt>edges</tt>.
|
||||
The type for the iterators returned by <tt>edges</tt>.
|
||||
(Required by <a href="EdgeListGraph.html">EdgeListGraph</a>.)
|
||||
|
||||
<hr>
|
||||
<pre>
|
||||
graph_traits<subgraph>::out_edge_iterator
|
||||
</pre>
|
||||
The type for the iterators returned by <tt>out_edges</tt>.
|
||||
The type for the iterators returned by <tt>out_edges</tt>.
|
||||
(Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -226,14 +226,14 @@ graph_traits<subgraph>::out_edge_iterator
|
||||
graph_traits<subgraph>::in_edge_iterator
|
||||
</pre>
|
||||
The <tt>in_edge_iterator</tt> is the
|
||||
iterator type returned by the <tt>in_edges</tt> function.
|
||||
iterator type returned by the <tt>in_edges</tt> function.
|
||||
(Required by <a href="BidirectionalGraph.html">BidirectionalGraph</a>.)
|
||||
|
||||
<hr>
|
||||
<pre>
|
||||
graph_traits<subgraph>::adjacency_iterator
|
||||
</pre>
|
||||
The type for the iterators returned by <tt>adjacent_vertices</tt>.
|
||||
The type for the iterators returned by <tt>adjacent_vertices</tt>.
|
||||
(Required by <a href="AdjacencyGraph.html">AdjacencyGraph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -252,7 +252,7 @@ graph_traits<subgraph>::edge_parallel_category
|
||||
parallel edges (edges with the same source and target), which
|
||||
depends on the underlying <tt>Graph</tt> class. The two tags are
|
||||
<tt>allow_parallel_edge_tag</tt> and
|
||||
<tt>disallow_parallel_edge_tag</tt>.
|
||||
<tt>disallow_parallel_edge_tag</tt>.
|
||||
(Required by <a href="Graph.html">Graph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -388,7 +388,7 @@ subgraph& parent()
|
||||
<pre>
|
||||
std::pair<children_iterator, children_iterator> children() const
|
||||
</pre>
|
||||
Return an iterator pair for accessing the children subgraphs.
|
||||
Return an iterator pair for accessing the children subgraphs.
|
||||
|
||||
|
||||
<!----------------------------->
|
||||
@@ -441,7 +441,7 @@ out_edges(vertex_descriptor u_local, const subgraph& g)
|
||||
Returns an iterator range providing access to the out-edges of
|
||||
vertex <i>u</i> in subgraph <i>g</i>. If the graph is undirected, this
|
||||
iterator range provides access to all edge incident on
|
||||
vertex <i>u</i>.
|
||||
vertex <i>u</i>.
|
||||
(Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -451,7 +451,7 @@ in_edges(vertex_descriptor v_local, const subgraph& g)
|
||||
</pre>
|
||||
Returns an iterator range providing access to the in-edges of
|
||||
vertex
|
||||
<i>v</i> in subgraph <i>g</i>.
|
||||
<i>v</i> in subgraph <i>g</i>.
|
||||
(Required by <a href="BidirectionalGraph.html">BidirectionalGraph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -482,7 +482,7 @@ out_degree(vertex_descriptor u_local, const subgraph& g)
|
||||
<pre>
|
||||
degree_size_type in_degree(vertex_descriptor u_local, const subgraph& g)
|
||||
</pre>
|
||||
Returns the number of edges entering vertex <i>u</i> in subgraph <i>g</i>.
|
||||
Returns the number of edges entering vertex <i>u</i> in subgraph <i>g</i>.
|
||||
(Required by <a href="BidirectionalGraph.html">BidirectionalGraph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -543,7 +543,7 @@ void remove_edge(vertex_descriptor u_local, vertex_descriptor v_local,
|
||||
subgraph& g)
|
||||
</pre>
|
||||
Removes the edge <i>(u,v)</i> from the subgraph and from all of the
|
||||
ancestors of <tt>g</tt> in the subgraph tree.
|
||||
ancestors of <tt>g</tt> in the subgraph tree.
|
||||
(Required by <a href="EdgeMutableGraph.html">EdgeMutableGraph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -551,7 +551,7 @@ void remove_edge(vertex_descriptor u_local, vertex_descriptor v_local,
|
||||
void remove_edge(edge_descriptor e_local, subgraph& g)
|
||||
</pre>
|
||||
Removes the edge <tt>e</tt> from the subgraph and from all of the
|
||||
ancestors of <tt>g</tt> in the subgraph tree.
|
||||
ancestors of <tt>g</tt> in the subgraph tree.
|
||||
(Required by <a href="EdgeMutableGraph.html">EdgeMutableGraph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -591,7 +591,7 @@ get(PropertyTag, const subgraph& g)
|
||||
descriptor for one subgraph will change the property for the
|
||||
global vertex descriptor, and therefore for all other subgraphs.
|
||||
However, the key type for a subgraph's property map is a subgraph-local
|
||||
vertex or edge descriptor.
|
||||
vertex or edge descriptor.
|
||||
(Required by <a href="PropertyGraph.html">PropertyGraph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -605,7 +605,7 @@ get(PropertyTag, const subgraph& g, Key k_local)
|
||||
This returns the property value for the key <tt>k_local</tt>, which
|
||||
is either a local vertex or local edge descriptor. See the above
|
||||
<tt>get</tt> function
|
||||
for more information about the propert maps.
|
||||
for more information about the propert maps.
|
||||
(Required by <a href="PropertyGraph.html">PropertyGraph</a>.)
|
||||
|
||||
<hr>
|
||||
@@ -656,11 +656,11 @@ properties into a <tt>property</tt> that contains an appropriate index. For
|
||||
example:
|
||||
<pre>
|
||||
struct my_vertex { ... };
|
||||
typedef property<vertex_index_t, std::size_t, vertex_prop> vertex_prop;
|
||||
typedef property<vertex_index_t, std::size_t, my_vertex> vertex_prop;
|
||||
|
||||
struct my_edge { ... };
|
||||
typedef property<edge_index_t, std::size_t, vertex_prop> edge_prop;
|
||||
typedef property<edge_index_t, std::size_t, my_edge> edge_prop;
|
||||
|
||||
typedef adjacency_list<vecS, listS, undirectedS, vertex_prop, edge_prop> Graph;
|
||||
typdef subgraph<Graph> Subgraph;
|
||||
typedef subgraph<Graph> Subgraph;
|
||||
</pre>
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Copyright (c) Piotr Wygocki 2013
|
||||
|
||||
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)
|
||||
-->
|
||||
<Head>
|
||||
<Title>Boost Graph Library: Successive Shortest Path for Min Cost Max Flow</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
|
||||
<BR Clear>
|
||||
|
||||
<H1><A NAME="sec:successive_shortest_path_nonnegative_weights">
|
||||
<TT>successive_shortest_path_nonnegative_weights</TT>
|
||||
</H1>
|
||||
|
||||
<PRE>
|
||||
<i>// named parameter version</i>
|
||||
template <class <a href="./Graph.html">Graph</a>, class P, class T, class R>
|
||||
void successive_shortest_path_nonnegative_weights(
|
||||
Graph &g,
|
||||
typename graph_traits<Graph>::vertex_descriptor s,
|
||||
typename graph_traits<Graph>::vertex_descriptor t,
|
||||
const bgl_named_params<P, T, R> & params = <i>all defaults</i>)
|
||||
|
||||
<i>// non-named parameter version</i>
|
||||
template <class <a href="./Graph.html">Graph</a>, 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,
|
||||
typename graph_traits<Graph>::vertex_descriptor t,
|
||||
Capacity capacity,
|
||||
ResidualCapacity residual_capacity,
|
||||
Weight weight,
|
||||
Reversed rev,
|
||||
VertexIndex index,
|
||||
Pred pred,
|
||||
Distance distance,
|
||||
Distance2 distance_prev)
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
The <tt>successive_shortest_path_nonnegative_weights()</tt> function calculates the minimum cost maximum flow of a network. See Section <a
|
||||
href="./graph_theory_review.html#sec:network-flow-algorithms">Network
|
||||
Flow Algorithms</a> for a description of maximum flow.
|
||||
The function calculates the flow values <i>f(u,v)</i> for all <i>(u,v)</i> in
|
||||
<i>E</i>, which are returned in the form of the residual capacity
|
||||
<i>r(u,v) = c(u,v) - f(u,v)</i>.
|
||||
|
||||
<p>
|
||||
There are several special requirements on the input graph and property
|
||||
map parameters for this algorithm. First, the directed graph
|
||||
<i>G=(V,E)</i> that represents the network must be augmented to
|
||||
include the reverse edge for every edge in <i>E</i>. That is, the
|
||||
input graph should be <i>G<sub>in</sub> = (V,{E U
|
||||
E<sup>T</sup>})</i>. The <tt>ReverseEdgeMap</tt> argument <tt>rev</tt>
|
||||
must map each edge in the original graph to its reverse edge, that is
|
||||
<i>(u,v) -> (v,u)</i> for all <i>(u,v)</i> in <i>E</i>. The
|
||||
<tt>CapacityEdgeMap</tt> argument <tt>cap</tt> must map each edge in
|
||||
<i>E</i> to a positive number, and each edge in <i>E<sup>T</sup></i>
|
||||
to 0. The <tt>WeightMap</tt> has to map each edge from <i>E</i> to nonnegative number, and each edge from <i>E<sup>T</sup></i> to <i>-weight</i> of its reversed edge.
|
||||
|
||||
<p>
|
||||
The algorithm is described in <a
|
||||
href="./bibliography.html#ahuja93:_network_flows">Network Flows</a>.
|
||||
|
||||
<p>
|
||||
This algorithm starts with empty flow and in each round augments the shortest path (in terms of weight) in the residual graph.
|
||||
|
||||
<p>
|
||||
In order to find the cost of the result flow use:
|
||||
<a href="./find_flow_cost.html"><tt>find_flow_cost()</tt></a>.
|
||||
|
||||
<H3>Where Defined</H3>
|
||||
|
||||
<P>
|
||||
<a href="../../../boost/graph/successive_shortest_path_nonnegative_weights.hpp"><TT>boost/graph/successive_shortest_path_nonnegative_weights.hpp</TT></a>
|
||||
|
||||
<P>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
IN: <tt>Graph& g</tt>
|
||||
<blockquote>
|
||||
A directed graph. The
|
||||
graph's type must be a model of <a
|
||||
href="./VertexListGraph.html">VertexListGraph</a> and <a href="./IncidenceGraph.html">IncidenceGraph</a> For each edge
|
||||
<i>(u,v)</i> in the graph, the reverse edge <i>(v,u)</i> must also
|
||||
be in the graph.
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>vertex_descriptor s</tt>
|
||||
<blockquote>
|
||||
The source vertex for the flow network graph.
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>vertex_descriptor t</tt>
|
||||
<blockquote>
|
||||
The sink vertex for the flow network graph.
|
||||
</blockquote>
|
||||
|
||||
<h3>Named Parameters</h3>
|
||||
|
||||
|
||||
IN: <tt>capacity_map(CapacityEdgeMap cap)</tt>
|
||||
<blockquote>
|
||||
The edge capacity property map. The type must be a model of a
|
||||
constant <a
|
||||
href="../../property_map/doc/LvaluePropertyMap.html">Lvalue Property Map</a>. The
|
||||
key type of the map must be the graph's edge descriptor type.<br>
|
||||
<b>Default:</b> <tt>get(edge_capacity, g)</tt>
|
||||
</blockquote>
|
||||
|
||||
OUT: <tt>residual_capacity_map(ResidualCapacityEdgeMap res)</tt>
|
||||
<blockquote>
|
||||
This maps edges to their residual capacity. The type must be a model
|
||||
of a mutable <a
|
||||
href="../../property_map/doc/LvaluePropertyMap.html">Lvalue Property
|
||||
Map</a>. The key type of the map must be the graph's edge descriptor
|
||||
type.<br>
|
||||
<b>Default:</b> <tt>get(edge_residual_capacity, g)</tt>
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>reverse_edge_map(ReverseEdgeMap rev)</tt>
|
||||
<blockquote>
|
||||
An edge property map that maps every edge <i>(u,v)</i> in the graph
|
||||
to the reverse edge <i>(v,u)</i>. The map must be a model of
|
||||
constant <a href="../../property_map/doc/LvaluePropertyMap.html">Lvalue
|
||||
Property Map</a>. The key type of the map must be the graph's edge
|
||||
descriptor type.<br>
|
||||
<b>Default:</b> <tt>get(edge_reverse, g)</tt>
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>weight_map(WeightMap w_map)</tt>
|
||||
<blockquote>
|
||||
The weight or ``cost'' of each edge in the graph. The weights
|
||||
must all be non-negative, and the algorithm will throw a
|
||||
<a href="./exception.html#negative_edge"><tt>negative_edge</tt></a>
|
||||
exception if one of the edges is negative.
|
||||
The type <tt>WeightMap</tt> must be a model of
|
||||
<a href="../../property_map/doc/ReadablePropertyMap.html">Readable Property Map</a>. The edge descriptor type of
|
||||
the graph needs to be usable as the key type for the weight
|
||||
map. The value type for this map must be
|
||||
the same as the value type of the distance map.<br>
|
||||
<b>Default:</b> <tt>get(edge_weight, g)</tt><br>
|
||||
|
||||
</blockquote>
|
||||
|
||||
UTIL: <tt>predecessor_map(PredEdgeMap pred)</tt>
|
||||
<blockquote>
|
||||
Use by the algorithm to store augmenting paths. The map must be a
|
||||
model of mutable <a
|
||||
href="../../property_map/doc/LvaluePropertyMap.html">Lvalue Property Map</a>.
|
||||
The key type must be the graph's vertex descriptor type and the
|
||||
value type must be the graph's edge descriptor type.<br>
|
||||
|
||||
<b>Default:</b> an <a
|
||||
href="../../property_map/doc/iterator_property_map.html">
|
||||
<tt>iterator_property_map</tt></a> created from a <tt>std::vector</tt>
|
||||
of edge descriptors of size <tt>num_vertices(g)</tt> and
|
||||
using the <tt>i_map</tt> for the index map.
|
||||
</blockquote>
|
||||
|
||||
UTIL: <tt>distance_map(DistanceMap d_map)</tt>
|
||||
<blockquote>
|
||||
The shortest path weight from the source vertex <tt>s</tt> to each
|
||||
vertex in the graph <tt>g</tt> is recorded in this property map. The
|
||||
shortest path weight is the sum of the edge weights along the
|
||||
shortest path. The type <tt>DistanceMap</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadWritePropertyMap.html">Read/Write
|
||||
Property Map</a>. The vertex descriptor type of the graph needs to
|
||||
be usable as the key type of the distance map.
|
||||
|
||||
<b>Default:</b> <a
|
||||
href="../../property_map/doc/iterator_property_map.html">
|
||||
<tt>iterator_property_map</tt></a> created from a
|
||||
<tt>std::vector</tt> of the <tt>WeightMap</tt>'s value type of size
|
||||
<tt>num_vertices(g)</tt> and using the <tt>i_map</tt> for the index
|
||||
map.<br>
|
||||
|
||||
</blockquote>
|
||||
|
||||
UTIL: <tt>distance_map2(DistanceMap2 d_map2)</tt>
|
||||
<blockquote>
|
||||
The shortest path computation in iteration nr <i>k</i> uses distances computed in iteration <i>k</i>.
|
||||
The type <tt>DistanceMap2</tt> must be a model of <a
|
||||
href="../../property_map/doc/ReadWritePropertyMap.html">Read/Write
|
||||
Property Map</a>. The vertex descriptor type of the graph needs to
|
||||
be usable as the key type of the distance map.
|
||||
|
||||
<b>Default:</b> <a
|
||||
href="../../property_map/doc/iterator_property_map.html">
|
||||
<tt>iterator_property_map</tt></a> created from a
|
||||
<tt>std::vector</tt> of the <tt>WeightMap</tt>'s value type of size
|
||||
<tt>num_vertices(g)</tt> and using the <tt>i_map</tt> for the index
|
||||
map.<br>
|
||||
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<blockquote>
|
||||
Maps each vertex of the graph to a unique integer in the range
|
||||
<tt>[0, num_vertices(g))</tt>. This property map is only needed
|
||||
if the default for the distance or distance2 or predecessor map is used.
|
||||
The vertex index map must be a model of <a
|
||||
href="../../property_map/doc/ReadablePropertyMap.html">Readable Property
|
||||
Map</a>. The key type of the map must be the graph's vertex
|
||||
descriptor type.<br>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
</blockquote>
|
||||
|
||||
|
||||
<h3>Complexity</h3>
|
||||
In the integer capacity case, if <i>U</i> is the value of the max flow, then the complexity is <i> O(U * (|E| + |V|*log|V|))</i>,
|
||||
where <i>O(|E| + |V|*log|V|)</i> is the complexity of the dijkstra algorithm and <i>U</i> is upper bound on number of iteration.
|
||||
In many real world cases number of iterations is much smaller than <i>U</i>.
|
||||
|
||||
|
||||
<h3>Example</h3>
|
||||
|
||||
The program in <a
|
||||
href="../example/successive_shortest_path_nonnegative_weights_example.cpp"><tt>example/successive_shortest_path_nonnegative_weights_example.cpp</tt></a>.
|
||||
|
||||
<h3>See Also</h3>
|
||||
|
||||
<a href="./cycle_canceling.html"><tt>cycle_canceling()</tt></a><br>
|
||||
<a href="./find_flow_cost.html"><tt>find_flow_cost()</tt></a>.
|
||||
|
||||
<br>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR valign=top>
|
||||
<TD nowrap>Copyright © 2013</TD><TD>
|
||||
Piotr Wygocki, University of Warsaw (<A HREF="mailto:wygos@mimuw.edu.pl">wygos at mimuw.edu.pl</A>)
|
||||
</TD></TR></TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
<!-- LocalWords: HTML Siek Edmonds BGCOLOR ffffff ee VLINK ALINK ff IMG SRC
|
||||
-->
|
||||
<!-- LocalWords: gif ALT BR sec edmonds karp TT DIV CELLPADDING TR TD PRE lt
|
||||
-->
|
||||
<!-- LocalWords: typename VertexListGraph CapacityEdgeMap ReverseEdgeMap gt
|
||||
-->
|
||||
<!-- LocalWords: ResidualCapacityEdgeMap VertexIndexMap src rev ColorMap pred
|
||||
-->
|
||||
<!-- LocalWords: PredEdgeMap tt href html hpp ul li nbsp br LvaluePropertyMap
|
||||
-->
|
||||
<!-- LocalWords: num ColorValue DIMACS cpp pre config iostream dimacs int std
|
||||
-->
|
||||
<!-- LocalWords: namespace vecS directedS cout endl iter ei HR valign nowrap
|
||||
-->
|
||||
<!-- LocalWords: jeremy siek htm Univ mailto jsiek lsc edu
|
||||
p -->
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
<li>Event Visitors
|
||||
<OL>
|
||||
<LI><a href="predecessor_recorder.html"><tt>predecessor_recorder</tt></a>
|
||||
<LI><a href="edge_predecessor_recorder.html"><tt>edge_predecessor_recorder</tt></a>
|
||||
<LI><a href="distance_recorder.html"><tt>distance_recorder</tt></a>
|
||||
<LI><a href="time_stamper.html"><tt>time_stamper</tt></a>
|
||||
<LI><a href="property_writer.html"><tt>property_writer</tt></a>
|
||||
@@ -100,6 +101,10 @@
|
||||
<LI>Graph classes
|
||||
<OL>
|
||||
<LI><A href="./adjacency_list.html"><tt>adjacency_list</tt></a></li>
|
||||
<OL>
|
||||
<LI><A href="./directed_graph.html"><tt>directed_graph</tt></a></li>
|
||||
<LI><A href="./undirected_graph.html"><tt>undirected_graph</tt></a></li>
|
||||
</OL>
|
||||
<LI><A href="./adjacency_matrix.html"><tt>adjacency_matrix</tt></a></li>
|
||||
<li><a href="compressed_sparse_row.html"><tt>compressed_sparse_row_graph</tt></a></li>
|
||||
</OL></li>
|
||||
@@ -167,7 +172,7 @@
|
||||
href="./johnson_all_pairs_shortest.html"><tt>johnson_all_pairs_shortest_paths</tt></A>
|
||||
<li><a href="floyd_warshall_shortest.html"><tt>floyd_warshall_all_pairs_shortest_paths</tt></a></li>
|
||||
<li><a href="r_c_shortest_paths.html"><tt>r_c_shortest_paths</tt> - resource-constrained shortest paths</a></li>
|
||||
<li><a href="astar_search.html"><tt>astar_search</tt></a></li>
|
||||
<li><a href="astar_search.html"><tt>astar_search</tt> (A* search algorithm)</a></li>
|
||||
</OL>
|
||||
<LI>Minimum Spanning Tree Algorithms
|
||||
<OL>
|
||||
@@ -181,6 +186,11 @@
|
||||
<LI><A
|
||||
href="./random_spanning_tree.html"><tt>random_spanning_tree</tt></A>
|
||||
</OL>
|
||||
<LI>Algorithm for Common Spanning Trees of Two Graphs
|
||||
<OL>
|
||||
<LI><A
|
||||
href="./two_graphs_common_spanning_trees.html"><tt>two_graphs_common_spanning_trees</tt></A>
|
||||
</OL>
|
||||
<LI>Connected Components Algorithms
|
||||
<OL>
|
||||
<LI><A href="./connected_components.html"><tt>connected_components</tt></A>
|
||||
@@ -204,6 +214,12 @@
|
||||
<li><a href="boykov_kolmogorov_max_flow.html"><tt>boykov_kolmogorov_max_flow</tt></a></li>
|
||||
<LI><A href="maximum_matching.html"><tt>edmonds_maximum_cardinality_matching</tt></A>
|
||||
</OL>
|
||||
<LI>Minimum Cost Maximum Flow Algorithms
|
||||
<OL>
|
||||
<LI><A href="cycle_canceling.html"><tt>cycle_canceling</tt></A>
|
||||
<LI><A href="successive_shortest_path_nonnegative_weights.html"><tt>successive_shortest_path_nonnegative_weights</tt></A>
|
||||
<li><a href="find_flow_cost.html"><tt>find_flow_cost</tt></a></li>
|
||||
</OL>
|
||||
<LI>Minimum Cut Algorithms
|
||||
<OL>
|
||||
<LI><A href="stoer_wagner_min_cut.html"><tt>stoer_wagner_min_cut</tt></A>
|
||||
@@ -230,6 +246,7 @@
|
||||
<li>Graph Structure Comparisons
|
||||
<ol>
|
||||
<LI><A href="isomorphism.html"><tt>isomorphism</tt></A>
|
||||
<LI><A href="vf2_sub_graph_iso.html"><tt>vf2_sub_graph_iso</tt> (VF2 subgraph isomorphism algorithm)</A>
|
||||
<li><a href="mcgregor_common_subgraphs.html"><tt>mcgregor_common_subgraphs</tt></a></li>
|
||||
</ol>
|
||||
|
||||
@@ -273,9 +290,12 @@
|
||||
<li>Miscellaneous Algorithms
|
||||
<ol>
|
||||
<li><a href="metric_tsp_approx.html"><tt>metric_tsp_approx</tt></a></li>
|
||||
<LI><A href="sequential_vertex_coloring.html"><tt>sequential_vertex_coloring</tt></A>
|
||||
<LI><A href="is_bipartite.html"><tt>is_bipartite</tt></A> (including two-coloring of bipartite graphs)
|
||||
<LI><A href="find_odd_cycle.html"><tt>find_odd_cycle</tt></A>
|
||||
<LI><A href="sequential_vertex_coloring.html"><tt>sequential_vertex_coloring</tt></A></li>
|
||||
<LI><A href="edge_coloring.html"><tt>edge_coloring</tt></A></li>
|
||||
<LI><A href="is_bipartite.html"><tt>is_bipartite</tt></A> (including two-coloring of bipartite graphs)</li>
|
||||
<LI><A href="find_odd_cycle.html"><tt>find_odd_cycle</tt></A></li>
|
||||
<LI><A href="maximum_adjacency_search.html"><tt>maximum_adjacency_search</tt></A></li>
|
||||
<LI><A href="hawick_circuits.html"><tt>hawick_circuits</tt></A> (find all circuits of a directed graph)</li>
|
||||
</ol>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<b>Default:</b> <tt>get(vertex_index, g)</tt>
|
||||
Note: if you use this default, make sure your graph has
|
||||
an internal <tt>vertex_index</tt> property. For example,
|
||||
<tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
|
||||
<tt>adjacency_list</tt> with <tt>VertexList=listS</tt> does
|
||||
not have an internal <tt>vertex_index</tt> property.
|
||||
<br>
|
||||
|
||||
|
||||
@@ -124,8 +124,8 @@ class convex_topology
|
||||
struct point
|
||||
{
|
||||
point() { }
|
||||
double& operator[](std::size_t i) {return values[i];}
|
||||
const double& operator[](std::size_t i) const {return values[i];}
|
||||
double& operator[](std::size_t i) {return values[i];}
|
||||
const double& operator[](std::size_t i) const {return values[i];}
|
||||
|
||||
private:
|
||||
double values[Dims];
|
||||
@@ -157,7 +157,7 @@ class hypercube_topology : public <a href="#convex_topology">convex_topology</a>
|
||||
{
|
||||
public:
|
||||
explicit hypercube_topology(double scaling = 1.0);
|
||||
hypercube_topology(RandomNumberGenerator& gen, double scaling = 1.0);
|
||||
hypercube_topology(RandomNumberGenerator& gen, double scaling = 1.0);
|
||||
point_type random_point() const;
|
||||
};
|
||||
</pre>
|
||||
@@ -173,13 +173,13 @@ class square_topology : public <a href="#hypercube_topology">hypercube_topology<
|
||||
{
|
||||
public:
|
||||
explicit square_topology(double scaling = 1.0);
|
||||
square_topology(RandomNumberGenerator& gen, double scaling = 1.0);
|
||||
square_topology(RandomNumberGenerator& gen, double scaling = 1.0);
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a name="cube_topology"><h3>Class template <tt>cube_topology</tt></h3></a>
|
||||
|
||||
<p>Class template <tt>cube_topology</tt> is a two-dimensional
|
||||
<p>Class template <tt>cube_topology</tt> is a three-dimensional
|
||||
hypercube topology.
|
||||
|
||||
<pre>
|
||||
@@ -188,7 +188,7 @@ class cube_topology : public <a href="#hypercube_topology">hypercube_topology</a
|
||||
{
|
||||
public:
|
||||
explicit cube_topology(double scaling = 1.0);
|
||||
cube_topology(RandomNumberGenerator& gen, double scaling = 1.0);
|
||||
cube_topology(RandomNumberGenerator& gen, double scaling = 1.0);
|
||||
};
|
||||
</pre>
|
||||
|
||||
@@ -209,7 +209,7 @@ class ball_topology : public <a href="#convex_topology">convex_topology</a><D
|
||||
{
|
||||
public:
|
||||
explicit ball_topology(double radius = 1.0);
|
||||
ball_topology(RandomNumberGenerator& gen, double radius = 1.0);
|
||||
ball_topology(RandomNumberGenerator& gen, double radius = 1.0);
|
||||
point_type random_point() const;
|
||||
};
|
||||
</pre>
|
||||
@@ -225,13 +225,13 @@ class circle_topology : public <a href="#ball_topology">ball_topology</a><2,
|
||||
{
|
||||
public:
|
||||
explicit circle_topology(double radius = 1.0);
|
||||
circle_topology(RandomNumberGenerator& gen, double radius = 1.0);
|
||||
circle_topology(RandomNumberGenerator& gen, double radius = 1.0);
|
||||
};
|
||||
</pre>
|
||||
|
||||
<a name="sphere_topology"><h3>Class template <tt>sphere_topology</tt></h3></a>
|
||||
|
||||
<p>Class template <tt>sphere_topology</tt> is a two-dimensional
|
||||
<p>Class template <tt>sphere_topology</tt> is a three-dimensional
|
||||
ball topology.
|
||||
|
||||
<pre>
|
||||
@@ -240,7 +240,7 @@ class sphere_topology : public <a href="#ball_topology">ball_topology</a><3,
|
||||
{
|
||||
public:
|
||||
explicit sphere_topology(double radius = 1.0);
|
||||
sphere_topology(RandomNumberGenerator& gen, double radius = 1.0);
|
||||
sphere_topology(RandomNumberGenerator& gen, double radius = 1.0);
|
||||
};
|
||||
</pre>
|
||||
|
||||
@@ -258,7 +258,7 @@ class heart_topology
|
||||
typedef <em>unspecified</em> point_type;
|
||||
|
||||
heart_topology();
|
||||
heart_topology(RandomNumberGenerator& gen);
|
||||
heart_topology(RandomNumberGenerator& gen);
|
||||
point_type random_point() const;
|
||||
double distance(point_type a, point_type b) const;
|
||||
point_type move_position_toward(point_type a, double fraction, point_type b) const;
|
||||
|
||||