Compare commits
728 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 | |||
| 081b1f90bf | |||
| a4af894285 | |||
| b407ea9309 | |||
| 19b05b0cae | |||
| 3131ffa454 | |||
| 1fa0cd9a26 | |||
| 5a5b35b154 | |||
| 4b1c5fe438 | |||
| 03510b4a6e | |||
| 30e9f22af4 | |||
| 06bdbbcbba | |||
| f52b7df417 | |||
| 2e4073a8b7 | |||
| 516c833574 | |||
| fd549fe0fa | |||
| b52d4724c2 | |||
| 66cd415568 | |||
| d44293d8a8 | |||
| a0c90983ab | |||
| bb1ce866f8 | |||
| ac4b12107f | |||
| a4452c3539 | |||
| 074277924a | |||
| 6e73c470a4 | |||
| 1963179514 | |||
| bd69c0c5cf | |||
| dcd9920780 | |||
| 8b4eb672e0 | |||
| ec5f6a655c | |||
| e5341acc43 | |||
| 19679d3851 | |||
| 3624e74d13 | |||
| ae33127eed | |||
| 43386bca5c | |||
| 287529480f | |||
| 6fb2f7edec | |||
| 4a5c105654 | |||
| f132fd060f | |||
| 595b9abbdc | |||
| 0415ceffe0 | |||
| 4000bccb3d | |||
| 2e5db3d026 | |||
| ff1775df18 | |||
| b76015210d | |||
| cf1943fb84 | |||
| 086a94c8a5 | |||
| 0ec513eab1 | |||
| 10b41afc0f | |||
| c3aad6b27e | |||
| cc07f4c201 | |||
| 904b4cc924 | |||
| e864071546 | |||
| 979e02a617 | |||
| 9bcc1b9a69 | |||
| 11d2d38a51 | |||
| db812aa773 | |||
| 6c48845da8 | |||
| fb567057df | |||
| 8e365de488 | |||
| a934539462 | |||
| f5b408ef7f | |||
| 7d02f7dd6b | |||
| dbd5774482 | |||
| 11187e5a25 | |||
| aef49c1b8b | |||
| 55dec7c079 | |||
| a3786d7f7e | |||
| 94b48cea30 | |||
| 822fc80494 | |||
| 24a2de892f | |||
| 61d37fe743 | |||
| 43ff6aef6d | |||
| 7ba05ec487 | |||
| f66d119969 | |||
| adc6eb0f0d | |||
| 4673c796aa | |||
| 7b97cbf393 | |||
| e13fcab1e8 | |||
| f095156c22 | |||
| 2aeecada2a | |||
| 00d076b2f8 | |||
| b71896f622 | |||
| 89cd3d8a8a | |||
| bada2e9b7a | |||
| 7e2b915b14 | |||
| ff2980b121 | |||
| 3a01fc7f4e | |||
| 17af2e739a | |||
| 4963f676dc | |||
| 2ba8f21b13 | |||
| c6399e2baf | |||
| c07518f7d1 | |||
| 80378ca2dc | |||
| 0f78fd6710 | |||
| b3809b0910 | |||
| 398ea401df | |||
| 3edc92eebc | |||
| 286c831903 | |||
| 590f8fca52 | |||
| 53edba6e31 | |||
| 892677e57e | |||
| 8d013dc58a | |||
| c573261f24 | |||
| c44888396b | |||
| 724773b517 | |||
| 7c0a0f2da7 | |||
| 954b8066bc | |||
| 57cb8046b1 | |||
| 0d4b7e6b7b | |||
| 367e31c08b | |||
| 4d852e33af | |||
| e6576abc28 | |||
| 326b4ab542 | |||
| 51d0b63c54 | |||
| 783d79bba3 | |||
| f86b056a60 | |||
| b383f407a6 | |||
| 1f2789531e | |||
| 9ff5074af0 | |||
| fab9ffcb37 | |||
| 6e96d8e2f4 | |||
| e896bf8a41 | |||
| 033b0735eb | |||
| 4e1009cac7 | |||
| 78c4cc350b | |||
| 97f72f10fe | |||
| 0b69e667f0 | |||
| 753900a4a0 | |||
| 6e72c1f445 | |||
| b474768cd0 | |||
| b6161b1cb2 | |||
| ac874068dd | |||
| 26f16eb0e2 | |||
| b90204bf75 | |||
| 6d7c351c5b | |||
| f562f8061f | |||
| 4078644f3a | |||
| 6e86b10353 | |||
| 9196ee6cfd | |||
| 75a0bd67a0 | |||
| 917fb11348 | |||
| 90a71f990e | |||
| 7330452212 | |||
| 706f23a02d | |||
| d6eb198e36 | |||
| cb2d8619c5 | |||
| a0d982cdb4 | |||
| c048688bfa | |||
| 87b7eb047d | |||
| 3db3c55bf4 | |||
| e98b1efd21 | |||
| 1a51b383ff | |||
| b1e8eeacd7 | |||
| 61109b6b34 | |||
| b99db562e3 | |||
| 725a5910d7 | |||
| 6af93735fd | |||
| 21c9b6e553 | |||
| 00dcf87246 | |||
| 71ecfa425e | |||
| e9fcb04d9f | |||
| e66d822b25 | |||
| a74dac8d15 | |||
| 0dd699a355 | |||
| c19fbafcf6 | |||
| 904819f886 | |||
| a3fa432c9f | |||
| 0c75ddee03 | |||
| b13d8ec429 | |||
| 14a8a21105 | |||
| 109cdf39be | |||
| 1a52f5132f | |||
| a9e93bfe92 | |||
| 373aabbf5b | |||
| 1d882adf30 | |||
| 3ca99558ff | |||
| 1ba64f82ec | |||
| 0f4d9c80a1 | |||
| b76090ad8d | |||
| fad45bcb1b | |||
| dababea605 | |||
| c03ffc7c3e | |||
| 8dc3d67377 | |||
| 319cbc4947 | |||
| 205d3176a7 | |||
| 32d2dd1124 | |||
| 63bca89427 | |||
| 5e3a6a954a | |||
| 19a0adaf64 | |||
| c1164d8bb9 | |||
| c793b7a9ec | |||
| 6810d4167d | |||
| 5e9cac2ed6 | |||
| c170e069ae | |||
| 6d19c10ed6 | |||
| b5138b89ac | |||
| 1917131f0f | |||
| 93b0fbf23e | |||
| c0b6e0933d | |||
| 8cccc3c027 | |||
| 2eca482bec | |||
| f3af4d1a4e | |||
| 4a3a1b5b70 | |||
| 77be6de60e | |||
| 744a588308 | |||
| 0737b42364 | |||
| 0ccfbb5754 | |||
| 97e1916248 | |||
| ba2d8eeffc | |||
| a4af699063 | |||
| 10135eeab5 | |||
| dd07cb4c5a | |||
| e5aebbcc97 | |||
| d00948cef3 | |||
| 8431fde428 | |||
| e47d3c4c5a | |||
| fa50529664 | |||
| 4124f2c7ff | |||
| 1d018bbeab | |||
| 08d4597f35 | |||
| 616543e629 | |||
| ab3e981794 | |||
| 2d7c00159e | |||
| 09496c3696 | |||
| b2636ec3ea | |||
| 5478788f98 | |||
| dfb0e1ab90 | |||
| 88cc021588 | |||
| 770ce8cf86 | |||
| f9cc40283c | |||
| 42cf78c555 | |||
| bf679e7e19 | |||
| 9355c68e52 | |||
| c1f12a21b0 | |||
| 4279beb707 | |||
| 76083c7e67 | |||
| b237a6ee82 | |||
| dced37cf67 | |||
| e5936c730d | |||
| f41358a7ee | |||
| 93fae3dece | |||
| a880fcbde7 | |||
| f2d850e4f9 | |||
| 53221f13ab | |||
| 1d66d04fc1 | |||
| ab16f809a0 | |||
| 51182ecec6 | |||
| 0899a49611 | |||
| d2d80c64da | |||
| 5c1a27890c | |||
| 5810b885a7 | |||
| 35a3b60e5d | |||
| fe10254f0c | |||
| 1768443b87 | |||
| 454cc349a1 | |||
| f0d4890326 | |||
| 818124bc40 | |||
| c12358b15b | |||
| 50bc92b159 | |||
| 722e0c6cc6 | |||
| b1231d3469 | |||
| a7a18787e9 | |||
| f9341ebe86 | |||
| 8258ae5b51 | |||
| 4e015739c4 | |||
| 5fe4310658 | |||
| a04721f0ed | |||
| e54ede1993 | |||
| 027f256b52 | |||
| ab7510ba75 | |||
| 02891de03f | |||
| f20a8aa9b5 | |||
| c9c6f4b631 | |||
| 600bb3f37c | |||
| f87613ea1b | |||
| 20fd0bef2d | |||
| 24c0b6db9d | |||
| fd3a5f46f5 | |||
| c748a400e9 | |||
| 5eee5fa952 | |||
| 3b3977cd3e | |||
| 2566623af3 | |||
| eede6c1338 | |||
| 27e1fe603f | |||
| 483310f08a | |||
| 0b53b0b00a | |||
| 083d6b83aa | |||
| 925fd6a2d6 | |||
| 0b60534904 | |||
| 883beb8102 | |||
| 394757f512 | |||
| cdcb54e084 | |||
| 38dd3d15fa | |||
| d4078044ad | |||
| 2e70900dce | |||
| de12ad6911 | |||
| 414f2b1af0 | |||
| 82c88cb90e | |||
| 30602358e9 | |||
| 1645bd1bb9 | |||
| 2641f77ab6 | |||
| b1554dfafb | |||
| c1979501bb | |||
| d5e29e90c1 | |||
| 5a01455ca3 | |||
| 9574e5a490 | |||
| 90a8d79f4d | |||
| 71830942e6 | |||
| 8be1112040 | |||
| 8ca5d4e494 | |||
| 3a4213ff02 | |||
| 5f402c0c31 | |||
| 84a790d954 | |||
| 5a3490da07 | |||
| 711e647fd2 | |||
| fdfba32734 | |||
| 9d5036e580 | |||
| c5e0a6acd0 | |||
| a5bbe074a6 | |||
| 78a0de9f63 | |||
| c21d244bbb | |||
| eacf5f1c6d | |||
| d380695958 | |||
| 6d6048c9a1 | |||
| c523b99ddf | |||
| 4a03e4c700 | |||
| cdf526c24d | |||
| d249df4521 | |||
| 012d41e6a5 | |||
| 37f5ad4a5f | |||
| 97e86ebe5f | |||
| 84c7f22f11 | |||
| 5d033cb991 | |||
| cef1982db1 | |||
| 9daa48bff4 | |||
| 54d8958f9c | |||
| 217e527cb3 | |||
| e006f8ff04 |
@@ -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;
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2009 The Trustees of Indiana University.
|
||||
# Copyright (C) 2010 Daniel Trebbien.
|
||||
# Use, modification and distribution is 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)
|
||||
|
||||
# Authors: Jeremiah Willcock, Andrew Lumsdaine
|
||||
# Authors: Jeremiah Willcock, Daniel Trebbien, Andrew Lumsdaine
|
||||
|
||||
for i in read_graphml read_graphviz write_graphml; do
|
||||
rst2html.py -gdt --link-stylesheet --traceback --trim-footnote-reference-space --footnote-references=superscript --stylesheet=../../../rst.css $i.rst > $i.html
|
||||
done
|
||||
# Also see grid_graph_export_png.sh for figure conversions
|
||||
|
||||
# Stoer-Wagner images from Daniel Trebbien
|
||||
fdp -s -n -Tgif -ostoer_wagner_imgs/digraph1.gif stoer_wagner_imgs/digraph1.dot
|
||||
fdp -s -n -Tgif -ostoer_wagner_imgs/digraph1-min-cut.gif stoer_wagner_imgs/digraph1-min-cut.dot
|
||||
fdp -s -n -Tgif -ostoer_wagner_imgs/stoer_wagner-example.gif stoer_wagner_imgs/stoer_wagner-example.dot
|
||||
fdp -s -n -Tgif -ostoer_wagner_imgs/stoer_wagner-example-c1.gif stoer_wagner_imgs/stoer_wagner-example-c1.dot
|
||||
fdp -s -n -Tgif -ostoer_wagner_imgs/stoer_wagner-example-min-cut.gif stoer_wagner_imgs/stoer_wagner-example-min-cut.dot
|
||||
dot -Tgif -ostoer_wagner_imgs/stoer_wagner.cpp.gif stoer_wagner_imgs/stoer_wagner.cpp.dot
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright Daniel Trebbien 2010.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or the copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>KeyedUpdatableQueue</title>
|
||||
</head>
|
||||
<body>
|
||||
<img src="../../../boost.png" alt="C++ Boost">
|
||||
|
||||
<h2><a name="concept:KeyedUpdatableQueue">KeyedUpdatableQueue</a></h2>
|
||||
|
||||
<p>A <i>KeyedUpdatableQueue</i> is a refinement of the <a href="./UpdatableQueue.html">UpdatableQueue</a> concept.
|
||||
It requires that models order the contained values by their <i>keys</i>, to which
|
||||
values are mapped via a read/write key map.
|
||||
|
||||
<h3>Notation</h3>
|
||||
|
||||
<table>
|
||||
<tr> <td> <tt>Q</tt> </td> <td> is a type that models KeyedUpdatableQueue. </td></tr>
|
||||
<tr> <td> <tt>T</tt> </td> <td> is the value type of <tt>Q</tt>. </td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
<h3>Members</h3>
|
||||
|
||||
For a type to model the KeyedUpdatableQueue concept it must have the following members
|
||||
in addition to the members that are required of types that model <a href="./UpdatableQueue.html">UpdatableQueue</a>:
|
||||
|
||||
<p>
|
||||
|
||||
<table border="1">
|
||||
|
||||
<tr> <td><b>Member</b></td> <td><b>Description</b></td> </tr>
|
||||
|
||||
<tr> <td> <tt>key_type</tt> </td>
|
||||
<td> The type of keys that are associated with values </td>
|
||||
</tr>
|
||||
|
||||
<tr> <td> <tt>key_map</tt> </td>
|
||||
<td> The key property map type. This type must model <a href="../../property_map/doc/ReadWritePropertyMap.html">Read/Write Property Map</a>. </td>
|
||||
</tr>
|
||||
|
||||
<tr> <td> <tt>key_map keys() const</tt> </td>
|
||||
<td> Returns the key map </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h3>Concept Checking Class</h3>
|
||||
|
||||
<p><a href="../../../boost/graph/buffer_concepts.hpp"><tt>boost/graph/buffer_concepts.hpp</tt></a>
|
||||
|
||||
<pre>
|
||||
template <class Q>
|
||||
struct KeyedUpdatableQueueConcept
|
||||
{
|
||||
typedef typename Q::key_type key_type;
|
||||
typedef typename Q::key_map key_map;
|
||||
|
||||
void constraints() {
|
||||
BOOST_CONCEPT_ASSERT(( UpdatableQueue<Q> ));
|
||||
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMap< key_map, typename Buffer<Q>::value_type > ));
|
||||
}
|
||||
|
||||
void const_constraints(const Q& cq) {
|
||||
km = cq.keys();
|
||||
k = get(km, g_ct);
|
||||
}
|
||||
|
||||
static const typename Buffer<Q>::value_type g_ct;
|
||||
key_type k;
|
||||
key_map km;
|
||||
Q q;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<h3>Models</h3>
|
||||
|
||||
<ul>
|
||||
<li><tt>boost::d_ary_heap_indirect</tt></a>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
<hr>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Copyright © 2010</td>
|
||||
<td>Daniel Trebbien (<a href="mailto:dtrebbien@gmail.com">dtrebbien@gmail.com</a>)
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright Daniel Trebbien 2010.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or the copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>UpdatableQueue</title>
|
||||
</head>
|
||||
<body>
|
||||
<img src="../../../boost.png" alt="C++ Boost">
|
||||
|
||||
<h2><a name="concept:UpdatableQueue">UpdatableQueue</a></h2>
|
||||
|
||||
<p>An <i>UpdatableQueue</i> is a refinement of the <a href="./Buffer.html">Buffer</a> concept that additionally requires that the Buffer be updatable.
|
||||
|
||||
<p>Implicit in the definition is an ordering of values. Though access to the order is not required, types that model UpdatableQueue must document how an object of the type orders values so that a program may change the position of a given value in the ordering. For example, an UpdatableQueue may choose to order values by using a property map, and a value <tt>v1</tt> is considered less than a value <tt>v2</tt> if <tt><nobr>get(pm, v1) < get(pm, v2)</nobr></tt>. A program can update the properties of values, thus changing the order of values in the UpdatableQueue, and notify the UpdatableQueue of the specific values that have a different position in the ordering by calling the <tt>update</tt> member of the UpdatableQueue on each.
|
||||
|
||||
<p>A program that modifies the order must notify the UpdatableQueue of values that may have different positions in the ordering since they were inserted or last updated.
|
||||
|
||||
<h3>Notation</h3>
|
||||
|
||||
<table>
|
||||
<tr> <td> <tt>Q</tt> </td> <td> is a type that models UpdatableQueue. </td></tr>
|
||||
<tr> <td> <tt>T</tt> </td> <td> is the value type of <tt>Q</tt>. </td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
<h3>Members</h3>
|
||||
|
||||
For a type to model the UpdatableQueue concept it must have the following members
|
||||
in addition to the members that are required of types that model <a href="./Buffer.html">Buffer</a>:
|
||||
|
||||
<p>
|
||||
|
||||
<table border="1">
|
||||
|
||||
<tr> <td><b>Member</b></td> <td><b>Description</b></td> </tr>
|
||||
|
||||
<tr> <td> <a name="concept:UpdatableQueue:update"><tt>void update(const T& t)</tt></a> </td>
|
||||
<td> Informs the UpdatableQueue that the program has modified the position of <tt>t</tt> in the ordering </td>
|
||||
</tr>
|
||||
|
||||
<tr> <td> <tt><i>unspecified-bool-type</i> contains(const T& t) const</tt> </td>
|
||||
<td> Returns whether the queue contains <tt>t</tt> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h3>Concept Checking Class</h3>
|
||||
|
||||
<p><a href="../../../boost/graph/buffer_concepts.hpp"><tt>boost/graph/buffer_concepts.hpp</tt></a>
|
||||
|
||||
<pre>
|
||||
template <class Q>
|
||||
struct UpdatableQueueConcept
|
||||
{
|
||||
void constraints() {
|
||||
BOOST_CONCEPT_ASSERT(( Buffer<Q> ));
|
||||
|
||||
q.update(g_ct);
|
||||
}
|
||||
|
||||
void const_constraints(const Q& cq) {
|
||||
if (cq.contains(g_ct));
|
||||
}
|
||||
|
||||
static const typename Buffer<Q>::value_type g_ct;
|
||||
Q q;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<h3>Futher Refinements</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="#concept%3AUpdatablePriorityQueue">UpdatablePriorityQueue</a>
|
||||
<li><a href="./KeyedUpdatableQueue.html">KeyedUpdatableQueue</a>
|
||||
</ul>
|
||||
|
||||
<h2><a name="concept:UpdatablePriorityQueue">UpdatablePriorityQueue</a></h2>
|
||||
<p>An <i>UpdatablePriorityQueue</i> is a slight refinement of <a href="#concept%3AUpdatableQueue">UpdatableQueue</a>
|
||||
that imposes the requirement that a program may not increase the position of a value that is held in the queue. That is,
|
||||
if a value <tt>v</tt> had position <i>n</i> in the ordering, a program may update the position of <tt>v</tt> only to 0, 1, ..., <i>n</i> - 1, or <i>n</i>, where 0 is the top of the queue.
|
||||
|
||||
<p>The behavior when a program attempts to increase a value's position in the ordering is undefined.
|
||||
|
||||
<br>
|
||||
<hr>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Copyright © 2010</td>
|
||||
<td>Daniel Trebbien (<a href="mailto:dtrebbien@gmail.com">dtrebbien@gmail.com</a>)
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -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
|
||||
|
||||
@@ -8,57 +8,59 @@
|
||||
|
||||
For more information, see http://www.boost.org
|
||||
-->
|
||||
<head>
|
||||
<title>Bundled Properties</title>
|
||||
</head>
|
||||
<head>
|
||||
<title>Bundled Properties</title>
|
||||
</head>
|
||||
|
||||
<body BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
ALT="C++ Boost" width="277" height="86"/>
|
||||
<h1>Bundled Properties</h1>
|
||||
<body BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
ALT="C++ Boost" width="277" height="86"/>
|
||||
<h1>Bundled Properties</h1>
|
||||
|
||||
<p>Class templates <code><a
|
||||
href="adjacency_list.html">adjacency_list</a></code> and
|
||||
<code><a href="adjacency_matrix.html">adjacency_matrix</a></code> support
|
||||
the introduction of named properties via <a
|
||||
href="using_adjacency_list.html#sec:adjacency-list-properties">internal
|
||||
properties</a>. However, this method is cumbersome in many uses,
|
||||
where it would be more intuitive to just specify a structure or
|
||||
class that contains internal properties for edges or
|
||||
vertices. Bundled properties allow one to use
|
||||
<code>adjacency_list</code> and <code>adjacency_matrix</code> in this
|
||||
manner, providing a simple
|
||||
way to introduce and access any number of internal properties
|
||||
for vertices and edges.</p>
|
||||
<p>Class templates <code><a
|
||||
href="adjacency_list.html">adjacency_list</a></code> and
|
||||
<code><a href="adjacency_matrix.html">adjacency_matrix</a></code> support
|
||||
the introduction of named properties via <a
|
||||
href="using_adjacency_list.html#sec:adjacency-list-properties">internal
|
||||
properties</a>. However, this method is cumbersome in many uses,
|
||||
where it would be more intuitive to just specify a structure or
|
||||
class that contains internal properties for edges or
|
||||
vertices. Bundled properties allow one to use
|
||||
<code>adjacency_list</code> and <code>adjacency_matrix</code> in this
|
||||
manner, providing a simple
|
||||
way to introduce and access any number of internal properties
|
||||
for vertices and edges.</p>
|
||||
|
||||
<p>One can introduce bundled properties into an
|
||||
either graph type by providing a user-defined class
|
||||
type for the <code>VertexProperties</code> or
|
||||
<code>EdgeProperties</code> template arguments. The user-defined
|
||||
class may alternatively be placed at the end of a
|
||||
<code>property</code> list, replacing the (implicit)
|
||||
<code>boost::no_property</code> argument.</p>
|
||||
<p>One can introduce bundled properties into an
|
||||
either graph type by providing a user-defined class
|
||||
type for the <code>VertexProperties</code> or
|
||||
<code>EdgeProperties</code> template arguments. The user-defined
|
||||
class may alternatively be placed at the end of a
|
||||
<code>property</code> list, replacing the (implicit)
|
||||
<code>boost::no_property</code> argument.</p>
|
||||
|
||||
<h2>Example: Route planning</h2>
|
||||
<p>Consider the implementation of a simple route planner that
|
||||
should find the shortest directions from one city to another
|
||||
via a set of highways. The vertices of the graph are cities,
|
||||
and we may wish to store several bits of information about the
|
||||
city within each vertex:</p>
|
||||
<pre>
|
||||
<h2>Example: Route planning</h2>
|
||||
<p>Consider the implementation of a simple route planner that
|
||||
should find the shortest directions from one city to another
|
||||
via a set of highways. The vertices of the graph are cities,
|
||||
and we may wish to store several bits of information about the
|
||||
city within each vertex:</p>
|
||||
<pre>
|
||||
struct City
|
||||
{
|
||||
string name;
|
||||
int population;
|
||||
vector<int> zipcodes;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<p>The edges in the graph represent highways, which also have
|
||||
several interesting attributes:</p>
|
||||
</pre>
|
||||
|
||||
<pre>
|
||||
<p>
|
||||
The edges in the graph represent highways, which also have several interesting
|
||||
attributes:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
struct Highway
|
||||
{
|
||||
string name;
|
||||
@@ -67,41 +69,73 @@ struct Highway
|
||||
int lanes;
|
||||
bool divided;
|
||||
};
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
<p>Without bundled properties, translating this example directly
|
||||
into an instantiation of <code>adjacency_list</code> would
|
||||
involve several custom properties and would result in a type
|
||||
like this:</p>
|
||||
<pre>
|
||||
<p>With bundled properties, we can directly use the <code>City</code> and
|
||||
<code>Highway</code> structures to define the graph:</p>
|
||||
<pre>
|
||||
typedef boost::adjacency_list<
|
||||
boost::listS, boost::vecS, boost::bidirectionalS,
|
||||
City, Highway>
|
||||
Map;
|
||||
</pre>
|
||||
|
||||
<p>Without bundled properties, translating this example directly
|
||||
into an instantiation of <code>adjacency_list</code> would
|
||||
involve several custom properties and would result in a type
|
||||
like this:</p>
|
||||
<pre>
|
||||
typedef boost::adjacency_list<
|
||||
boost::listS, boost::vecS, boost::bidirectionalS,
|
||||
// Vertex properties
|
||||
boost::property<boost::vertex_name_t, std::string,
|
||||
boost::property<boost::vertex_name_t, std::string,
|
||||
boost::property<population_t, int,
|
||||
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> > > > > >
|
||||
Map;
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
<p>With bundled properties, we can directly use the
|
||||
<code>City</code> and <code>Highway</code> structures:</p>
|
||||
<pre>
|
||||
<p>
|
||||
Bundling vertex and edge properties greatly simplifies the declaration of
|
||||
graphs.
|
||||
</p>
|
||||
<p>
|
||||
In addition to vertex and edge bundles, we can also bundle properties of the
|
||||
graph itself. Suppopse we extend the application to include a portfolio of
|
||||
route-planning maps for different countries. In addition to the <code>City</code>
|
||||
and <code>Highway</code> bundles above, we can declare a graph bundle,
|
||||
<code>Country</Code>.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
struct Country {
|
||||
string name;
|
||||
bool use_right; // Drive on the left or right
|
||||
bool use_metric; // mph or km/h
|
||||
};
|
||||
</pre>
|
||||
|
||||
<p>The graph would now be declared as:</p>
|
||||
|
||||
<pre>
|
||||
<pre>
|
||||
typedef boost::adjacency_list<
|
||||
boost::listS, boost::vecS, boost::bidirectionalS,
|
||||
City, Highway> Map;
|
||||
</pre>
|
||||
City, Highway, Country>
|
||||
Map;
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
<h2>Accessing bundled properties</h2>
|
||||
<p>To access a bundled property for a particular edge or vertex,
|
||||
subscript your graph with the descriptor of the edge or vertex
|
||||
whose bundled property you wish to access. For instance:</p>
|
||||
<pre>
|
||||
<h2>Accessing bundled properties</h2>
|
||||
<p>To access a bundled property for a particular edge or vertex,
|
||||
subscript your graph with the descriptor of the edge or vertex
|
||||
whose bundled property you wish to access. For instance:</p>
|
||||
<pre>
|
||||
Map map; // load the map
|
||||
Map::vertex_descriptor v = *vertices(map).first;
|
||||
map[v].name = "Troy";
|
||||
@@ -109,70 +143,86 @@ map[v].population = 49170;
|
||||
map[v].zipcodes.push_back(12180);
|
||||
Map::edge_descriptor e = *out_edges(v, map).first;
|
||||
map[e].name = "I-87";
|
||||
map[e].miles = 10;
|
||||
map[e].miles = 10.;
|
||||
map[e].speed_limit = 65;
|
||||
map[e].lanes = 4;
|
||||
map[e].divided = true;
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
<h2>Properties maps from bundled properties</h2>
|
||||
<p>Often one needs to create a property map from an internal
|
||||
property for use in a generic algorithm. For instance, using the
|
||||
graph without bundled properties we might invoke <a
|
||||
href="dijkstra_shortest_paths.html">Dijkstra's shortest
|
||||
paths</a> algorithm like this:</p>
|
||||
<pre>
|
||||
<p>
|
||||
The graph bundle, since it does not correspond to a vertex or edge descripor
|
||||
is accessed using the graph_bundle object as a key.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
map[graph_bundle].name = "United States";
|
||||
map[graph_bundle].use_right = true;
|
||||
map[graph_bundle].use_metric = false;
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>Properties maps from bundled properties</h2>
|
||||
<p>Often one needs to create a property map from an internal
|
||||
property for use in a generic algorithm. For instance, using the
|
||||
graph without bundled properties we might invoke <a
|
||||
href="dijkstra_shortest_paths.html">Dijkstra's shortest
|
||||
paths</a> algorithm like this:</p>
|
||||
<pre>
|
||||
vector<double> distances(num_vertices(map));
|
||||
dijkstra_shortest_paths(map, from,
|
||||
weight_map(get(edge_length, map))
|
||||
.distance_map(make_iterator_property_map(distances.begin(),
|
||||
get(vertex_index, map))));
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
<p>With bundled properties, we can just pass a <em>member pointer</em>
|
||||
as the property for <code>get</code>. The equivalent example
|
||||
using bundled properties is:</p>
|
||||
<pre>
|
||||
<p>With bundled properties, we can just pass a <em>member pointer</em>
|
||||
as the property for <code>get</code>. The equivalent example using bundled
|
||||
properties is:</p>
|
||||
<pre>
|
||||
vector<double> distances(num_vertices(map));
|
||||
dijkstra_shortest_paths(map, from,
|
||||
weight_map(get(<font color="#ff0000">&Highway::miles</font>, map))
|
||||
.distance_map(make_iterator_property_map(distances.begin(),
|
||||
get(vertex_index, map))));
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
<p>The type of the returned property map is <code>property_map<Map, int Highway::*>::type</code>
|
||||
or <code>property_map<Map, int Highway::*>::const_type</code>, depending on whether the graph
|
||||
<code>map</code> is non-constant or constant.
|
||||
|
||||
<p> You may also access the entire vertex or edge bundle as a property map
|
||||
using the <code>vertex_bundle</code> or <code>edge_bundle</code> properties,
|
||||
respectively. For instance, the property map returned by <code>get(vertex_bundle, map)</code> is
|
||||
an <a href="../../property_map/doc/LvaluePropertyMap.html">Lvalue Property Map</a> providing access to the
|
||||
<code>City</code> values stored in each vertex.
|
||||
<p>The type of the returned property map is <code>property_map<Map, double Highway::*>::type</code>
|
||||
or <code>property_map<Map, double Highway::*>::const_type</code>, depending on whether the graph
|
||||
<code>map</code> is non-constant or constant.
|
||||
|
||||
<h2>Getting the type of bundled properties</h2>
|
||||
<p> You may also access the entire vertex or edge bundle as a property map
|
||||
using the <code>vertex_bundle</code> or <code>edge_bundle</code> properties,
|
||||
respectively. For instance, the property map returned by <code>get(vertex_bundle, map)</code> is
|
||||
an <a href="../../property_map/doc/LvaluePropertyMap.html">Lvalue Property Map</a> providing access to the
|
||||
<code>City</code> values stored in each vertex.
|
||||
|
||||
<p>To get the type of the vertex or edge bundle for a given graph
|
||||
type <tt>Graph</tt>, you can use the trait
|
||||
classes <tt>vertex_bundle_type</tt>
|
||||
and <tt>edge_bundle_type</tt>. The
|
||||
type <tt>vertex_bundle_type<Graph>::type</tt> will be the
|
||||
type bundled with vertices (or <tt>no_vertex_bundle</tt> if the
|
||||
graph supports bundles but no vertex bundle
|
||||
exists). Likewise, <tt>edge_bundle_type<Graph>::type</tt>
|
||||
will be the type bundled with edges (or <tt>no_edge_bundle</tt> if
|
||||
no edge bundle exists).</p>
|
||||
<h2>Property maps for a graph bundle</h2>
|
||||
There is currently no support for creating property maps from the bundled
|
||||
properties of a graph.
|
||||
|
||||
<h2>Compatibility</h2> <p>Bundled properties will only work
|
||||
properly on compilers that support class template partial
|
||||
specialization.</p>
|
||||
<h2>Getting the type of bundled properties</h2>
|
||||
|
||||
<hr>
|
||||
<p>To get the type of the vertex or edge bundle for a given graph
|
||||
type <tt>Graph</tt>, you can use the trait
|
||||
classes <tt>vertex_bundle_type</tt>
|
||||
and <tt>edge_bundle_type</tt>. The
|
||||
type <tt>vertex_bundle_type<Graph>::type</tt> will be the
|
||||
type bundled with vertices (or <tt>no_vertex_bundle</tt> if the
|
||||
graph supports bundles but no vertex bundle
|
||||
exists). Likewise, <tt>edge_bundle_type<Graph>::type</tt>
|
||||
will be the type bundled with edges (or <tt>no_edge_bundle</tt> if
|
||||
no edge bundle exists).</p>
|
||||
|
||||
<h2>Compatibility</h2> <p>Bundled properties will only work
|
||||
properly on compilers that support class template partial
|
||||
specialization.</p>
|
||||
|
||||
<hr>
|
||||
Copyright © 2004 <a href="http://www.boost.org/people/doug_gregor.html">Doug Gregor</a>.
|
||||
<address><a href="mailto:gregod@cs.rpi.edu"></a></address>
|
||||
<address><a href="mailto:gregod@cs.rpi.edu"></a></address>
|
||||
<!-- Created: Fri May 7 09:59:21 EDT 2004 -->
|
||||
<!-- hhmts start -->
|
||||
Last modified: Fri May 7 10:56:01 EDT 2004
|
||||
<!-- hhmts end -->
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -248,9 +248,13 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
|
||||
OUT: <tt>predecessor_map(PredecessorMap p_map)</tt>
|
||||
<blockquote>
|
||||
The predecessor map records the edges in the minimum spanning
|
||||
tree. Upon completion of the algorithm, the edges <i>(p[u],u)</i>
|
||||
for all <i>u in V</i> are in the minimum spanning tree. If <i>p[u] =
|
||||
The predecessor map records the edges in the shortest path tree, the tree computed
|
||||
by the traversal of the graph. Upon completion of the algorithm, the edges
|
||||
<i>(p[u],u)</i> for all <i>u in V</i> are in the tree. The shortest path
|
||||
from vertex <i>s</i> to each vertex <i>v</i> in the graph consists of the
|
||||
vertices <i>v</i>, <i>p[v]</i>, <i>p[p[v]]</i>, and so on until <i>s</i> is
|
||||
reached, in reverse order. The
|
||||
tree is not guaranteed to be a minimum spanning tree. If <i>p[u] =
|
||||
u</i> then <i>u</i> is either the source vertex or a vertex that is
|
||||
not reachable from the source. The <tt>PredecessorMap</tt> type
|
||||
must be a <a
|
||||
@@ -326,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.
|
||||
@@ -386,7 +392,7 @@ OUT: <tt>visitor(DijkstraVisitor v)</tt>
|
||||
<H3>Complexity</H3>
|
||||
|
||||
<P>
|
||||
The time complexity is <i>O(V log V)</i>.
|
||||
The time complexity is <i>O(V log V + E)</i>.
|
||||
|
||||
|
||||
<h3>Visitor Event Points</h3>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -322,7 +318,7 @@ OUT: <tt>visitor(DijkstraVisitor v)</tt>
|
||||
<H3>Complexity</H3>
|
||||
|
||||
<P>
|
||||
The time complexity is <i>O(V log V)</i>.
|
||||
The time complexity is <i>O(V log V + E)</i>.
|
||||
|
||||
|
||||
<h3>Visitor Event Points</h3>
|
||||
|
||||
@@ -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 |
@@ -211,7 +211,7 @@ main observation for determining the ``time slot'' for a file is that
|
||||
the time slot must be one more than the maximum time-slot of the files
|
||||
it depends on.
|
||||
|
||||
<P>We start be creating a vector <code>time</code> that will store the
|
||||
<P>We start by creating a vector <code>time</code> that will store the
|
||||
time step at which each file can be built. We initialize every value
|
||||
with time step zero.</p>
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -134,7 +134,7 @@ IN: <code>distance_inf(WM inf)</code>
|
||||
<blockquote>
|
||||
The value used to initialize the distance for each vertex before
|
||||
starting the algorithm, and to represent the distance between vertices
|
||||
for which there is not path. Should be larger than any possible valid
|
||||
for which there is no path. Should be larger than any possible valid
|
||||
path length. The argument type must match the value type of the <code>
|
||||
WeightMap</code>.<br>
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -216,7 +216,7 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
<H3>Complexity</H3>
|
||||
|
||||
<P> The time complexity is <i>O(|V|<sup>2</sup> + |E|)</i> for each
|
||||
iteration of the algorithm in the worse case. The average case for the
|
||||
iteration of the algorithm in the worst case. The average case for the
|
||||
grid variant is <i>O(|V| + |E|)</i>. The number of iterations is
|
||||
determined by the cooling schedule.
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<HTML>
|
||||
<!--
|
||||
Copyright (c) Jeremy Siek 2000
|
||||
Copyright (c) Daniel Trebbien 2010
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -551,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
|
||||
@@ -578,6 +582,41 @@ which is based on the notion of a <b><i>preflow</i></b> introduced by
|
||||
<a href="./bibliography.html#karzanov74:_deter">Karzanov</a>.
|
||||
|
||||
|
||||
<h2><a name="sec:min-cut-algorithms">Minimum Cut Algorithms</a></h2>
|
||||
|
||||
<h3>Undirected Graphs</h3>
|
||||
<p>Given an undirected graph <i>G</i> = (<i>V</i>, <i>E</i>), a <em>cut</em> of <i>G</i> is a partition of the vertices into two, non-empty sets <i>X</i> and <img src="stoer_wagner_imgs/6e4.gif" alt="\overline{X} = V - X" style="vertical-align: middle; padding-bottom: 2px">. The <i>weight</i> of a cut is defined as the number of edges between sets <i>X</i> and <img src="stoer_wagner_imgs/f79.gif" alt="\overline{X}" style="vertical-align: middle; padding-bottom: 3px"> if <i>G</i> is unweighted, or the sum of the weights of all edges between sets <i>X</i> and <img src="stoer_wagner_imgs/f79.gif" alt="\overline{X}" style="vertical-align: middle; padding-bottom: 3px"> if <i>G</i> is weighted (each edge has an associated, non-negative weight).
|
||||
|
||||
<p>When the weight of a cut <img src="stoer_wagner_imgs/8b7.gif" alt="C = \{X, \overline{X}\}" style="vertical-align: middle"> is minimal for a graph <i>G</i> (that is, no other cut of <i>G</i> has a lesser weight), then the cut is known as a <em>minimum cut</em> or a <em>min-cut</em>. For example, given this weighted graph:
|
||||
|
||||
<p><a href="stoer_wagner_imgs/stoer_wagner-example.dot"><img src="stoer_wagner_imgs/stoer_wagner-example.gif"></a>
|
||||
|
||||
<p>The cut {{0, 6}, {3, 2, 7, 1, 5, 4}} has weight 13:
|
||||
|
||||
<p><a href="stoer_wagner_imgs/stoer_wagner-example-c1.dot"><img src="stoer_wagner_imgs/stoer_wagner-example-c1.gif"></a>
|
||||
|
||||
<p>And the min-cut is {{0, 1, 4, 5}, {2, 3, 6, 7}} (weight 4):
|
||||
|
||||
<p><a href="stoer_wagner_imgs/stoer_wagner-example-min-cut.dot"><img src="stoer_wagner_imgs/stoer_wagner-example-min-cut.gif"></a>
|
||||
|
||||
<p>Unlike this example, a graph will sometimes have multiple min-cuts, all of equal weight. A minimum cut algorithm determines one of them as well as the min-cut weight.
|
||||
|
||||
<h3>Directed Graphs</h3>
|
||||
|
||||
<p>Given a directed graph <i>G</i> = (<i>V</i>, <i>E</i>), a <em>cut</em> of <i>G</i> is a partition of the vertices into two, non-empty sets <i>S</i> and <i>T</i> where <i>S</i> is known as the set of <em>source vertices</em> and <i>T</i> is known as the set of <em>sink vertices</em>. The <em>capacity</em> of a cut <i>C</i> = (<i>S</i>, <i>T</i>) is the number of edges from a vertex in <i>S</i> to a vertex in <i>T</i> if <i>G</i> is unweighted, or the sum of weights of edges from a vertex in <i>S</i> to a vertex in <i>T</i> if <i>G</i> is weighted.
|
||||
|
||||
<p>When the capacity of a cut <i>C</i> = (<i>S</i>, <i>T</i>) of a directed graph is minimal (that is, no other cut of <i>G</i> has lesser capacity), then <i>C</i> is known as a <em>minimum cut</em> or <em>min-cut</em>.
|
||||
|
||||
<p>For example, given this directed graph:
|
||||
|
||||
<p><a href="stoer_wagner_imgs/digraph1.dot"><img src="stoer_wagner_imgs/digraph1.gif"></a>
|
||||
|
||||
<p>A min-cut is:
|
||||
|
||||
<p><a href="stoer_wagner_imgs/digraph1-min-cut.dot"><img src="stoer_wagner_imgs/digraph1-min-cut.gif"></a>
|
||||
|
||||
<p>where <i>S</i> = {0}, <i>T</i> = {1, 2, 3}, and the min-cut capacity is 1.
|
||||
|
||||
<br>
|
||||
<HR>
|
||||
<TABLE>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
|
||||
@@ -61,8 +61,9 @@ download from here</a>.
|
||||
|
||||
<H2>How to Build the BGL</H2>
|
||||
<p><b>DON'T!</b> The Boost Graph Library is a header-only library and
|
||||
does not need to be built to be used. The only exception is the <a
|
||||
href="read_graphviz.html">GraphViz input parser</a>.</p>
|
||||
does not need to be built to be used. The only exceptions are the <a
|
||||
href="read_graphviz.html">GraphViz input parser</a> and the <a
|
||||
href="read_graphml.html">GraphML parser</a>.</p>
|
||||
|
||||
<p>When compiling programs that use the BGL, <b>be sure to compile
|
||||
with optimization</b>. For instance, select “Release” mode with
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,407 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-15">
|
||||
<TITLE>Boost Graph Library: Boykov-Kolmogorov Maximum Flow</TITLE>
|
||||
<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0 (Linux)">
|
||||
<META NAME="CREATED" CONTENT="20060820;17315200">
|
||||
<META NAME="CHANGEDBY" CONTENT="Stephan Diederich">
|
||||
<META NAME="CHANGED" CONTENT="20060820;23125100">
|
||||
<!--
|
||||
// Copyright (c) 2006, Stephan Diederich
|
||||
//
|
||||
// This documentation may be used under either of the following two licences:
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE. OF SUCH DAMAGE.
|
||||
//
|
||||
// Or:
|
||||
//
|
||||
// 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)
|
||||
-->
|
||||
<STYLE>
|
||||
<!--
|
||||
TD P { color: #000000 }
|
||||
H1 { color: #000000 }
|
||||
P { color: #000000 }
|
||||
PRE { color: #000000 }
|
||||
H3 { color: #000000 }
|
||||
BLOCKQUOTE { color: #000000 }
|
||||
A:link { color: #0000ee }
|
||||
A:visited { color: #551a8b }
|
||||
-->
|
||||
</STYLE>
|
||||
</HEAD>
|
||||
<BODY LANG="de-DE" TEXT="#000000" LINK="#0000ee" VLINK="#551a8b" BGCOLOR="#ffffff" DIR="LTR">
|
||||
|
||||
<P>
|
||||
<IMG SRC="../../../boost.png" NAME="Grafik1" ALT="C++ Boost" ALIGN=BOTTOM WIDTH=277 HEIGHT=86 BORDER=0>
|
||||
</P>
|
||||
|
||||
<table align="center" width="75%" style="border:1px solid; border-spacing: 10pt">
|
||||
<tr>
|
||||
<td style="vertical-align: top"><img src="figs/warning.png"></td>
|
||||
<td>
|
||||
<b>Warning!</b> This header and its contents are <em>deprecated</em> and
|
||||
will be removed in a future release. Please update your program to use
|
||||
<a href="boykov_kolmogorov_max_flow.html"> <tt>boykov_kolmogorov_max_flow</tt></a>
|
||||
instead. Note that only the name of the algorithm has changed. The template
|
||||
and function parameters will remain the same.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<H1><A NAME="sec:kolmogorov_max_flow"></A><TT>kolmogorov_max_flow</TT>
|
||||
</H1>
|
||||
<PRE><I>// named parameter version</I>
|
||||
template <class Graph, class P, class T, class R>
|
||||
typename property_traits<typename property_map<Graph, edge_capacity_t>::const_type>::value_type
|
||||
kolmogorov_max_flow(Graph& g,
|
||||
typename graph_traits<Graph>::vertex_descriptor src,
|
||||
typename graph_traits<Graph>::vertex_descriptor sink,
|
||||
const bgl_named_params<P, T, R>& params = <I>all defaults</I>)
|
||||
|
||||
<I>// non-named parameter version</I>
|
||||
template <class Graph, class CapacityEdgeMap, class ResidualCapacityEdgeMap, class ReverseEdgeMap,
|
||||
class PredecessorMap, class ColorMap, class DistanceMap, class IndexMap>
|
||||
typename property_traits<CapacityEdgeMap>::value_type
|
||||
kolmogorov_max_flow(Graph& g,
|
||||
CapacityEdgeMap cap,
|
||||
ResidualCapacityEdgeMap res_cap,
|
||||
ReverseEdgeMap rev_map,
|
||||
PredecessorMap pre_map,
|
||||
ColorMap color,
|
||||
DistanceMap dist,
|
||||
IndexMap idx,
|
||||
typename graph_traits <Graph>::vertex_descriptor src,
|
||||
typename graph_traits <Graph >::vertex_descriptor sink)</PRE><P>
|
||||
<FONT SIZE=3>Additional overloaded versions for non-named parameters
|
||||
are provided (without DistanceMap/ColorMap/DistanceMap; for those
|
||||
iterator_property_maps with the provided index map are used)</FONT></P>
|
||||
<P>The <TT>kolmogorov_max_flow()</TT> function calculates the 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 calculated
|
||||
maximum flow will be the return value of the function. The function
|
||||
also 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>
|
||||
<P><B>Requirements:</B><BR>The directed graph <I>G=(V,E)</I> that
|
||||
represents the network must include a 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>.
|
||||
</P>
|
||||
<P>Remarks: While the push-relabel method states that each edge in <I>E<SUP>T</SUP></I>
|
||||
has to have capacity of 0, the reverse edges for this algorithm ARE
|
||||
allowed to carry capacities. If there are already reverse edges in
|
||||
the input Graph <I><FONT FACE="Courier New, monospace">G</FONT></I>,
|
||||
those can be used. This can halve the amount of edges and will
|
||||
noticeably increase the performance.<BR><BR><B>Algorithm
|
||||
description:</B><BR>Kolmogorov's algorithm is a variety of the
|
||||
augmenting-path algorithm. Standard augmenting path algorithms find
|
||||
shortest paths from source to sink vertex and augment them by
|
||||
substracting the bottleneck capacity found on that path from the
|
||||
residual capacities of each edge and adding it to the total flow.
|
||||
Additionally the minimum capacity is added to the residual capacity
|
||||
of the reverse edges. If no more paths in the residual-edge tree are
|
||||
found, the algorithm terminates. Instead of finding a new shortest
|
||||
path from source to sink in the graph in each iteration, Kolmogorov's
|
||||
version keeps the already found paths as follows:</P>
|
||||
<P>The algorithm builds up two search trees, a source-tree and a
|
||||
sink-tree. Each vertex has a label (stored in <I>ColorMap</I>) to
|
||||
which tree it belongs and a status-flag if this vertex is active or
|
||||
passive. In the beginning of the algorithm only the source and the
|
||||
sink are colored (source==black, sink==white) and have active status.
|
||||
All other vertices are colored gray. The algorithm consists of three
|
||||
phases:</P>
|
||||
<P><I>grow-phase</I>: In this phase active vertices are allowed to
|
||||
acquire neighbor vertices that are connected through an edge that has
|
||||
a capacity-value greater than zero. Acquiring means that those vertices
|
||||
become active and belong now to the search tree of the current
|
||||
active vertex. If there are no more valid connections to neighbor
|
||||
vertices, the current vertex becomes passive and the grow phase
|
||||
continues with the next active vertex. The grow phase terminates if
|
||||
there are no more active vertices left or a vertex discovers a vertex
|
||||
from the other search tree through an unsaturated edge. In this case
|
||||
a path from source to sink is found.</P>
|
||||
<P><I>augment-phase</I>: This phase augments the path that was found
|
||||
in the grow phase. First it finds the bottleneck capacity of the
|
||||
found path, and then it updates the residual-capacity of the edges
|
||||
from this path by substracting the bottleneck capacity from the
|
||||
residual capacity. Furthermore the residual capacity of the reverse
|
||||
edges are updated by adding the bottleneck capacity. This phase can
|
||||
destroy the built up search trees, as it creates at least one
|
||||
saturated edge. That means, that the search trees collapse to
|
||||
forests, because a condition for the search trees is, that each
|
||||
vertex in them has a valid (=non-saturated) connection to a terminal.</P>
|
||||
<P><I>adoption-phase</I>: Here the search trees are reconstructed. A
|
||||
simple solution would be to mark all vertices coming after the first
|
||||
orphan in the found path free vertices (gray). A more sophisticated
|
||||
solution is to give those orphans new parents: The neighbor vertices
|
||||
are checked if they have a valid connection to the same terminal like
|
||||
this vertex had (a path with unsaturated edges). If there is one,
|
||||
this vertex becomes the new parent of the current orphan and this
|
||||
forest is re-included into the search tree. If no new valid parent is
|
||||
found, this vertex becomes a free vertex (marked gray), and it's
|
||||
children become orphans. The adoption phase terminates if there are
|
||||
no more orphans.</P>
|
||||
<P><IMG SRC="figs/kolmogorov_max_flow.gif" NAME="Grafik2" ALIGN=LEFT WIDTH=827 HEIGHT=311 BORDER=0><BR CLEAR=LEFT><B>Details:</B></P>
|
||||
<UL>
|
||||
<LI><P>Marking heuristics: A timestamp is stored for each vertex
|
||||
which shows in which iteration of the algorithm the distance to the
|
||||
corresponding terminal was calculated.
|
||||
</P>
|
||||
<UL>
|
||||
<LI><P>This distance is used and gets calculated in the
|
||||
adoption-phase. In order to find a valid new parent for an orphan,
|
||||
the possible parent is checked for a connection to the terminal to
|
||||
which tree it belongs. If there is such a connection, the path is
|
||||
tagged with the current time-stamp, and the distance value. If
|
||||
another orphan has to find a parent and it comes across a vertex
|
||||
with a current timestamp, this information is used.</P>
|
||||
<LI><P>The distance is also used in the grow-phase. If a vertex
|
||||
comes across another vertex of the same tree while searching for
|
||||
new vertices, the other's distance is compared to its distance. If
|
||||
it is smaller, that other vertex becomes the new parent of the
|
||||
current. This can decrease the length of the search paths, and so
|
||||
amount of adoptions.</P>
|
||||
</UL>
|
||||
<LI><P>Ordering of orphans: As described above, the augment-phase
|
||||
and the adoption phase can create orphans. The orphans the
|
||||
augment-phase generates, are ordered according to their distance to
|
||||
the terminals (smallest first). This combined with the
|
||||
distance/timestamp heuristics results in the possibility for not
|
||||
having to recheck terminal-connections too often. New orphans which
|
||||
are generated in adoption phase are processed before orphans from
|
||||
the main queue for the same reason.</P>
|
||||
</UL>
|
||||
<P><BR><B>Implementation notes:</B></P>
|
||||
<P>The algorithm is mainly implemented as described in the PhD thesis
|
||||
of Kolmogorov. Few changes were made for increasing performance:</P>
|
||||
<UL>
|
||||
<LI><P>initialization: the algorithm first augments all paths from
|
||||
source->sink and all paths from source->VERTEX->sink. This
|
||||
improves especially graph-cuts used in image vision where nearly
|
||||
each vertex has a source and sink connect. During this step, all
|
||||
vertices that have an unsaturated connection from source are added
|
||||
to the active vertex list and so the source is not.
|
||||
</P>
|
||||
<LI><P>active vertices: Kolmogorov uses two lists for active nodes
|
||||
and states that new active vertices are added to the rear of the
|
||||
second. Fetching an active vertex is done from the beginning of the
|
||||
first list. If the first list is empty, it is exchanged by the
|
||||
second. This implementation uses just one list.</P>
|
||||
<LI><P>grow-phase: In the grow phase the first vertex in the
|
||||
active-list is taken and all outgoing edges are checked if they are
|
||||
unsaturated. This decreases performance for graphs with high-edge
|
||||
density. This implementation stores the last accessed edge and
|
||||
continues with it, if the first vertex in the active-list is the
|
||||
same one as during the last grow-phase.</P>
|
||||
</UL>
|
||||
<P>This algorithm [<A HREF="bibliography.html#kolmogorov03">68</a>, <a href="bibliography.html#boykov-kolmogorov04">69</a>] was developed by Boykov and Kolmogorov.
|
||||
</P>
|
||||
<H3>Where Defined</H3>
|
||||
<P><TT><A HREF="../../../boost/graph/kolmogorov_max_flow.hpp">boost/graph/kolmogorov_max_flow.hpp</A></TT>
|
||||
</P>
|
||||
<H3>Parameters</H3>
|
||||
<P>IN: <TT>Graph& g</TT>
|
||||
</P>
|
||||
<BLOCKQUOTE>A directed graph. The graph's type must be a model of
|
||||
<A HREF="VertexListGraph.html">Vertex List Graph</A>, <A HREF="EdgeListGraph.html">Edge
|
||||
List Graph</A> and <A HREF="IncidenceGraph.html">Incidence Graph</A>.
|
||||
For each edge <I>(u,v)</I> in the graph, the reverse edge <I>(v,u)</I>
|
||||
must also be in the graph. Performance of the algorithm will be slightly
|
||||
improved if the graph type also models <a href="AdjacencyMatrix.html">Adjacency
|
||||
Matrix</a>.
|
||||
</BLOCKQUOTE>
|
||||
<P>IN: <TT>vertex_descriptor src</TT>
|
||||
</P>
|
||||
<BLOCKQUOTE>The source vertex for the flow network graph.
|
||||
</BLOCKQUOTE>
|
||||
<P>IN: <TT>vertex_descriptor sink</TT>
|
||||
</P>
|
||||
<BLOCKQUOTE>The sink vertex for the flow network graph.
|
||||
</BLOCKQUOTE>
|
||||
<H3>Named Parameters</H3>
|
||||
<P>IN: <TT>edge_capacity(EdgeCapacityMap cap)</TT>
|
||||
</P>
|
||||
<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>
|
||||
<P>OUT: <TT>edge_residual_capacity(ResidualCapacityEdgeMap res)</TT>
|
||||
</P>
|
||||
<BLOCKQUOTE>The edge residual capacity property map. 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>
|
||||
<P>IN: <TT>edge_reverse(ReverseEdgeMap rev)</TT>
|
||||
</P>
|
||||
<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>
|
||||
<P>UTIL: <TT>vertex_predecessor(PredecessorMap pre_map)</TT>
|
||||
</P>
|
||||
<BLOCKQUOTE>A vertex property map that stores the edge to the vertex'
|
||||
predecessor. The map must be a model of mutable <A HREF="../../property_map/doc/LvaluePropertyMap.html">Lvalue
|
||||
Property Map</A>. The key type of the map must be the graph's vertex
|
||||
descriptor type.<BR><B>Default:</B> <TT>get(vertex_predecessor, g)</TT>
|
||||
</BLOCKQUOTE>
|
||||
<P>OUT/UTIL: <TT>vertex_color(ColorMap color)</TT>
|
||||
</P>
|
||||
<BLOCKQUOTE>A vertex property map that stores a color for edge
|
||||
vertex. If the color of a vertex after running the algorithm is black
|
||||
the vertex belongs to the source tree else it belongs to the
|
||||
sink-tree (used for minimum cuts). The map must be a model of mutable
|
||||
<A HREF="../../property_map/doc/LvaluePropertyMap.html">Lvalue Property
|
||||
Map</A>. The key type of the map must be the graph's vertex
|
||||
descriptor type.<BR><B>Default:</B> <TT>get(vertex_color, g)</TT>
|
||||
</BLOCKQUOTE>
|
||||
<P>UTIL: <TT>vertex_distance(DistanceMap dist)</TT>
|
||||
</P>
|
||||
<BLOCKQUOTE>A vertex property map that stores the distance to the
|
||||
corresponding terminal. It's a utility-map for speeding up the
|
||||
algorithm. The map must be a model of mutable <A HREF="../../property_map/doc/LvaluePropertyMap.html">Lvalue
|
||||
Property Map</A>. The key type of the map must be the graph's vertex
|
||||
descriptor type.<BR><B>Default:</B> <TT>get(vertex_distance, g)</TT>
|
||||
</BLOCKQUOTE>
|
||||
<P>IN: <TT>vertex_index(VertexIndexMap index_map)</TT>
|
||||
</P>
|
||||
<BLOCKQUOTE>Maps each vertex of the graph to a unique integer in the
|
||||
range <TT>[0, num_vertices(g))</TT>. The map must be a model of
|
||||
constant <A HREF="../../property_map/doc/LvaluePropertyMap.html">LvaluePropertyMap</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>
|
||||
</BLOCKQUOTE>
|
||||
<H3>Example</H3>
|
||||
<P>This reads an example maximum flow problem (a graph with edge
|
||||
capacities) from a file in the DIMACS format (<TT><A HREF="../example/max_flow.dat">example/max_flow.dat</A></TT>).
|
||||
The source for this example can be found in
|
||||
<TT><A HREF="../example/boykov_kolmogorov-eg.cpp">example/boykov_kolmogorov-eg.cpp</A></TT>.
|
||||
</P>
|
||||
<PRE>#include <boost/config.hpp>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <boost/graph/kolmogorov_max_flow.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/read_dimacs.hpp>
|
||||
#include <boost/graph/graph_utility.hpp>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
typedef adjacency_list_traits < vecS, vecS, directedS > Traits;
|
||||
typedef adjacency_list < vecS, vecS, directedS,
|
||||
property < vertex_name_t, std::string,
|
||||
property < vertex_index_t, long,
|
||||
property < vertex_color_t, boost::default_color_type,
|
||||
property < vertex_distance_t, long,
|
||||
property < vertex_predecessor_t, Traits::edge_descriptor > > > > >,
|
||||
|
||||
property < edge_capacity_t, long,
|
||||
property < edge_residual_capacity_t, long,
|
||||
property < edge_reverse_t, Traits::edge_descriptor > > > > Graph;
|
||||
|
||||
Graph g;
|
||||
property_map < Graph, edge_capacity_t >::type
|
||||
capacity = get(edge_capacity, g);
|
||||
property_map < Graph, edge_residual_capacity_t >::type
|
||||
residual_capacity = get(edge_residual_capacity, g);
|
||||
property_map < Graph, edge_reverse_t >::type rev = get(edge_reverse, g);
|
||||
Traits::vertex_descriptor s, t;
|
||||
read_dimacs_max_flow(g, capacity, rev, s, t);
|
||||
|
||||
std::vector<default_color_type> color(num_vertices(g));
|
||||
std::vector<long> distance(num_vertices(g));
|
||||
long flow = kolmogorov_max_flow(g ,s, t);
|
||||
|
||||
std::cout << "c The total flow:" << std::endl;
|
||||
std::cout << "s " << flow << std::endl << std::endl;
|
||||
|
||||
std::cout << "c 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)
|
||||
if (capacity[*ei] > 0)
|
||||
std::cout << "f " << *u_iter << " " << target(*ei, g) << " "
|
||||
<< (capacity[*ei] - residual_capacity[*ei]) << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}</PRE><P>
|
||||
The output is:
|
||||
</P>
|
||||
<PRE>c The total flow:
|
||||
s 13
|
||||
|
||||
c flow values:
|
||||
f 0 6 3
|
||||
f 0 1 0
|
||||
f 0 2 10
|
||||
f 1 5 1
|
||||
f 1 0 0
|
||||
f 1 3 0
|
||||
f 2 4 4
|
||||
f 2 3 6
|
||||
f 2 0 0
|
||||
f 3 7 5
|
||||
f 3 2 0
|
||||
f 3 1 1
|
||||
f 4 5 4
|
||||
f 4 6 0
|
||||
f 5 4 0
|
||||
f 5 7 5
|
||||
f 6 7 3
|
||||
f 6 4 0
|
||||
f 7 6 0
|
||||
f 7 5 0</PRE><H3>
|
||||
See Also</H3>
|
||||
<P STYLE="margin-bottom: 0cm"><TT><A HREF="edmonds_karp_max_flow.html">edmonds_karp_max_flow()</A></TT>,<BR><TT><A HREF="push_relabel_max_flow.html">push_relabel_max_flow()</A></TT>.
|
||||
</P>
|
||||
<HR>
|
||||
<TABLE CELLPADDING=2 CELLSPACING=2>
|
||||
<TR VALIGN=TOP>
|
||||
<TD>
|
||||
<P>Copyright © 2006</P>
|
||||
</TD>
|
||||
<TD>
|
||||
<P>Stephan Diederich, University
|
||||
Mannheim(<A HREF="mailto:diederich@ti.uni-manheim.de">diederich@ti.uni-manheim.de</A>)</P>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<P><BR><BR>
|
||||
</P>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -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.
|
||||
@@ -197,17 +200,15 @@ IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
|
||||
|
||||
UTIL/OUT: <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
|
||||
The weight of the spanning tree edge into each
|
||||
vertex in the graph <tt>g</tt> is recorded in this property map, with edges
|
||||
directed away from the spanning tree root.
|
||||
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>
|
||||
|
||||
@@ -446,11 +446,11 @@ A container for storing the Pareto-optimal resource containers in the overloads
|
||||
OUT: <tt>std::vector<typename graph_traits<Graph>::edge_descriptor>&
|
||||
pareto_optimal_solution</tt>
|
||||
<blockquote>
|
||||
A container for storing the first Pareto-optimal (undominated) solution (<i>s</i>-<i>t</i>-path) in the overloads where only one Pareto-optimal solution is returned. The path is returned as a sequence of edge descriptors in reverse order (from <tt>t</tt> to <tt>s</tt>).
|
||||
A container for storing the first Pareto-optimal (undominated) solution (<i>s</i>-<i>t</i>-path) in the overloads where only one Pareto-optimal solution is returned. The path is returned as a sequence of edge descriptors in reverse order (from <tt>t</tt> to <tt>s</tt>). This argument is not modified if there are no solutions.
|
||||
</blockquote>
|
||||
OUT: <tt>Resource_Container& pareto_optimal_resource_container</tt>
|
||||
<blockquote>
|
||||
A <tt>Resource_Container</tt> object for storing the Pareto-optimal resource container corresponding to the first Pareto-optimal path in the overloads where only one Pareto-optimal solution is returned.
|
||||
A <tt>Resource_Container</tt> object for storing the Pareto-optimal resource container corresponding to the first Pareto-optimal path in the overloads where only one Pareto-optimal solution is returned. This argument is not modified if there are no solutions.
|
||||
</blockquote>
|
||||
IN: <tt>const Resource_Container& rc</tt>
|
||||
<blockquote>
|
||||
@@ -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>
|
||||
|
||||
@@ -76,7 +76,7 @@ IN: <tt>Gen& gen</tt>
|
||||
<blockquote>
|
||||
A random number generator. The generator type must
|
||||
be a model of <a
|
||||
href="../../random/doc/reference.html#boost_random.reference.concepts.uniform_random_number_generator">Uniform
|
||||
href="../../../doc/html/boost_random/reference.html#boost_random.reference.concepts.uniform_random_number_generator">Uniform
|
||||
Random Number Generator</a> or a pointer or reference to such a type.<br>
|
||||
</blockquote>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<HTML>
|
||||
<!--
|
||||
// Copyright (c) 2006, Stephan Diederich
|
||||
// Copyright (c) 2010, Trustees of Indiana University
|
||||
//
|
||||
// This code may be used under either of the following two licences:
|
||||
//
|
||||
@@ -32,7 +33,7 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
-->
|
||||
<Head>
|
||||
<Title>Boost Graph Library: read_dimacs_max_flow</Title>
|
||||
<Title>Boost Graph Library: read_dimacs_max_flow and read_dimacs_min_cut</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
@@ -47,18 +48,27 @@
|
||||
<pre>
|
||||
//reads a graph with attached edge_capacity properties from an std::istream
|
||||
template <class Graph, class CapacityMap, class ReverseEdgeMap>
|
||||
int read_dimacs_max_flow(Graph& g,
|
||||
int read_dimacs_max_flow(Graph& g,
|
||||
CapacityMap capacity,
|
||||
ReverseEdgeMap reverse_edge,
|
||||
typename graph_traits<Graph>::vertex_descriptor& src,
|
||||
typename graph_traits<Graph>::vertex_descriptor& sink,
|
||||
std::istream& in=std::cin)
|
||||
typename graph_traits<Graph>::vertex_descriptor& src,
|
||||
typename graph_traits<Graph>::vertex_descriptor& sink,
|
||||
std::istream& in=std::cin)
|
||||
|
||||
//reads a graph with attached edge_capacity properties from an std::istream
|
||||
template <class Graph, class CapacityMap, class ReverseEdgeMap>
|
||||
int read_dimacs_min_cut(Graph& g,
|
||||
CapacityMap capacity,
|
||||
ReverseEdgeMap reverse_edge,
|
||||
std::istream& in=std::cin)
|
||||
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This method reads a BGL graph object from a max-flow problem description in extended dimacs format. (see <a href="http://www.avglab.com/andrew/CATS/maxflow_formats.htm"><TT>Goldbergs site</TT></a> for more information). For each edge found in the
|
||||
file an additional reverse_edge is added and set in the reverse_edge map. Source- and sink-vertex-descriptors are set according to the dimacs file.
|
||||
These functions read a BGL graph object from a max-flow or min-cut problem description in extended dimacs format. (see <a href="http://www.avglab.com/andrew/CATS/maxflow_formats.htm"><TT>Goldberg's site</TT></a> for more information). For each edge found in the
|
||||
file an additional reverse_edge is added and set in the reverse_edge map. For
|
||||
max-flow problems, source and sink vertex descriptors are set according to the
|
||||
dimacs file.
|
||||
|
||||
<H3>Where Defined</H3>
|
||||
|
||||
@@ -81,6 +91,16 @@ file an additional reverse_edge is added and set in the reverse_edge map. Source
|
||||
A property map that models <a href="../../property_map/doc/LvaluePropertyMap.html">mutable Lvalue Property Map</a> whose key and value type is the edge descriptor of the graph. This map stores the corresponding reverse edge for each each in Graph g.<br>
|
||||
</blockquote>
|
||||
|
||||
OUT: <tt>vertex_descriptor& src</tt>
|
||||
<blockquote>
|
||||
A graph vertex that will be set to the source of a max-flow problem.
|
||||
</blockquote>
|
||||
|
||||
OUT: <tt>vertex_descriptor& sink</tt>
|
||||
<blockquote>
|
||||
A graph vertex that will be set to the sink of a max-flow problem.
|
||||
</blockquote>
|
||||
|
||||
IN: <tt>std::istream& in</tt>
|
||||
<blockquote>
|
||||
A standard <tt>std::istream</tt> object. <br>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||