Changes in / [547:17cabb114d52:1106:7c4ba7daaf5f] in lemon
- Files:
-
- 51 added
- 14 deleted
- 100 edited
Legend:
- Unmodified
- Added
- Removed
-
.hgignore
r479 r610 23 23 lemon/stamp-h2 24 24 doc/Doxyfile 25 cmake/version.cmake 25 26 .dirstamp 26 27 .libs/* … … 40 41 ^autom4te.cache/.* 41 42 ^build-aux/.* 42 ^ objs.*/.*43 ^.*objs.*/.* 43 44 ^test/[a-z_]*$ 44 45 ^tools/[a-z-_]*$ 45 46 ^demo/.*_demo$ 46 ^ build/.*47 ^.*build.*/.* 47 48 ^doc/gen-images/.* 48 49 CMakeFiles -
AUTHORS
r320 r1072 24 24 25 25 Again, please visit the history of the old LEMON repository for more 26 details: http://lemon.cs.elte.hu/ svn/lemon/trunk26 details: http://lemon.cs.elte.hu/hg/lemon-0.x -
CMakeLists.txt
r274 r1053 2 2 3 3 SET(PROJECT_NAME "LEMON") 4 SET(PROJECT_VERSION "hg-tip" CACHE STRING "The version string.")5 6 4 PROJECT(${PROJECT_NAME}) 7 5 8 SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) 9 10 INCLUDE(FindDoxygen) 11 INCLUDE(FindGhostscript) 6 INCLUDE(FindPythonInterp) 7 INCLUDE(FindWget) 8 9 IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake) 10 INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake) 11 ELSEIF(DEFINED ENV{LEMON_VERSION}) 12 SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.") 13 ELSE() 14 EXECUTE_PROCESS( 15 COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py 16 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 17 OUTPUT_VARIABLE HG_REVISION_PATH 18 ERROR_QUIET 19 OUTPUT_STRIP_TRAILING_WHITESPACE 20 ) 21 EXECUTE_PROCESS( 22 COMMAND hg id -i 23 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 24 OUTPUT_VARIABLE HG_REVISION 25 ERROR_QUIET 26 OUTPUT_STRIP_TRAILING_WHITESPACE 27 ) 28 IF(HG_REVISION STREQUAL "") 29 SET(HG_REVISION_ID "hg-tip") 30 ELSE() 31 IF(HG_REVISION_PATH STREQUAL "") 32 SET(HG_REVISION_ID ${HG_REVISION}) 33 ELSE() 34 SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION}) 35 ENDIF() 36 ENDIF() 37 SET(LEMON_VERSION ${HG_REVISION_ID} CACHE STRING "LEMON version string.") 38 ENDIF() 39 40 SET(PROJECT_VERSION ${LEMON_VERSION}) 41 42 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) 43 44 FIND_PACKAGE(Doxygen) 45 FIND_PACKAGE(Ghostscript) 46 FIND_PACKAGE(GLPK 4.33) 47 FIND_PACKAGE(CPLEX) 48 FIND_PACKAGE(COIN) 49 50 IF(DEFINED ENV{LEMON_CXX_WARNING}) 51 SET(CXX_WARNING $ENV{LEMON_CXX_WARNING}) 52 ELSE() 53 IF(CMAKE_COMPILER_IS_GNUCXX) 54 SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas") 55 SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb") 56 SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb") 57 ELSEIF(MSVC) 58 # This part is unnecessary 'casue the same is set by the lemon/core.h. 59 # Still keep it as an example. 60 SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996") 61 # Suppressed warnings: 62 # C4250: 'class1' : inherits 'class2::member' via dominance 63 # C4355: 'this' : used in base member initializer list 64 # C4503: 'function' : decorated name length exceeded, name was truncated 65 # C4800: 'type' : forcing value to bool 'true' or 'false' 66 # (performance warning) 67 # C4996: 'function': was declared deprecated 68 ELSE() 69 SET(CXX_WARNING "-Wall -W") 70 ENDIF() 71 ENDIF() 72 SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.") 73 74 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}") 75 76 SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb" CACHE STRING 77 "Flags used by the C++ compiler during maintainer builds." 78 FORCE ) 79 SET( CMAKE_C_FLAGS_MAINTAINER "-Werror" CACHE STRING 80 "Flags used by the C compiler during maintainer builds." 81 FORCE ) 82 SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER 83 "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING 84 "Flags used for linking binaries during maintainer builds." 85 FORCE ) 86 SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER 87 "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING 88 "Flags used by the shared libraries linker during maintainer builds." 89 FORCE ) 90 MARK_AS_ADVANCED( 91 CMAKE_CXX_FLAGS_MAINTAINER 92 CMAKE_C_FLAGS_MAINTAINER 93 CMAKE_EXE_LINKER_FLAGS_MAINTAINER 94 CMAKE_SHARED_LINKER_FLAGS_MAINTAINER ) 95 96 IF(CMAKE_CONFIGURATION_TYPES) 97 LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer) 98 LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES) 99 SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING 100 "Add the configurations that we need" 101 FORCE) 102 endif() 103 104 IF(NOT CMAKE_BUILD_TYPE) 105 SET(CMAKE_BUILD_TYPE "Release") 106 ENDIF() 107 108 SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING 109 "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer." 110 FORCE ) 111 112 113 INCLUDE(CheckTypeSize) 114 CHECK_TYPE_SIZE("long long" LONG_LONG) 115 SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG}) 12 116 13 117 ENABLE_TESTING() 14 118 119 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") 120 ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND}) 121 ELSE() 122 ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) 123 ENDIF() 124 15 125 ADD_SUBDIRECTORY(lemon) 16 ADD_SUBDIRECTORY(demo) 17 ADD_SUBDIRECTORY(doc) 18 ADD_SUBDIRECTORY(test) 19 20 IF(WIN32) 21 INSTALL(FILES ${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico 22 DESTINATION bin) 23 ENDIF(WIN32) 24 25 IF(WIN32) 126 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) 127 ADD_SUBDIRECTORY(demo) 128 ADD_SUBDIRECTORY(tools) 129 ADD_SUBDIRECTORY(doc) 130 ADD_SUBDIRECTORY(test) 131 ENDIF() 132 133 CONFIGURE_FILE( 134 ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in 135 ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake 136 @ONLY 137 ) 138 IF(UNIX) 139 INSTALL( 140 FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake 141 DESTINATION share/lemon/cmake 142 ) 143 ELSEIF(WIN32) 144 INSTALL( 145 FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake 146 DESTINATION cmake 147 ) 148 ENDIF() 149 150 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) 26 151 SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) 27 SET(CPACK_PACKAGE_VENDOR 28 "EGRES - Egervary Research Group on Combinatorial Optimization") 152 SET(CPACK_PACKAGE_VENDOR "EGRES") 29 153 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY 30 "LEMON - Library of Efficient Modelsand Optimization in Networks")31 SET(CPACK_RESOURCE_FILE_LICENSE "${ CMAKE_SOURCE_DIR}/LICENSE")154 "LEMON - Library for Efficient Modeling and Optimization in Networks") 155 SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") 32 156 33 157 SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) … … 38 162 "${PROJECT_NAME} ${PROJECT_VERSION}") 39 163 40 # Variables to generate a component-based installer. 41 #SET(CPACK_COMPONENTS_ALL headers library html_documentation) 42 43 #SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") 44 #SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Static library") 45 #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") 46 47 #SET(CPACK_COMPONENT_HEADERS_DESCRIPTION 48 # "C++ header files for use with the LEMON library") 49 #SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION 50 # "Static library used to build programs with LEMON") 51 #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION 52 # "Doxygen generated documentation") 53 54 #SET(CPACK_COMPONENT_HEADERS_DEPENDS library) 55 56 #SET(CPACK_COMPONENT_HEADERS_GROUP "Development") 57 #SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") 58 #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") 59 60 #SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION 61 # "Components needed to develop software using LEMON") 62 #SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION 63 # "Documentation of LEMON") 64 65 #SET(CPACK_ALL_INSTALL_TYPES Full Developer) 66 67 #SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) 68 #SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) 69 #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) 164 SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) 165 166 SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") 167 SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") 168 SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") 169 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") 170 171 SET(CPACK_COMPONENT_HEADERS_DESCRIPTION 172 "C++ header files") 173 SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION 174 "DLL and import library") 175 SET(CPACK_COMPONENT_BIN_DESCRIPTION 176 "Command line utilities") 177 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION 178 "Doxygen generated documentation") 179 180 SET(CPACK_COMPONENT_HEADERS_DEPENDS library) 181 182 SET(CPACK_COMPONENT_HEADERS_GROUP "Development") 183 SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") 184 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") 185 186 SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION 187 "Components needed to develop software using LEMON") 188 SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION 189 "Documentation of LEMON") 190 191 SET(CPACK_ALL_INSTALL_TYPES Full Developer) 192 193 SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) 194 SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) 195 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) 70 196 71 197 SET(CPACK_GENERATOR "NSIS") 72 SET(CPACK_NSIS_MUI_ICON "${ CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico")73 SET(CPACK_NSIS_MUI_UNIICON "${ CMAKE_SOURCE_DIR}/cmake/nsis/uninstall.ico")74 #SET(CPACK_PACKAGE_ICON "${ CMAKE_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")198 SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") 199 SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") 200 #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") 75 201 SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") 76 202 SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") … … 79 205 SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") 80 206 SET(CPACK_NSIS_CREATE_ICONS_EXTRA " 81 CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\ doc\\\\index.html\\\"207 CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" 82 208 ") 83 209 SET(CPACK_NSIS_DELETE_ICONS_EXTRA " … … 87 213 88 214 INCLUDE(CPack) 89 ENDIF( WIN32)215 ENDIF() -
INSTALL
r318 r615 5 5 tarballs and successfully extracted it. The latest version of LEMON is 6 6 available at our web page (http://lemon.cs.elte.hu/). 7 8 LEMON provides two different build environments, one is based on "autotool", 9 while the other is based on "cmake". This file contains instructions only for 10 the former one, which is the recommended build environment on Linux, Mac OSX 11 and other unices or if you use Cygwin on Windows. For cmake installation 12 instructions visit http://lemon.cs.elte.hu. 7 13 8 14 In order to install LEMON from the extracted source tarball you have to … … 22 28 23 29 This command compiles the non-template part of LEMON into libemon.a 24 file. It also compiles the programs in the tools and demo subdirectories25 when enabled.30 file. It also compiles the programs in the tools subdirectory by 31 default. 26 32 27 33 4. `make check' … … 69 75 70 76 Set the installation prefix to PREFIX. By default it is /usr/local. 71 72 --enable-demo73 74 Build the examples in the demo subdirectory.75 76 --disable-demo77 78 Do not build the examples in the demo subdirectory (default).79 77 80 78 --enable-tools … … 153 151 154 152 Disable SoPlex support. 153 154 --with-coin[=PREFIX] 155 156 Enable support for COIN-OR solvers (CLP and CBC). You should 157 specify the prefix too. (by default, COIN-OR tools install 158 themselves to the source code directory). This command enables the 159 solvers that are actually found. 160 161 --with-coin-includedir=DIR 162 163 The directory where the COIN-OR header files are located. This is 164 only useful when the COIN-OR headers and libraries are not under 165 the same prefix (which is unlikely). 166 167 --with-coin-libdir=DIR 168 169 The directory where the COIN-OR libraries are located. This is only 170 useful when the COIN-OR headers and libraries are not under the 171 same prefix (which is unlikely). 172 173 --without-coin 174 175 Disable COIN-OR support. -
LICENSE
r463 r600 1 LEMON code without an explicit copyright is covered by the following1 LEMON code without an explicit copyright notice is covered by the following 2 2 copyright/license. 3 3 … … 5 5 Kutatocsoport (Egervary Combinatorial Optimization Research Group, 6 6 EGRES). 7 8 =========================================================================== 9 Boost Software License, Version 1.0 10 =========================================================================== 7 11 8 12 Permission is hereby granted, free of charge, to any person or organization … … 27 31 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 32 DEALINGS IN THE SOFTWARE. 29 30 ===========================================================================31 This license is a verbatim copy of the Boost Software License, Version 1.0.32 33 -
Makefile.am
r375 r799 12 12 m4/lx_check_glpk.m4 \ 13 13 m4/lx_check_soplex.m4 \ 14 m4/lx_check_coin.m4 \ 14 15 CMakeLists.txt \ 15 cmake 16 cmake/FindGhostscript.cmake \ 17 cmake/FindCPLEX.cmake \ 18 cmake/FindGLPK.cmake \ 19 cmake/FindCOIN.cmake \ 20 cmake/LEMONConfig.cmake.in \ 21 cmake/version.cmake.in \ 22 cmake/version.cmake \ 23 cmake/nsis/lemon.ico \ 24 cmake/nsis/uninstall.ico 16 25 17 26 pkgconfigdir = $(libdir)/pkgconfig … … 35 44 include test/Makefile.am 36 45 include doc/Makefile.am 37 include demo/Makefile.am38 46 include tools/Makefile.am 47 48 DIST_SUBDIRS = demo 49 50 demo: 51 $(MAKE) $(AM_MAKEFLAGS) -C demo 39 52 40 53 MRPROPERFILES = \ … … 64 77 bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2 65 78 66 .PHONY: mrproper dist-bz2 distcheck-bz279 .PHONY: demo mrproper dist-bz2 distcheck-bz2 -
NEWS
r322 r712 1 2009-05-13 Version 1.1 released 2 3 This is the second stable release of the 1.x series. It 4 features a better coverage of the tools available in the 0.x 5 series, a thoroughly reworked LP/MIP interface plus various 6 improvements in the existing tools. 7 8 * Much improved M$ Windows support 9 * Various improvements in the CMAKE build system 10 * Compilation warnings are fixed/suppressed 11 * Support IBM xlC compiler 12 * New algorithms 13 * Connectivity related algorithms (#61) 14 * Euler walks (#65) 15 * Preflow push-relabel max. flow algorithm (#176) 16 * Circulation algorithm (push-relabel based) (#175) 17 * Suurballe algorithm (#47) 18 * Gomory-Hu algorithm (#66) 19 * Hao-Orlin algorithm (#58) 20 * Edmond's maximum cardinality and weighted matching algorithms 21 in general graphs (#48,#265) 22 * Minimum cost arborescence/branching (#60) 23 * Network Simplex min. cost flow algorithm (#234) 24 * New data structures 25 * Full graph structure (#57) 26 * Grid graph structure (#57) 27 * Hypercube graph structure (#57) 28 * Graph adaptors (#67) 29 * ArcSet and EdgeSet classes (#67) 30 * Elevator class (#174) 31 * Other new tools 32 * LP/MIP interface (#44) 33 * Support for GLPK, CPLEX, Soplex, COIN-OR CLP and CBC 34 * Reader for the Nauty file format (#55) 35 * DIMACS readers (#167) 36 * Radix sort algorithms (#72) 37 * RangeIdMap and CrossRefMap (#160) 38 * New command line tools 39 * DIMACS to LGF converter (#182) 40 * lgf-gen - a graph generator (#45) 41 * DIMACS solver utility (#226) 42 * Other code improvements 43 * Lognormal distribution added to Random (#102) 44 * Better (i.e. O(1) time) item counting in SmartGraph (#3) 45 * The standard maps of graphs are guaranteed to be 46 reference maps (#190) 47 * Miscellaneous 48 * Various doc improvements 49 * Improved 0.x -> 1.x converter script 50 51 * Several bugfixes (compared to release 1.0): 52 #170: Bugfix SmartDigraph::split() 53 #171: Bugfix in SmartGraph::restoreSnapshot() 54 #172: Extended test cases for graphs and digraphs 55 #173: Bugfix in Random 56 * operator()s always return a double now 57 * the faulty real<Num>(Num) and real<Num>(Num,Num) 58 have been removed 59 #187: Remove DijkstraWidestPathOperationTraits 60 #61: Bugfix in DfsVisit 61 #193: Bugfix in GraphReader::skipSection() 62 #195: Bugfix in ConEdgeIt() 63 #197: Bugfix in heap unionfind 64 * This bug affects Edmond's general matching algorithms 65 #207: Fix 'make install' without 'make html' using CMAKE 66 #208: Suppress or fix VS2008 compilation warnings 67 ----: Update the LEMON icon 68 ----: Enable the component-based installer 69 (in installers made by CPACK) 70 ----: Set the proper version for CMAKE in the tarballs 71 (made by autotools) 72 ----: Minor clarification in the LICENSE file 73 ----: Add missing unistd.h include to time_measure.h 74 #204: Compilation bug fixed in graph_to_eps.h with VS2005 75 #214,#215: windows.h should never be included by lemon headers 76 #230: Build systems check the availability of 'long long' type 77 #229: Default implementation of Tolerance<> is used for integer types 78 #211,#212: Various fixes for compiling on AIX 79 ----: Improvements in CMAKE config 80 - docs is installed in share/doc/ 81 - detects newer versions of Ghostscript 82 #239: Fix missing 'inline' specifier in time_measure.h 83 #274,#280: Install lemon/config.h 84 #275: Prefix macro names with LEMON_ in lemon/config.h 85 ----: Small script for making the release tarballs added 86 ----: Minor improvement in unify-sources.sh (a76f55d7d397) 87 88 2009-03-27 LEMON joins to the COIN-OR initiative 89 90 COIN-OR (Computational Infrastructure for Operations Research, 91 http://www.coin-or.org) project is an initiative to spur the 92 development of open-source software for the operations research 93 community. 94 1 95 2008-10-13 Version 1.0 released 2 96 -
README
r318 r705 1 ================================================================== 2 LEMON - a Library of Efficient Modelsand Optimization in Networks3 ================================================================== 1 ===================================================================== 2 LEMON - a Library for Efficient Modeling and Optimization in Networks 3 ===================================================================== 4 4 5 5 LEMON is an open source library written in C++. It provides -
cmake/FindGhostscript.cmake
r225 r520 4 4 NAMES gs gswin32c 5 5 PATHS "$ENV{ProgramFiles}/gs" 6 PATH_SUFFIXES gs8.61/bin gs8.62/bin 6 PATH_SUFFIXES gs8.61/bin gs8.62/bin gs8.63/bin gs8.64/bin gs8.65/bin 7 7 DOC "Ghostscript: PostScript and PDF language interpreter and previewer." 8 8 ) -
configure.ac
r482 r1037 3 3 dnl Version information. 4 4 m4_define([lemon_version_number], 5 5 [m4_normalize(esyscmd([echo ${LEMON_VERSION}]))]) 6 6 dnl m4_define([lemon_version_number], []) 7 7 m4_define([lemon_hg_path], [m4_normalize(esyscmd([./scripts/chg-len.py]))]) 8 m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i ]))])8 m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i 2> /dev/null]))]) 9 9 m4_define([lemon_version], [ifelse(lemon_version_number(), 10 [], 11 [lemon_hg_path().lemon_hg_revision()], 12 [lemon_version_number()])]) 10 [], 11 [ifelse(lemon_hg_revision(), 12 [], 13 [hg-tip], 14 [lemon_hg_path().lemon_hg_revision()])], 15 [lemon_version_number()])]) 13 16 14 17 AC_PREREQ([2.59]) … … 20 23 AC_CONFIG_HEADERS([config.h lemon/config.h]) 21 24 25 AC_DEFINE([LEMON_VERSION], [lemon_version()], [The version string]) 26 22 27 dnl Do compilation tests using the C++ compiler. 23 28 AC_LANG([C++]) 29 30 dnl Check the existence of long long type. 31 AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no]) 32 if test x"$long_long_found" = x"yes"; then 33 AC_DEFINE([LEMON_HAVE_LONG_LONG], [1], [Define to 1 if you have long long.]) 34 fi 24 35 25 36 dnl Checks for programs. … … 54 65 LX_CHECK_CPLEX 55 66 LX_CHECK_SOPLEX 56 LX_CHECK_C LP67 LX_CHECK_COIN 57 68 58 69 AM_CONDITIONAL([HAVE_LP], [test x"$lx_lp_found" = x"yes"]) 59 70 AM_CONDITIONAL([HAVE_MIP], [test x"$lx_mip_found" = x"yes"]) 60 61 dnl Disable/enable building the demo programs.62 AC_ARG_ENABLE([demo],63 AS_HELP_STRING([--enable-demo], [build the demo programs])64 AS_HELP_STRING([--disable-demo], [do not build the demo programs @<:@default@:>@]),65 [], [enable_demo=no])66 AC_MSG_CHECKING([whether to build the demo programs])67 if test x"$enable_demo" != x"no"; then68 AC_MSG_RESULT([yes])69 else70 AC_MSG_RESULT([no])71 fi72 AM_CONDITIONAL([WANT_DEMO], [test x"$enable_demo" != x"no"])73 71 74 72 dnl Disable/enable building the binary tools. … … 101 99 dnl Add dependencies on files generated by configure. 102 100 AC_SUBST([CONFIG_STATUS_DEPENDENCIES], 103 ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/ lemon/lemon.pc.in'])101 ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/doc/mainpage.dox.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in']) 104 102 105 103 AC_CONFIG_FILES([ 106 104 Makefile 105 demo/Makefile 106 cmake/version.cmake 107 107 doc/Doxyfile 108 doc/mainpage.dox 108 109 lemon/lemon.pc 109 110 ]) … … 119 120 echo C++ compiles flags............ : $WARNINGCXXFLAGS $CXXFLAGS 120 121 echo 122 echo Compiler supports long long... : $long_long_found 123 echo 121 124 echo GLPK support.................. : $lx_glpk_found 122 125 echo CPLEX support................. : $lx_cplex_found 123 126 echo SOPLEX support................ : $lx_soplex_found 124 127 echo CLP support................... : $lx_clp_found 128 echo CBC support................... : $lx_cbc_found 125 129 echo 126 echo Build demo programs........... : $enable_demo127 130 echo Build additional tools........ : $enable_tools 128 131 echo -
demo/CMakeLists.txt
r225 r726 1 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) 1 INCLUDE_DIRECTORIES( 2 ${PROJECT_SOURCE_DIR} 3 ${PROJECT_BINARY_DIR} 4 ) 2 5 3 LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon) 6 LINK_DIRECTORIES( 7 ${PROJECT_BINARY_DIR}/lemon 8 ) 4 9 5 10 SET(DEMOS 6 11 arg_parser_demo 7 12 graph_to_eps_demo 8 lgf_demo) 13 lgf_demo 14 ) 9 15 10 16 FOREACH(DEMO_NAME ${DEMOS}) 11 17 ADD_EXECUTABLE(${DEMO_NAME} ${DEMO_NAME}.cc) 12 18 TARGET_LINK_LIBRARIES(${DEMO_NAME} lemon) 13 ENDFOREACH( DEMO_NAME)19 ENDFOREACH() -
demo/Makefile.am
r415 r611 1 EXTRA_DIST += \ 2 demo/CMakeLists.txt \ 3 demo/digraph.lgf 1 AM_CXXFLAGS = $(WARNINGCXXFLAGS) 4 2 5 if WANT_DEMO 3 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir) 4 LDADD = $(top_builddir)/lemon/libemon.la 6 5 7 noinst_PROGRAMS += \ 8 demo/arg_parser_demo \ 9 demo/graph_to_eps_demo \ 10 demo/lgf_demo 6 EXTRA_DIST = \ 7 CMakeLists.txt \ 8 digraph.lgf 11 9 12 endif WANT_DEMO 10 noinst_PROGRAMS = \ 11 arg_parser_demo \ 12 graph_to_eps_demo \ 13 lgf_demo 13 14 14 demo_arg_parser_demo_SOURCES = demo/arg_parser_demo.cc15 demo_graph_to_eps_demo_SOURCES = demo/graph_to_eps_demo.cc16 demo_lgf_demo_SOURCES = demo/lgf_demo.cc15 arg_parser_demo_SOURCES = arg_parser_demo.cc 16 graph_to_eps_demo_SOURCES = graph_to_eps_demo.cc 17 lgf_demo_SOURCES = lgf_demo.cc -
demo/graph_to_eps_demo.cc
r463 r659 183 183 ListDigraph::NodeMap<Point> hcoords(h); 184 184 185 int cols=int(s qrt(double(palette.size())));185 int cols=int(std::sqrt(double(palette.size()))); 186 186 for(int i=0;i<int(paletteW.size());i++) { 187 187 Node n=h.addNode(); -
doc/CMakeLists.txt
r347 r1037 1 1 SET(PACKAGE_NAME ${PROJECT_NAME}) 2 2 SET(PACKAGE_VERSION ${PROJECT_VERSION}) 3 SET(abs_top_srcdir ${CMAKE_SOURCE_DIR}) 4 SET(abs_top_builddir ${CMAKE_BINARY_DIR}) 3 SET(abs_top_srcdir ${PROJECT_SOURCE_DIR}) 4 SET(abs_top_builddir ${PROJECT_BINARY_DIR}) 5 6 SET(LEMON_DOC_SOURCE_BROWSER "NO" CACHE STRING "Include source into the doc (YES/NO).") 5 7 6 8 CONFIGURE_FILE( 7 ${CMAKE_SOURCE_DIR}/doc/Doxyfile.in 8 ${CMAKE_BINARY_DIR}/doc/Doxyfile 9 @ONLY) 9 ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in 10 ${PROJECT_BINARY_DIR}/doc/Doxyfile 11 @ONLY 12 ) 13 14 CONFIGURE_FILE( 15 ${PROJECT_SOURCE_DIR}/doc/mainpage.dox.in 16 ${PROJECT_BINARY_DIR}/doc/mainpage.dox 17 @ONLY 18 ) 10 19 11 20 IF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE) 21 FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/) 22 SET(GHOSTSCRIPT_OPTIONS -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha) 23 ADD_CUSTOM_TARGET(html 24 COMMAND ${CMAKE_COMMAND} -E remove_directory gen-images 25 COMMAND ${CMAKE_COMMAND} -E make_directory gen-images 26 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps 27 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps 28 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps 29 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps 30 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps 31 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps 32 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps 33 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps 34 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps 35 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps 36 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps 37 COMMAND ${GHOSTSCRIPT_EXECUTABLE} ${GHOSTSCRIPT_OPTIONS} -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps 38 COMMAND ${CMAKE_COMMAND} -E remove_directory html 39 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile 40 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 41 ) 42 43 SET_TARGET_PROPERTIES(html PROPERTIES PROJECT_LABEL BUILD_DOC) 44 12 45 IF(UNIX) 13 ADD_CUSTOM_TARGET(html 14 COMMAND rm -rf gen-images 15 COMMAND mkdir gen-images 16 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps 17 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps 18 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps 19 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps 20 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps 21 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps 22 COMMAND rm -rf html 23 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile 24 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) 46 INSTALL( 47 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ 48 DESTINATION share/doc/lemon/html 49 COMPONENT html_documentation 50 ) 25 51 ELSEIF(WIN32) 26 ADD_CUSTOM_TARGET(html 27 COMMAND if exist gen-images rmdir /s /q gen-images 28 COMMAND mkdir gen-images 29 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps 30 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps 31 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps 32 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps 33 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps 34 COMMAND if exist html rmdir /s /q html 35 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile 36 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) 37 ENDIF(UNIX) 38 ENDIF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE) 52 INSTALL( 53 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ 54 DESTINATION doc 55 COMPONENT html_documentation 56 ) 57 ENDIF() 39 58 40 INSTALL( 41 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ 42 DESTINATION doc 43 COMPONENT html_documentation) 59 ENDIF() 60 61 IF(WGET_FOUND) 62 ADD_CUSTOM_TARGET(update-external-tags 63 COMMAND ${CMAKE_COMMAND} -E make_directory dl 64 # COMMAND ${CMAKE_COMMAND} -E copy libstdc++.tag dl 65 COMMAND ${WGET_EXECUTABLE} wget -P dl -N libstdc++.tag.tmp http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/libstdc++.tag 66 COMMAND ${CMAKE_COMMAND} -E rename dl/libstdc++.tag libstdc++.tag 67 COMMAND ${CMAKE_COMMAND} -E remove dl/libstdc++.tag 68 COMMAND ${CMAKE_COMMAND} -E remove_directory dl 69 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 70 ) 71 ENDIF() -
doc/Doxyfile.in
r379 r1037 1 # Doxyfile 1. 5.7.11 # Doxyfile 1.7.3 2 2 3 3 #--------------------------------------------------------------------------- … … 5 5 #--------------------------------------------------------------------------- 6 6 DOXYFILE_ENCODING = UTF-8 7 PROJECT_NAME = @PACKAGE_NAME@ 8 PROJECT_NUMBER = @PACKAGE_VERSION@ 7 PROJECT_NAME = 8 PROJECT_NUMBER = 9 PROJECT_BRIEF = 10 PROJECT_LOGO = 9 11 OUTPUT_DIRECTORY = 10 12 CREATE_SUBDIRS = NO … … 22 24 QT_AUTOBRIEF = NO 23 25 MULTILINE_CPP_IS_BRIEF = NO 24 DETAILS_AT_TOP = YES25 26 INHERIT_DOCS = NO 26 27 SEPARATE_MEMBER_PAGES = NO … … 31 32 OPTIMIZE_FOR_FORTRAN = NO 32 33 OPTIMIZE_OUTPUT_VHDL = NO 34 EXTENSION_MAPPING = 33 35 BUILTIN_STL_SUPPORT = YES 34 36 CPP_CLI_SUPPORT = NO … … 56 58 HIDE_SCOPE_NAMES = YES 57 59 SHOW_INCLUDE_FILES = YES 60 FORCE_LOCAL_INCLUDES = NO 58 61 INLINE_INFO = YES 59 62 SORT_MEMBER_DOCS = NO 60 63 SORT_BRIEF_DOCS = NO 64 SORT_MEMBERS_CTORS_1ST = NO 61 65 SORT_GROUP_NAMES = NO 62 66 SORT_BY_SCOPE_NAME = NO 67 STRICT_PROTO_MATCHING = NO 63 68 GENERATE_TODOLIST = YES 64 69 GENERATE_TESTLIST = YES … … 72 77 SHOW_NAMESPACES = YES 73 78 FILE_VERSION_FILTER = 74 LAYOUT_FILE = DoxygenLayout.xml79 LAYOUT_FILE = "@abs_top_srcdir@/doc/DoxygenLayout.xml" 75 80 #--------------------------------------------------------------------------- 76 81 # configuration options related to warning and progress messages … … 92 97 "@abs_top_srcdir@/demo" \ 93 98 "@abs_top_srcdir@/tools" \ 94 "@abs_top_srcdir@/test/test_tools.h" 99 "@abs_top_srcdir@/test/test_tools.h" \ 100 "@abs_top_builddir@/doc/mainpage.dox" 95 101 INPUT_ENCODING = UTF-8 96 102 FILE_PATTERNS = *.h \ … … 112 118 FILTER_PATTERNS = 113 119 FILTER_SOURCE_FILES = NO 120 FILTER_SOURCE_PATTERNS = 114 121 #--------------------------------------------------------------------------- 115 122 # configuration options related to source browsing 116 123 #--------------------------------------------------------------------------- 117 SOURCE_BROWSER = NO124 SOURCE_BROWSER = @LEMON_DOC_SOURCE_BROWSER@ 118 125 INLINE_SOURCES = NO 119 126 STRIP_CODE_COMMENTS = YES … … 138 145 HTML_FOOTER = 139 146 HTML_STYLESHEET = 147 HTML_COLORSTYLE_HUE = 220 148 HTML_COLORSTYLE_SAT = 100 149 HTML_COLORSTYLE_GAMMA = 80 150 HTML_TIMESTAMP = YES 140 151 HTML_ALIGN_MEMBERS = YES 141 HTML_DYNAMIC_SECTIONS = NO152 HTML_DYNAMIC_SECTIONS = YES 142 153 GENERATE_DOCSET = NO 143 154 DOCSET_FEEDNAME = "Doxygen generated docs" 144 155 DOCSET_BUNDLE_ID = org.doxygen.Project 156 DOCSET_PUBLISHER_ID = org.doxygen.Publisher 157 DOCSET_PUBLISHER_NAME = Publisher 145 158 GENERATE_HTMLHELP = NO 146 159 CHM_FILE = … … 154 167 QHP_NAMESPACE = org.doxygen.Project 155 168 QHP_VIRTUAL_FOLDER = doc 169 QHP_CUST_FILTER_NAME = 170 QHP_CUST_FILTER_ATTRS = 171 QHP_SECT_FILTER_ATTRS = 156 172 QHG_LOCATION = 173 GENERATE_ECLIPSEHELP = NO 174 ECLIPSE_DOC_ID = org.doxygen.Project 157 175 DISABLE_INDEX = NO 158 176 ENUM_VALUES_PER_LINE = 4 159 177 GENERATE_TREEVIEW = NO 178 USE_INLINE_TREES = NO 160 179 TREEVIEW_WIDTH = 250 180 EXT_LINKS_IN_WINDOW = NO 161 181 FORMULA_FONTSIZE = 10 182 FORMULA_TRANSPARENT = YES 183 USE_MATHJAX = NO 184 MATHJAX_RELPATH = http://www.mathjax.org/mathjax 185 SEARCHENGINE = YES 186 SERVER_BASED_SEARCH = NO 162 187 #--------------------------------------------------------------------------- 163 188 # configuration options related to the LaTeX output … … 176 201 LATEX_BATCHMODE = NO 177 202 LATEX_HIDE_INDICES = NO 203 LATEX_SOURCE_CODE = NO 178 204 #--------------------------------------------------------------------------- 179 205 # configuration options related to the RTF output … … 224 250 SKIP_FUNCTION_MACROS = YES 225 251 #--------------------------------------------------------------------------- 226 # Configuration::additions related to external references 227 #--------------------------------------------------------------------------- 228 TAGFILES = "@abs_top_ srcdir@/doc/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/ "252 # Configuration::additions related to external references 253 #--------------------------------------------------------------------------- 254 TAGFILES = "@abs_top_builddir@/doc/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/ " 229 255 GENERATE_TAGFILE = html/lemon.tag 230 256 ALLEXTERNALS = NO … … 238 264 HIDE_UNDOC_RELATIONS = YES 239 265 HAVE_DOT = YES 266 DOT_NUM_THREADS = 0 240 267 DOT_FONTNAME = FreeSans 241 268 DOT_FONTSIZE = 10 … … 255 282 DOT_PATH = 256 283 DOTFILE_DIRS = 284 MSCFILE_DIRS = 257 285 DOT_GRAPH_MAX_NODES = 50 258 286 MAX_DOT_GRAPH_DEPTH = 0 … … 261 289 GENERATE_LEGEND = YES 262 290 DOT_CLEANUP = YES 263 #---------------------------------------------------------------------------264 # Configuration::additions related to the search engine265 #---------------------------------------------------------------------------266 SEARCHENGINE = NO -
doc/DoxygenLayout.xml
r316 r1036 3 3 <navindex> 4 4 <tab type="mainpage" visible="yes" title=""/> 5 <tab type="modules" visible="yes" title="" />5 <tab type="modules" visible="yes" title="" intro=""/> 6 6 <tab type="classes" visible="yes" title=""> 7 <tab type="classes" visible="yes" title="" />8 <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/> 9 <tab type="hierarchy" visible="yes" title="" />10 <tab type="classmembers" visible="yes" title="" />7 <tab type="classes" visible="yes" title="" intro=""/> 8 <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/> 9 <tab type="hierarchy" visible="yes" title="" intro=""/> 10 <tab type="classmembers" visible="yes" title="" intro=""/> 11 11 </tab> 12 12 <tab type="namespaces" visible="yes" title=""> 13 <tab type="namespaces" visible="yes" title="" />14 <tab type="namespacemembers" visible="yes" title="" />13 <tab type="namespaces" visible="yes" title="" intro=""/> 14 <tab type="namespacemembers" visible="yes" title="" intro=""/> 15 15 </tab> 16 16 <tab type="files" visible="yes" title=""> 17 <tab type="files" visible="yes" title="" />18 <tab type="globals" visible="yes" title="" />17 <tab type="files" visible="yes" title="" intro=""/> 18 <tab type="globals" visible="yes" title="" intro=""/> 19 19 </tab> 20 <tab type="dirs" visible="yes" title="" />21 <tab type="examples" visible="yes" title="" />22 <tab type="pages" visible="yes" title="" />20 <tab type="dirs" visible="yes" title="" intro=""/> 21 <tab type="examples" visible="yes" title="" intro=""/> 22 <tab type="pages" visible="yes" title="" intro=""/> 23 23 </navindex> 24 24 -
doc/Makefile.am
r349 r720 9 9 doc/mainpage.dox \ 10 10 doc/migration.dox \ 11 doc/min_cost_flow.dox \ 11 12 doc/named-param.dox \ 12 13 doc/namespaces.dox \ … … 22 23 nodeshape_4.eps 23 24 25 DOC_EPS_IMAGES27 = \ 26 bipartite_matching.eps \ 27 bipartite_partitions.eps \ 28 connected_components.eps \ 29 edge_biconnected_components.eps \ 30 node_biconnected_components.eps \ 31 strongly_connected_components.eps 32 24 33 DOC_EPS_IMAGES = \ 25 $(DOC_EPS_IMAGES18) 34 $(DOC_EPS_IMAGES18) \ 35 $(DOC_EPS_IMAGES27) 26 36 27 37 DOC_PNG_IMAGES = \ … … 39 49 if test ${gs_found} = yes; then \ 40 50 $(GS_COMMAND) -sDEVICE=pngalpha -r18 -sOutputFile=$@ $<; \ 51 else \ 52 echo; \ 53 echo "Ghostscript not found."; \ 54 echo; \ 55 exit 1; \ 56 fi 57 58 $(DOC_EPS_IMAGES27:%.eps=doc/gen-images/%.png): doc/gen-images/%.png: doc/images/%.eps 59 -mkdir doc/gen-images 60 if test ${gs_found} = yes; then \ 61 $(GS_COMMAND) -sDEVICE=pngalpha -r27 -sOutputFile=$@ $<; \ 41 62 else \ 42 63 echo; \ … … 71 92 install-html-local: doc/html 72 93 @$(NORMAL_INSTALL) 73 $(mkinstalldirs) $(DESTDIR)$(htmldir)/ docs94 $(mkinstalldirs) $(DESTDIR)$(htmldir)/html 74 95 for p in doc/html/*.{html,css,png,map,gif,tag} ; do \ 75 96 f="`echo $$p | sed -e 's|^.*/||'`"; \ 76 echo " $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/ docs/$$f"; \77 $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/ docs/$$f; \97 echo " $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/html/$$f"; \ 98 $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/html/$$f; \ 78 99 done 79 100 … … 82 103 for p in doc/html/*.{html,css,png,map,gif,tag} ; do \ 83 104 f="`echo $$p | sed -e 's|^.*/||'`"; \ 84 echo " rm -f $(DESTDIR)$(htmldir)/ docs/$$f"; \85 rm -f $(DESTDIR)$(htmldir)/ docs/$$f; \105 echo " rm -f $(DESTDIR)$(htmldir)/html/$$f"; \ 106 rm -f $(DESTDIR)$(htmldir)/html/$$f; \ 86 107 done 87 108 -
doc/groups.dox
r478 r710 21 21 /** 22 22 @defgroup datas Data Structures 23 This group describes the several data structures implemented in LEMON.23 This group contains the several data structures implemented in LEMON. 24 24 */ 25 25 … … 139 139 140 140 /** 141 @defgroup semi_adaptors Semi-Adaptor Classes for Graphs142 @ingroup graphs143 \brief Graph types between real graphs and graph adaptors.144 145 This group describes some graph types between real graphs and graph adaptors.146 These classes wrap graphs to give new functionality as the adaptors do it.147 On the other hand they are not light-weight structures as the adaptors.148 */149 150 /**151 141 @defgroup maps Maps 152 142 @ingroup datas 153 143 \brief Map structures implemented in LEMON. 154 144 155 This group describes the map structures implemented in LEMON.145 This group contains the map structures implemented in LEMON. 156 146 157 147 LEMON provides several special purpose maps and map adaptors that e.g. combine … … 166 156 \brief Special graph-related maps. 167 157 168 This group describes maps that are specifically designed to assign158 This group contains maps that are specifically designed to assign 169 159 values to the nodes and arcs/edges of graphs. 170 160 … … 178 168 \brief Tools to create new maps from existing ones 179 169 180 This group describes map adaptors that are used to create "implicit"170 This group contains map adaptors that are used to create "implicit" 181 171 maps from other maps. 182 172 … … 241 231 \brief Two dimensional data storages implemented in LEMON. 242 232 243 This group describes two dimensional data storages implemented in LEMON.233 This group contains two dimensional data storages implemented in LEMON. 244 234 */ 245 235 … … 249 239 \brief %Path structures implemented in LEMON. 250 240 251 This group describes the path structures implemented in LEMON.241 This group contains the path structures implemented in LEMON. 252 242 253 243 LEMON provides flexible data structures to work with paths. … … 265 255 \brief Auxiliary data structures implemented in LEMON. 266 256 267 This group describes some data structures implemented in LEMON in257 This group contains some data structures implemented in LEMON in 268 258 order to make it easier to implement combinatorial algorithms. 269 259 */ … … 271 261 /** 272 262 @defgroup algs Algorithms 273 \brief This group describes the several algorithms263 \brief This group contains the several algorithms 274 264 implemented in LEMON. 275 265 276 This group describes the several algorithms266 This group contains the several algorithms 277 267 implemented in LEMON. 278 268 */ … … 283 273 \brief Common graph search algorithms. 284 274 285 This group describes the common graph search algorithms, namely275 This group contains the common graph search algorithms, namely 286 276 \e breadth-first \e search (BFS) and \e depth-first \e search (DFS). 287 277 */ … … 292 282 \brief Algorithms for finding shortest paths. 293 283 294 This group describes the algorithms for finding shortest paths in digraphs.284 This group contains the algorithms for finding shortest paths in digraphs. 295 285 296 286 - \ref Dijkstra algorithm for finding shortest paths from a source node … … 313 303 \brief Algorithms for finding maximum flows. 314 304 315 This group describes the algorithms for finding maximum flows and305 This group contains the algorithms for finding maximum flows and 316 306 feasible circulations. 317 307 318 308 The \e maximum \e flow \e problem is to find a flow of maximum value between 319 309 a single source and a single target. Formally, there is a \f$G=(V,A)\f$ 320 digraph, a \f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function and310 digraph, a \f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function and 321 311 \f$s, t \in V\f$ source and target nodes. 322 A maximum flow is an \f$f: A\rightarrow\mathbf{R}^+_0\f$ solution of the312 A maximum flow is an \f$f: A\rightarrow\mathbf{R}^+_0\f$ solution of the 323 313 following optimization problem. 324 314 325 \f[ \max\sum_{ a\in\delta_{out}(s)}f(a) - \sum_{a\in\delta_{in}(s)}f(a) \f]326 \f[ \sum_{ a\in\delta_{out}(v)} f(a) = \sum_{a\in\delta_{in}(v)} f(a)327 \q quad \forall v\in V\setminus\{s,t\} \f]328 \f[ 0 \leq f( a) \leq cap(a) \qquad \forall a\in A \f]315 \f[ \max\sum_{sv\in A} f(sv) - \sum_{vs\in A} f(vs) \f] 316 \f[ \sum_{uv\in A} f(uv) = \sum_{vu\in A} f(vu) 317 \quad \forall u\in V\setminus\{s,t\} \f] 318 \f[ 0 \leq f(uv) \leq cap(uv) \quad \forall uv\in A \f] 329 319 330 320 LEMON contains several algorithms for solving maximum flow problems: … … 336 326 In most cases the \ref Preflow "Preflow" algorithm provides the 337 327 fastest method for computing a maximum flow. All implementations 338 provides functions to also query the minimum cut, which is the dual 339 problem of the maximum flow. 340 */ 341 342 /** 343 @defgroup min_cost_flow Minimum Cost Flow Algorithms 328 also provide functions to query the minimum cut, which is the dual 329 problem of maximum flow. 330 331 \ref Circulation is a preflow push-relabel algorithm implemented directly 332 for finding feasible circulations, which is a somewhat different problem, 333 but it is strongly related to maximum flow. 334 For more information, see \ref Circulation. 335 */ 336 337 /** 338 @defgroup min_cost_flow_algs Minimum Cost Flow Algorithms 344 339 @ingroup algs 345 340 346 341 \brief Algorithms for finding minimum cost flows and circulations. 347 342 348 This group describes the algorithms for finding minimum cost flows and 349 circulations. 350 351 The \e minimum \e cost \e flow \e problem is to find a feasible flow of 352 minimum total cost from a set of supply nodes to a set of demand nodes 353 in a network with capacity constraints and arc costs. 354 Formally, let \f$G=(V,A)\f$ be a digraph, 355 \f$lower, upper: A\rightarrow\mathbf{Z}^+_0\f$ denote the lower and 356 upper bounds for the flow values on the arcs, 357 \f$cost: A\rightarrow\mathbf{Z}^+_0\f$ denotes the cost per unit flow 358 on the arcs, and 359 \f$supply: V\rightarrow\mathbf{Z}\f$ denotes the supply/demand values 360 of the nodes. 361 A minimum cost flow is an \f$f:A\rightarrow\mathbf{R}^+_0\f$ solution of 362 the following optimization problem. 363 364 \f[ \min\sum_{a\in A} f(a) cost(a) \f] 365 \f[ \sum_{a\in\delta_{out}(v)} f(a) - \sum_{a\in\delta_{in}(v)} f(a) = 366 supply(v) \qquad \forall v\in V \f] 367 \f[ lower(a) \leq f(a) \leq upper(a) \qquad \forall a\in A \f] 368 369 LEMON contains several algorithms for solving minimum cost flow problems: 370 - \ref CycleCanceling Cycle-canceling algorithms. 371 - \ref CapacityScaling Successive shortest path algorithm with optional 343 This group contains the algorithms for finding minimum cost flows and 344 circulations. For more information about this problem and its dual 345 solution see \ref min_cost_flow "Minimum Cost Flow Problem". 346 347 LEMON contains several algorithms for this problem. 348 - \ref NetworkSimplex Primal Network Simplex algorithm with various 349 pivot strategies. 350 - \ref CostScaling Push-Relabel and Augment-Relabel algorithms based on 351 cost scaling. 352 - \ref CapacityScaling Successive Shortest %Path algorithm with optional 372 353 capacity scaling. 373 - \ref CostScaling Push-relabel and augment-relabel algorithms based on 374 cost scaling. 375 - \ref NetworkSimplex Primal network simplex algorithm with various 376 pivot strategies. 354 - \ref CancelAndTighten The Cancel and Tighten algorithm. 355 - \ref CycleCanceling Cycle-Canceling algorithms. 356 357 In general NetworkSimplex is the most efficient implementation, 358 but in special cases other algorithms could be faster. 359 For example, if the total supply and/or capacities are rather small, 360 CapacityScaling is usually the fastest algorithm (without effective scaling). 377 361 */ 378 362 … … 383 367 \brief Algorithms for finding minimum cut in graphs. 384 368 385 This group describes the algorithms for finding minimum cut in graphs.369 This group contains the algorithms for finding minimum cut in graphs. 386 370 387 371 The \e minimum \e cut \e problem is to find a non-empty and non-complete … … 400 384 - \ref NagamochiIbaraki "Nagamochi-Ibaraki algorithm" for 401 385 calculating minimum cut in undirected graphs. 402 - \ref GomoryHu Tree"Gomory-Hu tree computation" for calculating386 - \ref GomoryHu "Gomory-Hu tree computation" for calculating 403 387 all-pairs minimum cut in undirected graphs. 404 388 … … 408 392 409 393 /** 410 @defgroup graph_prop Connectivity and Other Graph Properties394 @defgroup graph_properties Connectivity and Other Graph Properties 411 395 @ingroup algs 412 396 \brief Algorithms for discovering the graph properties 413 397 414 This group describes the algorithms for discovering the graph properties398 This group contains the algorithms for discovering the graph properties 415 399 like connectivity, bipartiteness, euler property, simplicity etc. 416 400 … … 424 408 \brief Algorithms for planarity checking, embedding and drawing 425 409 426 This group describes the algorithms for planarity checking,410 This group contains the algorithms for planarity checking, 427 411 embedding and drawing. 428 412 … … 436 420 \brief Algorithms for finding matchings in graphs and bipartite graphs. 437 421 438 This group contains algorithm objects and functions to calculate422 This group contains the algorithms for calculating 439 423 matchings in graphs and bipartite graphs. The general matching problem is 440 finding a subset of the arcs which does not shares common endpoints. 424 finding a subset of the edges for which each node has at most one incident 425 edge. 441 426 442 427 There are several different algorithms for calculate matchings in … … 473 458 @defgroup spantree Minimum Spanning Tree Algorithms 474 459 @ingroup algs 475 \brief Algorithms for finding a minimum cost spanning tree in a graph.476 477 This group describes the algorithms for finding aminimum cost spanning478 tree in a graph.460 \brief Algorithms for finding minimum cost spanning trees and arborescences. 461 462 This group contains the algorithms for finding minimum cost spanning 463 trees and arborescences. 479 464 */ 480 465 … … 484 469 \brief Auxiliary algorithms implemented in LEMON. 485 470 486 This group describes some algorithms implemented in LEMON471 This group contains some algorithms implemented in LEMON 487 472 in order to make it easier to implement complex algorithms. 488 473 */ … … 493 478 \brief Approximation algorithms. 494 479 495 This group describes the approximation and heuristic algorithms480 This group contains the approximation and heuristic algorithms 496 481 implemented in LEMON. 497 482 */ … … 499 484 /** 500 485 @defgroup gen_opt_group General Optimization Tools 501 \brief This group describes some general optimization frameworks486 \brief This group contains some general optimization frameworks 502 487 implemented in LEMON. 503 488 504 This group describes some general optimization frameworks489 This group contains some general optimization frameworks 505 490 implemented in LEMON. 506 491 */ … … 511 496 \brief Lp and Mip solver interfaces for LEMON. 512 497 513 This group describes Lp and Mip solver interfaces for LEMON. The498 This group contains Lp and Mip solver interfaces for LEMON. The 514 499 various LP solvers could be used in the same manner with this 515 500 interface. … … 530 515 \brief Metaheuristics for LEMON library. 531 516 532 This group describes some metaheuristic optimization tools.517 This group contains some metaheuristic optimization tools. 533 518 */ 534 519 … … 545 530 \brief Simple basic graph utilities. 546 531 547 This group describes some simple basic graph utilities.532 This group contains some simple basic graph utilities. 548 533 */ 549 534 … … 553 538 \brief Tools for development, debugging and testing. 554 539 555 This group describes several useful tools for development,540 This group contains several useful tools for development, 556 541 debugging and testing. 557 542 */ … … 562 547 \brief Simple tools for measuring the performance of algorithms. 563 548 564 This group describes simple tools for measuring the performance549 This group contains simple tools for measuring the performance 565 550 of algorithms. 566 551 */ … … 571 556 \brief Exceptions defined in LEMON. 572 557 573 This group describes the exceptions defined in LEMON.558 This group contains the exceptions defined in LEMON. 574 559 */ 575 560 … … 578 563 \brief Graph Input-Output methods 579 564 580 This group describes the tools for importing and exporting graphs565 This group contains the tools for importing and exporting graphs 581 566 and graph related data. Now it supports the \ref lgf-format 582 567 "LEMON Graph Format", the \c DIMACS format and the encapsulated … … 589 574 \brief Reading and writing LEMON Graph Format. 590 575 591 This group describes methods for reading and writing576 This group contains methods for reading and writing 592 577 \ref lgf-format "LEMON Graph Format". 593 578 */ … … 598 583 \brief General \c EPS drawer and graph exporter 599 584 600 This group describes general \c EPS drawing methods and special585 This group contains general \c EPS drawing methods and special 601 586 graph exporting tools. 602 587 */ … … 622 607 \brief Skeleton classes and concept checking classes 623 608 624 This group describes the data/algorithm skeletons and concept checking609 This group contains the data/algorithm skeletons and concept checking 625 610 classes implemented in LEMON. 626 611 … … 652 637 \brief Skeleton and concept checking classes for graph structures 653 638 654 This group describes the skeletons and concept checking classes of LEMON's639 This group contains the skeletons and concept checking classes of LEMON's 655 640 graph structures and helper classes used to implement these. 656 641 */ … … 661 646 \brief Skeleton and concept checking classes for maps 662 647 663 This group describes the skeletons and concept checking classes of maps.648 This group contains the skeletons and concept checking classes of maps. 664 649 */ 665 650 … … 672 657 the \c demo subdirectory of the source tree. 673 658 674 I t order to compile them, use <tt>--enable-demo</tt> configure option when675 build the library.659 In order to compile them, use the <tt>make demo</tt> or the 660 <tt>make check</tt> commands. 676 661 */ 677 662 -
doc/lgf.dox
r463 r1069 64 64 \endcode 65 65 66 The \c \@arcs section is very similar to the \c \@nodes section, 67 it again starts with a header line describing the names of the maps, 68 butthe \c "label" map is not obligatory here. The following lines69 describe the arcs. The first two tokens of each line are 70 the sourceand the target node of the arc, respectively, then come the map66 The \c \@arcs section is very similar to the \c \@nodes section, it 67 again starts with a header line describing the names of the maps, but 68 the \c "label" map is not obligatory here. The following lines 69 describe the arcs. The first two tokens of each line are the source 70 and the target node of the arc, respectively, then come the map 71 71 values. The source and target tokens must be node labels. 72 72 … … 79 79 \endcode 80 80 81 If there is no map in the \c \@arcs section at all, then it must be 82 indicated by a sole '-' sign in the first line. 83 84 \code 85 @arcs 86 - 87 1 2 88 1 3 89 2 3 90 \endcode 91 81 92 The \c \@edges is just a synonym of \c \@arcs. The \@arcs section can 82 93 also store the edge set of an undirected graph. In such case there is 83 94 a conventional method for store arc maps in the file, if two columns 84 ha sthe same caption with \c '+' and \c '-' prefix, then these columns95 have the same caption with \c '+' and \c '-' prefix, then these columns 85 96 can be regarded as the values of an arc map. 86 97 -
lemon/CMakeLists.txt
r482 r1012 1 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) 1 INCLUDE_DIRECTORIES( 2 ${PROJECT_SOURCE_DIR} 3 ${PROJECT_BINARY_DIR} 4 ) 2 5 3 ADD_LIBRARY(lemon 6 CONFIGURE_FILE( 7 ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake 8 ${CMAKE_CURRENT_BINARY_DIR}/config.h 9 ) 10 11 CONFIGURE_FILE( 12 ${CMAKE_CURRENT_SOURCE_DIR}/lemon.pc.cmake 13 ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc 14 @ONLY 15 ) 16 17 SET(LEMON_SOURCES 4 18 arg_parser.cc 5 19 base.cc 6 20 color.cc 7 random.cc) 21 lp_base.cc 22 lp_skeleton.cc 23 random.cc 24 bits/windows.cc 25 ) 26 27 IF(LEMON_HAVE_GLPK) 28 SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc) 29 INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIRS}) 30 IF(WIN32) 31 INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin) 32 INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin) 33 INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin) 34 ENDIF() 35 ENDIF() 36 37 IF(LEMON_HAVE_CPLEX) 38 SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc) 39 INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS}) 40 ENDIF() 41 42 IF(LEMON_HAVE_CLP) 43 SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc) 44 INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) 45 ENDIF() 46 47 IF(LEMON_HAVE_CBC) 48 SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc) 49 INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) 50 ENDIF() 51 52 ADD_LIBRARY(lemon ${LEMON_SOURCES}) 53 IF(UNIX) 54 SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon) 55 ENDIF() 8 56 9 57 INSTALL( 10 58 TARGETS lemon 11 59 ARCHIVE DESTINATION lib 12 COMPONENT library) 60 COMPONENT library 61 ) 13 62 14 63 INSTALL( … … 16 65 DESTINATION include/lemon 17 66 COMPONENT headers 18 FILES_MATCHING PATTERN "*.h") 67 FILES_MATCHING PATTERN "*.h" 68 ) 69 70 INSTALL( 71 FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h 72 DESTINATION include/lemon 73 COMPONENT headers 74 ) 75 76 INSTALL( 77 FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc 78 DESTINATION lib/pkgconfig 79 ) 80 -
lemon/Makefile.am
r547 r1106 1 1 EXTRA_DIST += \ 2 2 lemon/lemon.pc.in \ 3 lemon/CMakeLists.txt 3 lemon/lemon.pc.cmake \ 4 lemon/CMakeLists.txt \ 5 lemon/config.h.cmake 4 6 5 7 pkgconfig_DATA += lemon/lemon.pc … … 13 15 lemon/lp_base.cc \ 14 16 lemon/lp_skeleton.cc \ 15 lemon/random.cc 17 lemon/random.cc \ 18 lemon/bits/windows.cc 16 19 20 nodist_lemon_HEADERS = lemon/config.h 17 21 18 22 lemon_libemon_la_CXXFLAGS = \ 23 $(AM_CXXFLAGS) \ 19 24 $(GLPK_CFLAGS) \ 20 25 $(CPLEX_CFLAGS) \ 21 26 $(SOPLEX_CXXFLAGS) \ 22 $(CLP_CXXFLAGS) 27 $(CLP_CXXFLAGS) \ 28 $(CBC_CXXFLAGS) 23 29 24 30 lemon_libemon_la_LDFLAGS = \ … … 26 32 $(CPLEX_LIBS) \ 27 33 $(SOPLEX_LIBS) \ 28 $(CLP_LIBS) 34 $(CLP_LIBS) \ 35 $(CBC_LIBS) 29 36 30 37 if HAVE_GLPK 31 lemon_libemon_la_SOURCES += lemon/ lp_glpk.cc38 lemon_libemon_la_SOURCES += lemon/glpk.cc 32 39 endif 33 40 34 41 if HAVE_CPLEX 35 lemon_libemon_la_SOURCES += lemon/ lp_cplex.cc42 lemon_libemon_la_SOURCES += lemon/cplex.cc 36 43 endif 37 44 38 45 if HAVE_SOPLEX 39 lemon_libemon_la_SOURCES += lemon/ lp_soplex.cc46 lemon_libemon_la_SOURCES += lemon/soplex.cc 40 47 endif 41 48 42 49 if HAVE_CLP 43 lemon_libemon_la_SOURCES += lemon/lp_clp.cc 50 lemon_libemon_la_SOURCES += lemon/clp.cc 51 endif 52 53 if HAVE_CBC 54 lemon_libemon_la_SOURCES += lemon/cbc.cc 44 55 endif 45 56 … … 50 61 lemon/bfs.h \ 51 62 lemon/bin_heap.h \ 63 lemon/bucket_heap.h \ 64 lemon/cbc.h \ 52 65 lemon/circulation.h \ 66 lemon/clp.h \ 53 67 lemon/color.h \ 54 68 lemon/concept_check.h \ 69 lemon/connectivity.h \ 55 70 lemon/counter.h \ 56 71 lemon/core.h \ 72 lemon/cplex.h \ 57 73 lemon/dfs.h \ 58 74 lemon/dijkstra.h \ 59 75 lemon/dim2.h \ 60 76 lemon/dimacs.h \ 77 lemon/edge_set.h \ 61 78 lemon/elevator.h \ 62 79 lemon/error.h \ 80 lemon/euler.h \ 81 lemon/fib_heap.h \ 63 82 lemon/full_graph.h \ 83 lemon/glpk.h \ 84 lemon/gomory_hu.h \ 64 85 lemon/graph_to_eps.h \ 65 86 lemon/grid_graph.h \ … … 72 93 lemon/lp.h \ 73 94 lemon/lp_base.h \ 74 lemon/lp_clp.h \75 lemon/lp_cplex.h \76 lemon/lp_glpk.h \77 95 lemon/lp_skeleton.h \ 78 lemon/lp_soplex.h \79 96 lemon/maps.h \ 97 lemon/matching.h \ 80 98 lemon/math.h \ 81 lemon/m ax_matching.h \99 lemon/min_cost_arborescence.h \ 82 100 lemon/nauty_reader.h \ 101 lemon/network_simplex.h \ 83 102 lemon/path.h \ 84 103 lemon/preflow.h \ 104 lemon/radix_heap.h \ 85 105 lemon/radix_sort.h \ 86 106 lemon/random.h \ 87 107 lemon/smart_graph.h \ 108 lemon/soplex.h \ 88 109 lemon/suurballe.h \ 89 110 lemon/time_measure.h \ 90 111 lemon/tolerance.h \ 91 lemon/unionfind.h 112 lemon/unionfind.h \ 113 lemon/bits/windows.h 92 114 93 115 bits_HEADERS += \ 94 116 lemon/bits/alteration_notifier.h \ 95 117 lemon/bits/array_map.h \ 96 lemon/bits/base_extender.h \97 118 lemon/bits/bezier.h \ 98 119 lemon/bits/default_map.h \ 120 lemon/bits/edge_set_extender.h \ 99 121 lemon/bits/enable_if.h \ 100 122 lemon/bits/graph_adaptor_extender.h \ -
lemon/adaptors.h
r478 r703 31 31 32 32 #include <lemon/bits/graph_adaptor_extender.h> 33 #include <lemon/bits/map_extender.h> 33 34 #include <lemon/tolerance.h> 34 35 … … 37 38 namespace lemon { 38 39 39 template<typename _Digraph> 40 #ifdef _MSC_VER 41 #define LEMON_SCOPE_FIX(OUTER, NESTED) OUTER::NESTED 42 #else 43 #define LEMON_SCOPE_FIX(OUTER, NESTED) typename OUTER::template NESTED 44 #endif 45 46 template<typename DGR> 40 47 class DigraphAdaptorBase { 41 48 public: 42 typedef _DigraphDigraph;49 typedef DGR Digraph; 43 50 typedef DigraphAdaptorBase Adaptor; 44 typedef Digraph ParentDigraph;45 51 46 52 protected: 47 D igraph* _digraph;53 DGR* _digraph; 48 54 DigraphAdaptorBase() : _digraph(0) { } 49 void setDigraph(Digraph& digraph) { _digraph = &digraph; }50 51 public: 52 DigraphAdaptorBase(D igraph& digraph) : _digraph(&digraph) { }53 54 typedef typename D igraph::Node Node;55 typedef typename D igraph::Arc Arc;55 void initialize(DGR& digraph) { _digraph = &digraph; } 56 57 public: 58 DigraphAdaptorBase(DGR& digraph) : _digraph(&digraph) { } 59 60 typedef typename DGR::Node Node; 61 typedef typename DGR::Arc Arc; 56 62 57 63 void first(Node& i) const { _digraph->first(i); } … … 68 74 Node target(const Arc& a) const { return _digraph->target(a); } 69 75 70 typedef NodeNumTagIndicator<D igraph> NodeNumTag;76 typedef NodeNumTagIndicator<DGR> NodeNumTag; 71 77 int nodeNum() const { return _digraph->nodeNum(); } 72 78 73 typedef ArcNumTagIndicator<D igraph> ArcNumTag;79 typedef ArcNumTagIndicator<DGR> ArcNumTag; 74 80 int arcNum() const { return _digraph->arcNum(); } 75 81 76 typedef FindArcTagIndicator<D igraph> FindArcTag;82 typedef FindArcTagIndicator<DGR> FindArcTag; 77 83 Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) const { 78 84 return _digraph->findArc(u, v, prev); … … 96 102 int maxArcId() const { return _digraph->maxArcId(); } 97 103 98 typedef typename ItemSetTraits<D igraph, Node>::ItemNotifier NodeNotifier;104 typedef typename ItemSetTraits<DGR, Node>::ItemNotifier NodeNotifier; 99 105 NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); } 100 106 101 typedef typename ItemSetTraits<D igraph, Arc>::ItemNotifier ArcNotifier;107 typedef typename ItemSetTraits<DGR, Arc>::ItemNotifier ArcNotifier; 102 108 ArcNotifier& notifier(Arc) const { return _digraph->notifier(Arc()); } 103 109 104 template <typename _Value> 105 class NodeMap : public Digraph::template NodeMap<_Value> { 110 template <typename V> 111 class NodeMap : public DGR::template NodeMap<V> { 112 typedef typename DGR::template NodeMap<V> Parent; 113 106 114 public: 107 108 typedef typename Digraph::template NodeMap<_Value> Parent;109 110 115 explicit NodeMap(const Adaptor& adaptor) 111 116 : Parent(*adaptor._digraph) {} 112 113 NodeMap(const Adaptor& adaptor, const _Value& value) 117 NodeMap(const Adaptor& adaptor, const V& value) 114 118 : Parent(*adaptor._digraph, value) { } 115 119 … … 127 131 }; 128 132 129 template <typename _Value> 130 class ArcMap : public Digraph::template ArcMap<_Value> { 133 template <typename V> 134 class ArcMap : public DGR::template ArcMap<V> { 135 typedef typename DGR::template ArcMap<V> Parent; 136 131 137 public: 132 133 typedef typename Digraph::template ArcMap<_Value> Parent; 134 135 explicit ArcMap(const Adaptor& adaptor) 138 explicit ArcMap(const DigraphAdaptorBase<DGR>& adaptor) 136 139 : Parent(*adaptor._digraph) {} 137 138 ArcMap(const Adaptor& adaptor, const _Value& value) 140 ArcMap(const DigraphAdaptorBase<DGR>& adaptor, const V& value) 139 141 : Parent(*adaptor._digraph, value) {} 140 142 … … 154 156 }; 155 157 156 template<typename _Graph>158 template<typename GR> 157 159 class GraphAdaptorBase { 158 160 public: 159 typedef _Graph Graph; 160 typedef Graph ParentGraph; 161 typedef GR Graph; 161 162 162 163 protected: 163 G raph* _graph;164 GR* _graph; 164 165 165 166 GraphAdaptorBase() : _graph(0) {} 166 167 167 void setGraph(Graph& graph) { _graph = &graph; }168 169 public: 170 GraphAdaptorBase(G raph& graph) : _graph(&graph) {}171 172 typedef typename G raph::Node Node;173 typedef typename G raph::Arc Arc;174 typedef typename G raph::Edge Edge;168 void initialize(GR& graph) { _graph = &graph; } 169 170 public: 171 GraphAdaptorBase(GR& graph) : _graph(&graph) {} 172 173 typedef typename GR::Node Node; 174 typedef typename GR::Arc Arc; 175 typedef typename GR::Edge Edge; 175 176 176 177 void first(Node& i) const { _graph->first(i); } … … 240 241 int maxEdgeId() const { return _graph->maxEdgeId(); } 241 242 242 typedef typename ItemSetTraits<G raph, Node>::ItemNotifier NodeNotifier;243 typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; 243 244 NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); } 244 245 245 typedef typename ItemSetTraits<G raph, Arc>::ItemNotifier ArcNotifier;246 typedef typename ItemSetTraits<GR, Arc>::ItemNotifier ArcNotifier; 246 247 ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); } 247 248 248 typedef typename ItemSetTraits<G raph, Edge>::ItemNotifier EdgeNotifier;249 typedef typename ItemSetTraits<GR, Edge>::ItemNotifier EdgeNotifier; 249 250 EdgeNotifier& notifier(Edge) const { return _graph->notifier(Edge()); } 250 251 251 template <typename _Value> 252 class NodeMap : public Graph::template NodeMap<_Value> { 252 template <typename V> 253 class NodeMap : public GR::template NodeMap<V> { 254 typedef typename GR::template NodeMap<V> Parent; 255 253 256 public: 254 typedef typename Graph::template NodeMap<_Value> Parent; 255 explicit NodeMap(const GraphAdaptorBase<Graph>& adapter) 257 explicit NodeMap(const GraphAdaptorBase<GR>& adapter) 256 258 : Parent(*adapter._graph) {} 257 NodeMap(const GraphAdaptorBase<G raph>& adapter, const _Value& value)259 NodeMap(const GraphAdaptorBase<GR>& adapter, const V& value) 258 260 : Parent(*adapter._graph, value) {} 259 261 … … 271 273 }; 272 274 273 template <typename _Value> 274 class ArcMap : public Graph::template ArcMap<_Value> { 275 template <typename V> 276 class ArcMap : public GR::template ArcMap<V> { 277 typedef typename GR::template ArcMap<V> Parent; 278 275 279 public: 276 typedef typename Graph::template ArcMap<_Value> Parent; 277 explicit ArcMap(const GraphAdaptorBase<Graph>& adapter) 280 explicit ArcMap(const GraphAdaptorBase<GR>& adapter) 278 281 : Parent(*adapter._graph) {} 279 ArcMap(const GraphAdaptorBase<G raph>& adapter, const _Value& value)282 ArcMap(const GraphAdaptorBase<GR>& adapter, const V& value) 280 283 : Parent(*adapter._graph, value) {} 281 284 … … 292 295 }; 293 296 294 template <typename _Value> 295 class EdgeMap : public Graph::template EdgeMap<_Value> { 297 template <typename V> 298 class EdgeMap : public GR::template EdgeMap<V> { 299 typedef typename GR::template EdgeMap<V> Parent; 300 296 301 public: 297 typedef typename Graph::template EdgeMap<_Value> Parent; 298 explicit EdgeMap(const GraphAdaptorBase<Graph>& adapter) 302 explicit EdgeMap(const GraphAdaptorBase<GR>& adapter) 299 303 : Parent(*adapter._graph) {} 300 EdgeMap(const GraphAdaptorBase<G raph>& adapter, const _Value& value)304 EdgeMap(const GraphAdaptorBase<GR>& adapter, const V& value) 301 305 : Parent(*adapter._graph, value) {} 302 306 … … 315 319 }; 316 320 317 template <typename _Digraph>318 class ReverseDigraphBase : public DigraphAdaptorBase< _Digraph> {319 public:320 typedef _Digraph Digraph;321 typedef D igraphAdaptorBase<_Digraph> Parent;321 template <typename DGR> 322 class ReverseDigraphBase : public DigraphAdaptorBase<DGR> { 323 typedef DigraphAdaptorBase<DGR> Parent; 324 public: 325 typedef DGR Digraph; 322 326 protected: 323 327 ReverseDigraphBase() : Parent() { } … … 337 341 Arc addArc(const Node& u, const Node& v) { return Parent::addArc(v, u); } 338 342 339 typedef FindArcTagIndicator<D igraph> FindArcTag;343 typedef FindArcTagIndicator<DGR> FindArcTag; 340 344 Arc findArc(const Node& u, const Node& v, 341 345 const Arc& prev = INVALID) const { … … 357 361 /// parameter is set to be \c const. 358 362 /// 359 /// \tparam GR The type of the adapted digraph.363 /// \tparam DGR The type of the adapted digraph. 360 364 /// It must conform to the \ref concepts::Digraph "Digraph" concept. 361 365 /// It can also be specified to be \c const. … … 363 367 /// \note The \c Node and \c Arc types of this adaptor and the adapted 364 368 /// digraph are convertible to each other. 365 template<typename GR>369 template<typename DGR> 366 370 #ifdef DOXYGEN 367 371 class ReverseDigraph { 368 372 #else 369 373 class ReverseDigraph : 370 public DigraphAdaptorExtender<ReverseDigraphBase< GR> > {374 public DigraphAdaptorExtender<ReverseDigraphBase<DGR> > { 371 375 #endif 376 typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent; 372 377 public: 373 378 /// The type of the adapted digraph. 374 typedef GR Digraph; 375 typedef DigraphAdaptorExtender<ReverseDigraphBase<GR> > Parent; 379 typedef DGR Digraph; 376 380 protected: 377 381 ReverseDigraph() { } … … 381 385 /// 382 386 /// Creates a reverse digraph adaptor for the given digraph. 383 explicit ReverseDigraph(D igraph& digraph) {384 Parent:: setDigraph(digraph);387 explicit ReverseDigraph(DGR& digraph) { 388 Parent::initialize(digraph); 385 389 } 386 390 }; … … 391 395 /// \ingroup graph_adaptors 392 396 /// \relates ReverseDigraph 393 template<typename GR>394 ReverseDigraph<const GR> reverseDigraph(constGR& digraph) {395 return ReverseDigraph<const GR>(digraph);397 template<typename DGR> 398 ReverseDigraph<const DGR> reverseDigraph(const DGR& digraph) { 399 return ReverseDigraph<const DGR>(digraph); 396 400 } 397 401 398 402 399 template <typename _Digraph, typename _NodeFilterMap,400 typename _ArcFilterMap, bool _checked = true>401 class SubDigraphBase : public DigraphAdaptorBase<_Digraph> {402 public: 403 typedef _DigraphDigraph;404 typedef _NodeFilterMapNodeFilterMap;405 typedef _ArcFilterMapArcFilterMap;403 template <typename DGR, typename NF, typename AF, bool ch = true> 404 class SubDigraphBase : public DigraphAdaptorBase<DGR> { 405 typedef DigraphAdaptorBase<DGR> Parent; 406 public: 407 typedef DGR Digraph; 408 typedef NF NodeFilterMap; 409 typedef AF ArcFilterMap; 406 410 407 411 typedef SubDigraphBase Adaptor; 408 typedef DigraphAdaptorBase<_Digraph> Parent;409 412 protected: 410 N odeFilterMap* _node_filter;411 A rcFilterMap* _arc_filter;413 NF* _node_filter; 414 AF* _arc_filter; 412 415 SubDigraphBase() 413 416 : Parent(), _node_filter(0), _arc_filter(0) { } 414 417 415 void setNodeFilterMap(NodeFilterMap& node_filter) { 418 void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) { 419 Parent::initialize(digraph); 416 420 _node_filter = &node_filter; 417 } 418 void setArcFilterMap(ArcFilterMap& arc_filter) { 419 _arc_filter = &arc_filter; 421 _arc_filter = &arc_filter; 420 422 } 421 423 … … 488 490 typedef False ArcNumTag; 489 491 490 typedef FindArcTagIndicator<D igraph> FindArcTag;492 typedef FindArcTagIndicator<DGR> FindArcTag; 491 493 Arc findArc(const Node& source, const Node& target, 492 494 const Arc& prev = INVALID) const { … … 501 503 } 502 504 503 template <typename _Value> 504 class NodeMap : public SubMapExtender<Adaptor, 505 typename Parent::template NodeMap<_Value> > { 505 public: 506 507 template <typename V> 508 class NodeMap 509 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 510 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 511 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 512 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 513 506 514 public: 507 typedef _Value Value; 508 typedef SubMapExtender<Adaptor, typename Parent:: 509 template NodeMap<Value> > MapParent; 510 511 NodeMap(const Adaptor& adaptor) 512 : MapParent(adaptor) {} 513 NodeMap(const Adaptor& adaptor, const Value& value) 514 : MapParent(adaptor, value) {} 515 typedef V Value; 516 517 NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor) 518 : Parent(adaptor) {} 519 NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor, const V& value) 520 : Parent(adaptor, value) {} 515 521 516 522 private: … … 521 527 template <typename CMap> 522 528 NodeMap& operator=(const CMap& cmap) { 523 MapParent::operator=(cmap);529 Parent::operator=(cmap); 524 530 return *this; 525 531 } 526 532 }; 527 533 528 template <typename _Value> 529 class ArcMap : public SubMapExtender<Adaptor, 530 typename Parent::template ArcMap<_Value> > { 534 template <typename V> 535 class ArcMap 536 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 537 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { 538 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 539 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; 540 531 541 public: 532 typedef _Value Value; 533 typedef SubMapExtender<Adaptor, typename Parent:: 534 template ArcMap<Value> > MapParent; 535 536 ArcMap(const Adaptor& adaptor) 537 : MapParent(adaptor) {} 538 ArcMap(const Adaptor& adaptor, const Value& value) 539 : MapParent(adaptor, value) {} 542 typedef V Value; 543 544 ArcMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor) 545 : Parent(adaptor) {} 546 ArcMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor, const V& value) 547 : Parent(adaptor, value) {} 540 548 541 549 private: … … 546 554 template <typename CMap> 547 555 ArcMap& operator=(const CMap& cmap) { 548 MapParent::operator=(cmap);556 Parent::operator=(cmap); 549 557 return *this; 550 558 } … … 553 561 }; 554 562 555 template <typename _Digraph, typename _NodeFilterMap, typename _ArcFilterMap> 556 class SubDigraphBase<_Digraph, _NodeFilterMap, _ArcFilterMap, false> 557 : public DigraphAdaptorBase<_Digraph> { 558 public: 559 typedef _Digraph Digraph; 560 typedef _NodeFilterMap NodeFilterMap; 561 typedef _ArcFilterMap ArcFilterMap; 563 template <typename DGR, typename NF, typename AF> 564 class SubDigraphBase<DGR, NF, AF, false> 565 : public DigraphAdaptorBase<DGR> { 566 typedef DigraphAdaptorBase<DGR> Parent; 567 public: 568 typedef DGR Digraph; 569 typedef NF NodeFilterMap; 570 typedef AF ArcFilterMap; 562 571 563 572 typedef SubDigraphBase Adaptor; 564 typedef DigraphAdaptorBase<Digraph> Parent;565 573 protected: 566 N odeFilterMap* _node_filter;567 A rcFilterMap* _arc_filter;574 NF* _node_filter; 575 AF* _arc_filter; 568 576 SubDigraphBase() 569 577 : Parent(), _node_filter(0), _arc_filter(0) { } 570 578 571 void setNodeFilterMap(NodeFilterMap& node_filter) { 579 void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) { 580 Parent::initialize(digraph); 572 581 _node_filter = &node_filter; 573 } 574 void setArcFilterMap(ArcFilterMap& arc_filter) { 575 _arc_filter = &arc_filter; 582 _arc_filter = &arc_filter; 576 583 } 577 584 … … 628 635 typedef False ArcNumTag; 629 636 630 typedef FindArcTagIndicator<D igraph> FindArcTag;637 typedef FindArcTagIndicator<DGR> FindArcTag; 631 638 Arc findArc(const Node& source, const Node& target, 632 639 const Arc& prev = INVALID) const { … … 641 648 } 642 649 643 template <typename _Value> 644 class NodeMap : public SubMapExtender<Adaptor, 645 typename Parent::template NodeMap<_Value> > { 650 template <typename V> 651 class NodeMap 652 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 653 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 654 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 655 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 656 646 657 public: 647 typedef _Value Value; 648 typedef SubMapExtender<Adaptor, typename Parent:: 649 template NodeMap<Value> > MapParent; 650 651 NodeMap(const Adaptor& adaptor) 652 : MapParent(adaptor) {} 653 NodeMap(const Adaptor& adaptor, const Value& value) 654 : MapParent(adaptor, value) {} 658 typedef V Value; 659 660 NodeMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor) 661 : Parent(adaptor) {} 662 NodeMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor, const V& value) 663 : Parent(adaptor, value) {} 655 664 656 665 private: … … 661 670 template <typename CMap> 662 671 NodeMap& operator=(const CMap& cmap) { 663 MapParent::operator=(cmap);672 Parent::operator=(cmap); 664 673 return *this; 665 674 } 666 675 }; 667 676 668 template <typename _Value> 669 class ArcMap : public SubMapExtender<Adaptor, 670 typename Parent::template ArcMap<_Value> > { 677 template <typename V> 678 class ArcMap 679 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 680 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { 681 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 682 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; 683 671 684 public: 672 typedef _Value Value; 673 typedef SubMapExtender<Adaptor, typename Parent:: 674 template ArcMap<Value> > MapParent; 675 676 ArcMap(const Adaptor& adaptor) 677 : MapParent(adaptor) {} 678 ArcMap(const Adaptor& adaptor, const Value& value) 679 : MapParent(adaptor, value) {} 685 typedef V Value; 686 687 ArcMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor) 688 : Parent(adaptor) {} 689 ArcMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor, const V& value) 690 : Parent(adaptor, value) {} 680 691 681 692 private: … … 686 697 template <typename CMap> 687 698 ArcMap& operator=(const CMap& cmap) { 688 MapParent::operator=(cmap);699 Parent::operator=(cmap); 689 700 return *this; 690 701 } … … 709 720 /// parameter is set to be \c const. 710 721 /// 711 /// \tparam GR The type of the adapted digraph.722 /// \tparam DGR The type of the adapted digraph. 712 723 /// It must conform to the \ref concepts::Digraph "Digraph" concept. 713 724 /// It can also be specified to be \c const. … … 715 726 /// It must be a \c bool (or convertible) node map of the 716 727 /// adapted digraph. The default type is 717 /// \ref concepts::Digraph::NodeMap " GR::NodeMap<bool>".728 /// \ref concepts::Digraph::NodeMap "DGR::NodeMap<bool>". 718 729 /// \tparam AF The type of the arc filter map. 719 730 /// It must be \c bool (or convertible) arc map of the 720 731 /// adapted digraph. The default type is 721 /// \ref concepts::Digraph::ArcMap " GR::ArcMap<bool>".732 /// \ref concepts::Digraph::ArcMap "DGR::ArcMap<bool>". 722 733 /// 723 734 /// \note The \c Node and \c Arc types of this adaptor and the adapted … … 727 738 /// \see FilterArcs 728 739 #ifdef DOXYGEN 729 template<typename GR, typename NF, typename AF>740 template<typename DGR, typename NF, typename AF> 730 741 class SubDigraph { 731 742 #else 732 template<typename GR,733 typename NF = typename GR::template NodeMap<bool>,734 typename AF = typename GR::template ArcMap<bool> >743 template<typename DGR, 744 typename NF = typename DGR::template NodeMap<bool>, 745 typename AF = typename DGR::template ArcMap<bool> > 735 746 class SubDigraph : 736 public DigraphAdaptorExtender<SubDigraphBase< GR, NF, AF, true> > {747 public DigraphAdaptorExtender<SubDigraphBase<DGR, NF, AF, true> > { 737 748 #endif 738 749 public: 739 750 /// The type of the adapted digraph. 740 typedef GR Digraph;751 typedef DGR Digraph; 741 752 /// The type of the node filter map. 742 753 typedef NF NodeFilterMap; … … 744 755 typedef AF ArcFilterMap; 745 756 746 typedef DigraphAdaptorExtender<SubDigraphBase< GR, NF, AF, true> >757 typedef DigraphAdaptorExtender<SubDigraphBase<DGR, NF, AF, true> > 747 758 Parent; 748 759 … … 758 769 /// Creates a subdigraph for the given digraph with the 759 770 /// given node and arc filter maps. 760 SubDigraph(Digraph& digraph, NodeFilterMap& node_filter, 761 ArcFilterMap& arc_filter) { 762 setDigraph(digraph); 763 setNodeFilterMap(node_filter); 764 setArcFilterMap(arc_filter); 771 SubDigraph(DGR& digraph, NF& node_filter, AF& arc_filter) { 772 Parent::initialize(digraph, node_filter, arc_filter); 765 773 } 766 774 … … 824 832 /// \ingroup graph_adaptors 825 833 /// \relates SubDigraph 826 template<typename GR, typename NF, typename AF>827 SubDigraph<const GR, NF, AF>828 subDigraph(const GR& digraph,829 NF& node_filter _map, AF& arc_filter_map) {830 return SubDigraph<const GR, NF, AF>831 (digraph, node_filter _map, arc_filter_map);834 template<typename DGR, typename NF, typename AF> 835 SubDigraph<const DGR, NF, AF> 836 subDigraph(const DGR& digraph, 837 NF& node_filter, AF& arc_filter) { 838 return SubDigraph<const DGR, NF, AF> 839 (digraph, node_filter, arc_filter); 832 840 } 833 841 834 template<typename GR, typename NF, typename AF>835 SubDigraph<const GR, const NF, AF>836 subDigraph(const GR& digraph,837 const NF& node_filter _map, AF& arc_filter_map) {838 return SubDigraph<const GR, const NF, AF>839 (digraph, node_filter _map, arc_filter_map);842 template<typename DGR, typename NF, typename AF> 843 SubDigraph<const DGR, const NF, AF> 844 subDigraph(const DGR& digraph, 845 const NF& node_filter, AF& arc_filter) { 846 return SubDigraph<const DGR, const NF, AF> 847 (digraph, node_filter, arc_filter); 840 848 } 841 849 842 template<typename GR, typename NF, typename AF>843 SubDigraph<const GR, NF, const AF>844 subDigraph(const GR& digraph,845 NF& node_filter _map, const AF& arc_filter_map) {846 return SubDigraph<const GR, NF, const AF>847 (digraph, node_filter _map, arc_filter_map);850 template<typename DGR, typename NF, typename AF> 851 SubDigraph<const DGR, NF, const AF> 852 subDigraph(const DGR& digraph, 853 NF& node_filter, const AF& arc_filter) { 854 return SubDigraph<const DGR, NF, const AF> 855 (digraph, node_filter, arc_filter); 848 856 } 849 857 850 template<typename GR, typename NF, typename AF>851 SubDigraph<const GR, const NF, const AF>852 subDigraph(const GR& digraph,853 const NF& node_filter _map, const AF& arc_filter_map) {854 return SubDigraph<const GR, const NF, const AF>855 (digraph, node_filter _map, arc_filter_map);858 template<typename DGR, typename NF, typename AF> 859 SubDigraph<const DGR, const NF, const AF> 860 subDigraph(const DGR& digraph, 861 const NF& node_filter, const AF& arc_filter) { 862 return SubDigraph<const DGR, const NF, const AF> 863 (digraph, node_filter, arc_filter); 856 864 } 857 865 858 866 859 template <typename _Graph, typename _NodeFilterMap,860 typename _EdgeFilterMap, bool _checked = true>861 class SubGraphBase : public GraphAdaptorBase<_Graph> {862 public: 863 typedef _GraphGraph;864 typedef _NodeFilterMapNodeFilterMap;865 typedef _EdgeFilterMapEdgeFilterMap;867 template <typename GR, typename NF, typename EF, bool ch = true> 868 class SubGraphBase : public GraphAdaptorBase<GR> { 869 typedef GraphAdaptorBase<GR> Parent; 870 public: 871 typedef GR Graph; 872 typedef NF NodeFilterMap; 873 typedef EF EdgeFilterMap; 866 874 867 875 typedef SubGraphBase Adaptor; 868 typedef GraphAdaptorBase<_Graph> Parent;869 876 protected: 870 877 871 N odeFilterMap* _node_filter_map;872 E dgeFilterMap* _edge_filter_map;878 NF* _node_filter; 879 EF* _edge_filter; 873 880 874 881 SubGraphBase() 875 : Parent(), _node_filter_map(0), _edge_filter_map(0) { } 876 877 void setNodeFilterMap(NodeFilterMap& node_filter_map) { 878 _node_filter_map=&node_filter_map; 879 } 880 void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) { 881 _edge_filter_map=&edge_filter_map; 882 : Parent(), _node_filter(0), _edge_filter(0) { } 883 884 void initialize(GR& graph, NF& node_filter, EF& edge_filter) { 885 Parent::initialize(graph); 886 _node_filter = &node_filter; 887 _edge_filter = &edge_filter; 882 888 } 883 889 … … 890 896 void first(Node& i) const { 891 897 Parent::first(i); 892 while (i!=INVALID && !(*_node_filter _map)[i]) Parent::next(i);898 while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i); 893 899 } 894 900 895 901 void first(Arc& i) const { 896 902 Parent::first(i); 897 while (i!=INVALID && (!(*_edge_filter _map)[i]898 || !(*_node_filter _map)[Parent::source(i)]899 || !(*_node_filter _map)[Parent::target(i)]))903 while (i!=INVALID && (!(*_edge_filter)[i] 904 || !(*_node_filter)[Parent::source(i)] 905 || !(*_node_filter)[Parent::target(i)])) 900 906 Parent::next(i); 901 907 } … … 903 909 void first(Edge& i) const { 904 910 Parent::first(i); 905 while (i!=INVALID && (!(*_edge_filter _map)[i]906 || !(*_node_filter _map)[Parent::u(i)]907 || !(*_node_filter _map)[Parent::v(i)]))911 while (i!=INVALID && (!(*_edge_filter)[i] 912 || !(*_node_filter)[Parent::u(i)] 913 || !(*_node_filter)[Parent::v(i)])) 908 914 Parent::next(i); 909 915 } … … 911 917 void firstIn(Arc& i, const Node& n) const { 912 918 Parent::firstIn(i, n); 913 while (i!=INVALID && (!(*_edge_filter _map)[i]914 || !(*_node_filter _map)[Parent::source(i)]))919 while (i!=INVALID && (!(*_edge_filter)[i] 920 || !(*_node_filter)[Parent::source(i)])) 915 921 Parent::nextIn(i); 916 922 } … … 918 924 void firstOut(Arc& i, const Node& n) const { 919 925 Parent::firstOut(i, n); 920 while (i!=INVALID && (!(*_edge_filter _map)[i]921 || !(*_node_filter _map)[Parent::target(i)]))926 while (i!=INVALID && (!(*_edge_filter)[i] 927 || !(*_node_filter)[Parent::target(i)])) 922 928 Parent::nextOut(i); 923 929 } … … 925 931 void firstInc(Edge& i, bool& d, const Node& n) const { 926 932 Parent::firstInc(i, d, n); 927 while (i!=INVALID && (!(*_edge_filter _map)[i]928 || !(*_node_filter _map)[Parent::u(i)]929 || !(*_node_filter _map)[Parent::v(i)]))933 while (i!=INVALID && (!(*_edge_filter)[i] 934 || !(*_node_filter)[Parent::u(i)] 935 || !(*_node_filter)[Parent::v(i)])) 930 936 Parent::nextInc(i, d); 931 937 } … … 933 939 void next(Node& i) const { 934 940 Parent::next(i); 935 while (i!=INVALID && !(*_node_filter _map)[i]) Parent::next(i);941 while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i); 936 942 } 937 943 938 944 void next(Arc& i) const { 939 945 Parent::next(i); 940 while (i!=INVALID && (!(*_edge_filter _map)[i]941 || !(*_node_filter _map)[Parent::source(i)]942 || !(*_node_filter _map)[Parent::target(i)]))946 while (i!=INVALID && (!(*_edge_filter)[i] 947 || !(*_node_filter)[Parent::source(i)] 948 || !(*_node_filter)[Parent::target(i)])) 943 949 Parent::next(i); 944 950 } … … 946 952 void next(Edge& i) const { 947 953 Parent::next(i); 948 while (i!=INVALID && (!(*_edge_filter _map)[i]949 || !(*_node_filter _map)[Parent::u(i)]950 || !(*_node_filter _map)[Parent::v(i)]))954 while (i!=INVALID && (!(*_edge_filter)[i] 955 || !(*_node_filter)[Parent::u(i)] 956 || !(*_node_filter)[Parent::v(i)])) 951 957 Parent::next(i); 952 958 } … … 954 960 void nextIn(Arc& i) const { 955 961 Parent::nextIn(i); 956 while (i!=INVALID && (!(*_edge_filter _map)[i]957 || !(*_node_filter _map)[Parent::source(i)]))962 while (i!=INVALID && (!(*_edge_filter)[i] 963 || !(*_node_filter)[Parent::source(i)])) 958 964 Parent::nextIn(i); 959 965 } … … 961 967 void nextOut(Arc& i) const { 962 968 Parent::nextOut(i); 963 while (i!=INVALID && (!(*_edge_filter _map)[i]964 || !(*_node_filter _map)[Parent::target(i)]))969 while (i!=INVALID && (!(*_edge_filter)[i] 970 || !(*_node_filter)[Parent::target(i)])) 965 971 Parent::nextOut(i); 966 972 } … … 968 974 void nextInc(Edge& i, bool& d) const { 969 975 Parent::nextInc(i, d); 970 while (i!=INVALID && (!(*_edge_filter _map)[i]971 || !(*_node_filter _map)[Parent::u(i)]972 || !(*_node_filter _map)[Parent::v(i)]))976 while (i!=INVALID && (!(*_edge_filter)[i] 977 || !(*_node_filter)[Parent::u(i)] 978 || !(*_node_filter)[Parent::v(i)])) 973 979 Parent::nextInc(i, d); 974 980 } 975 981 976 void status(const Node& n, bool v) const { _node_filter _map->set(n, v); }977 void status(const Edge& e, bool v) const { _edge_filter _map->set(e, v); }978 979 bool status(const Node& n) const { return (*_node_filter _map)[n]; }980 bool status(const Edge& e) const { return (*_edge_filter _map)[e]; }982 void status(const Node& n, bool v) const { _node_filter->set(n, v); } 983 void status(const Edge& e, bool v) const { _edge_filter->set(e, v); } 984 985 bool status(const Node& n) const { return (*_node_filter)[n]; } 986 bool status(const Edge& e) const { return (*_edge_filter)[e]; } 981 987 982 988 typedef False NodeNumTag; … … 987 993 Arc findArc(const Node& u, const Node& v, 988 994 const Arc& prev = INVALID) const { 989 if (!(*_node_filter _map)[u] || !(*_node_filter_map)[v]) {995 if (!(*_node_filter)[u] || !(*_node_filter)[v]) { 990 996 return INVALID; 991 997 } 992 998 Arc arc = Parent::findArc(u, v, prev); 993 while (arc != INVALID && !(*_edge_filter _map)[arc]) {999 while (arc != INVALID && !(*_edge_filter)[arc]) { 994 1000 arc = Parent::findArc(u, v, arc); 995 1001 } … … 1000 1006 Edge findEdge(const Node& u, const Node& v, 1001 1007 const Edge& prev = INVALID) const { 1002 if (!(*_node_filter _map)[u] || !(*_node_filter_map)[v]) {1008 if (!(*_node_filter)[u] || !(*_node_filter)[v]) { 1003 1009 return INVALID; 1004 1010 } 1005 1011 Edge edge = Parent::findEdge(u, v, prev); 1006 while (edge != INVALID && !(*_edge_filter _map)[edge]) {1012 while (edge != INVALID && !(*_edge_filter)[edge]) { 1007 1013 edge = Parent::findEdge(u, v, edge); 1008 1014 } … … 1010 1016 } 1011 1017 1012 template <typename _Value> 1013 class NodeMap : public SubMapExtender<Adaptor, 1014 typename Parent::template NodeMap<_Value> > { 1018 template <typename V> 1019 class NodeMap 1020 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1021 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1022 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1023 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1024 1015 1025 public: 1016 typedef _Value Value; 1017 typedef SubMapExtender<Adaptor, typename Parent:: 1018 template NodeMap<Value> > MapParent; 1019 1020 NodeMap(const Adaptor& adaptor) 1021 : MapParent(adaptor) {} 1022 NodeMap(const Adaptor& adaptor, const Value& value) 1023 : MapParent(adaptor, value) {} 1026 typedef V Value; 1027 1028 NodeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) 1029 : Parent(adaptor) {} 1030 NodeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor, const V& value) 1031 : Parent(adaptor, value) {} 1024 1032 1025 1033 private: … … 1030 1038 template <typename CMap> 1031 1039 NodeMap& operator=(const CMap& cmap) { 1032 MapParent::operator=(cmap);1040 Parent::operator=(cmap); 1033 1041 return *this; 1034 1042 } 1035 1043 }; 1036 1044 1037 template <typename _Value> 1038 class ArcMap : public SubMapExtender<Adaptor, 1039 typename Parent::template ArcMap<_Value> > { 1045 template <typename V> 1046 class ArcMap 1047 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1048 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1049 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1050 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1051 1040 1052 public: 1041 typedef _Value Value; 1042 typedef SubMapExtender<Adaptor, typename Parent:: 1043 template ArcMap<Value> > MapParent; 1044 1045 ArcMap(const Adaptor& adaptor) 1046 : MapParent(adaptor) {} 1047 ArcMap(const Adaptor& adaptor, const Value& value) 1048 : MapParent(adaptor, value) {} 1053 typedef V Value; 1054 1055 ArcMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) 1056 : Parent(adaptor) {} 1057 ArcMap(const SubGraphBase<GR, NF, EF, ch>& adaptor, const V& value) 1058 : Parent(adaptor, value) {} 1049 1059 1050 1060 private: … … 1055 1065 template <typename CMap> 1056 1066 ArcMap& operator=(const CMap& cmap) { 1057 MapParent::operator=(cmap);1067 Parent::operator=(cmap); 1058 1068 return *this; 1059 1069 } 1060 1070 }; 1061 1071 1062 template <typename _Value> 1063 class EdgeMap : public SubMapExtender<Adaptor, 1064 typename Parent::template EdgeMap<_Value> > { 1072 template <typename V> 1073 class EdgeMap 1074 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1075 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1076 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1077 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1078 1065 1079 public: 1066 typedef _Value Value; 1067 typedef SubMapExtender<Adaptor, typename Parent:: 1068 template EdgeMap<Value> > MapParent; 1069 1070 EdgeMap(const Adaptor& adaptor) 1071 : MapParent(adaptor) {} 1072 1073 EdgeMap(const Adaptor& adaptor, const Value& value) 1074 : MapParent(adaptor, value) {} 1080 typedef V Value; 1081 1082 EdgeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) 1083 : Parent(adaptor) {} 1084 1085 EdgeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor, const V& value) 1086 : Parent(adaptor, value) {} 1075 1087 1076 1088 private: … … 1081 1093 template <typename CMap> 1082 1094 EdgeMap& operator=(const CMap& cmap) { 1083 MapParent::operator=(cmap);1095 Parent::operator=(cmap); 1084 1096 return *this; 1085 1097 } … … 1088 1100 }; 1089 1101 1090 template <typename _Graph, typename _NodeFilterMap, typename _EdgeFilterMap> 1091 class SubGraphBase<_Graph, _NodeFilterMap, _EdgeFilterMap, false> 1092 : public GraphAdaptorBase<_Graph> { 1093 public: 1094 typedef _Graph Graph; 1095 typedef _NodeFilterMap NodeFilterMap; 1096 typedef _EdgeFilterMap EdgeFilterMap; 1102 template <typename GR, typename NF, typename EF> 1103 class SubGraphBase<GR, NF, EF, false> 1104 : public GraphAdaptorBase<GR> { 1105 typedef GraphAdaptorBase<GR> Parent; 1106 public: 1107 typedef GR Graph; 1108 typedef NF NodeFilterMap; 1109 typedef EF EdgeFilterMap; 1097 1110 1098 1111 typedef SubGraphBase Adaptor; 1099 typedef GraphAdaptorBase<_Graph> Parent;1100 1112 protected: 1101 NodeFilterMap* _node_filter_map; 1102 EdgeFilterMap* _edge_filter_map; 1103 SubGraphBase() : Parent(), 1104 _node_filter_map(0), _edge_filter_map(0) { } 1105 1106 void setNodeFilterMap(NodeFilterMap& node_filter_map) { 1107 _node_filter_map=&node_filter_map; 1108 } 1109 void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) { 1110 _edge_filter_map=&edge_filter_map; 1113 NF* _node_filter; 1114 EF* _edge_filter; 1115 SubGraphBase() 1116 : Parent(), _node_filter(0), _edge_filter(0) { } 1117 1118 void initialize(GR& graph, NF& node_filter, EF& edge_filter) { 1119 Parent::initialize(graph); 1120 _node_filter = &node_filter; 1121 _edge_filter = &edge_filter; 1111 1122 } 1112 1123 … … 1119 1130 void first(Node& i) const { 1120 1131 Parent::first(i); 1121 while (i!=INVALID && !(*_node_filter _map)[i]) Parent::next(i);1132 while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i); 1122 1133 } 1123 1134 1124 1135 void first(Arc& i) const { 1125 1136 Parent::first(i); 1126 while (i!=INVALID && !(*_edge_filter _map)[i]) Parent::next(i);1137 while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i); 1127 1138 } 1128 1139 1129 1140 void first(Edge& i) const { 1130 1141 Parent::first(i); 1131 while (i!=INVALID && !(*_edge_filter _map)[i]) Parent::next(i);1142 while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i); 1132 1143 } 1133 1144 1134 1145 void firstIn(Arc& i, const Node& n) const { 1135 1146 Parent::firstIn(i, n); 1136 while (i!=INVALID && !(*_edge_filter _map)[i]) Parent::nextIn(i);1147 while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextIn(i); 1137 1148 } 1138 1149 1139 1150 void firstOut(Arc& i, const Node& n) const { 1140 1151 Parent::firstOut(i, n); 1141 while (i!=INVALID && !(*_edge_filter _map)[i]) Parent::nextOut(i);1152 while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextOut(i); 1142 1153 } 1143 1154 1144 1155 void firstInc(Edge& i, bool& d, const Node& n) const { 1145 1156 Parent::firstInc(i, d, n); 1146 while (i!=INVALID && !(*_edge_filter _map)[i]) Parent::nextInc(i, d);1157 while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextInc(i, d); 1147 1158 } 1148 1159 1149 1160 void next(Node& i) const { 1150 1161 Parent::next(i); 1151 while (i!=INVALID && !(*_node_filter _map)[i]) Parent::next(i);1162 while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i); 1152 1163 } 1153 1164 void next(Arc& i) const { 1154 1165 Parent::next(i); 1155 while (i!=INVALID && !(*_edge_filter _map)[i]) Parent::next(i);1166 while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i); 1156 1167 } 1157 1168 void next(Edge& i) const { 1158 1169 Parent::next(i); 1159 while (i!=INVALID && !(*_edge_filter _map)[i]) Parent::next(i);1170 while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i); 1160 1171 } 1161 1172 void nextIn(Arc& i) const { 1162 1173 Parent::nextIn(i); 1163 while (i!=INVALID && !(*_edge_filter _map)[i]) Parent::nextIn(i);1174 while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextIn(i); 1164 1175 } 1165 1176 1166 1177 void nextOut(Arc& i) const { 1167 1178 Parent::nextOut(i); 1168 while (i!=INVALID && !(*_edge_filter _map)[i]) Parent::nextOut(i);1179 while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextOut(i); 1169 1180 } 1170 1181 void nextInc(Edge& i, bool& d) const { 1171 1182 Parent::nextInc(i, d); 1172 while (i!=INVALID && !(*_edge_filter _map)[i]) Parent::nextInc(i, d);1173 } 1174 1175 void status(const Node& n, bool v) const { _node_filter _map->set(n, v); }1176 void status(const Edge& e, bool v) const { _edge_filter _map->set(e, v); }1177 1178 bool status(const Node& n) const { return (*_node_filter _map)[n]; }1179 bool status(const Edge& e) const { return (*_edge_filter _map)[e]; }1183 while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextInc(i, d); 1184 } 1185 1186 void status(const Node& n, bool v) const { _node_filter->set(n, v); } 1187 void status(const Edge& e, bool v) const { _edge_filter->set(e, v); } 1188 1189 bool status(const Node& n) const { return (*_node_filter)[n]; } 1190 bool status(const Edge& e) const { return (*_edge_filter)[e]; } 1180 1191 1181 1192 typedef False NodeNumTag; … … 1187 1198 const Arc& prev = INVALID) const { 1188 1199 Arc arc = Parent::findArc(u, v, prev); 1189 while (arc != INVALID && !(*_edge_filter _map)[arc]) {1200 while (arc != INVALID && !(*_edge_filter)[arc]) { 1190 1201 arc = Parent::findArc(u, v, arc); 1191 1202 } … … 1197 1208 const Edge& prev = INVALID) const { 1198 1209 Edge edge = Parent::findEdge(u, v, prev); 1199 while (edge != INVALID && !(*_edge_filter _map)[edge]) {1210 while (edge != INVALID && !(*_edge_filter)[edge]) { 1200 1211 edge = Parent::findEdge(u, v, edge); 1201 1212 } … … 1203 1214 } 1204 1215 1205 template <typename _Value> 1206 class NodeMap : public SubMapExtender<Adaptor, 1207 typename Parent::template NodeMap<_Value> > { 1216 template <typename V> 1217 class NodeMap 1218 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1219 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1220 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1221 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1222 1208 1223 public: 1209 typedef _Value Value; 1210 typedef SubMapExtender<Adaptor, typename Parent:: 1211 template NodeMap<Value> > MapParent; 1212 1213 NodeMap(const Adaptor& adaptor) 1214 : MapParent(adaptor) {} 1215 NodeMap(const Adaptor& adaptor, const Value& value) 1216 : MapParent(adaptor, value) {} 1224 typedef V Value; 1225 1226 NodeMap(const SubGraphBase<GR, NF, EF, false>& adaptor) 1227 : Parent(adaptor) {} 1228 NodeMap(const SubGraphBase<GR, NF, EF, false>& adaptor, const V& value) 1229 : Parent(adaptor, value) {} 1217 1230 1218 1231 private: … … 1223 1236 template <typename CMap> 1224 1237 NodeMap& operator=(const CMap& cmap) { 1225 MapParent::operator=(cmap);1238 Parent::operator=(cmap); 1226 1239 return *this; 1227 1240 } 1228 1241 }; 1229 1242 1230 template <typename _Value> 1231 class ArcMap : public SubMapExtender<Adaptor, 1232 typename Parent::template ArcMap<_Value> > { 1243 template <typename V> 1244 class ArcMap 1245 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1246 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1247 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1248 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1249 1233 1250 public: 1234 typedef _Value Value; 1235 typedef SubMapExtender<Adaptor, typename Parent:: 1236 template ArcMap<Value> > MapParent; 1237 1238 ArcMap(const Adaptor& adaptor) 1239 : MapParent(adaptor) {} 1240 ArcMap(const Adaptor& adaptor, const Value& value) 1241 : MapParent(adaptor, value) {} 1251 typedef V Value; 1252 1253 ArcMap(const SubGraphBase<GR, NF, EF, false>& adaptor) 1254 : Parent(adaptor) {} 1255 ArcMap(const SubGraphBase<GR, NF, EF, false>& adaptor, const V& value) 1256 : Parent(adaptor, value) {} 1242 1257 1243 1258 private: … … 1248 1263 template <typename CMap> 1249 1264 ArcMap& operator=(const CMap& cmap) { 1250 MapParent::operator=(cmap);1265 Parent::operator=(cmap); 1251 1266 return *this; 1252 1267 } 1253 1268 }; 1254 1269 1255 template <typename _Value> 1256 class EdgeMap : public SubMapExtender<Adaptor, 1257 typename Parent::template EdgeMap<_Value> > { 1270 template <typename V> 1271 class EdgeMap 1272 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1273 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1274 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1275 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1276 1258 1277 public: 1259 typedef _Value Value; 1260 typedef SubMapExtender<Adaptor, typename Parent:: 1261 template EdgeMap<Value> > MapParent; 1262 1263 EdgeMap(const Adaptor& adaptor) 1264 : MapParent(adaptor) {} 1265 1266 EdgeMap(const Adaptor& adaptor, const _Value& value) 1267 : MapParent(adaptor, value) {} 1278 typedef V Value; 1279 1280 EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor) 1281 : Parent(adaptor) {} 1282 1283 EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor, const V& value) 1284 : Parent(adaptor, value) {} 1268 1285 1269 1286 private: … … 1274 1291 template <typename CMap> 1275 1292 EdgeMap& operator=(const CMap& cmap) { 1276 MapParent::operator=(cmap);1293 Parent::operator=(cmap); 1277 1294 return *this; 1278 1295 } … … 1333 1350 typedef EF EdgeFilterMap; 1334 1351 1335 typedef GraphAdaptorExtender< 1352 typedef GraphAdaptorExtender<SubGraphBase<GR, NF, EF, true> > 1336 1353 Parent; 1337 1354 … … 1347 1364 /// Creates a subgraph for the given graph with the given node 1348 1365 /// and edge filter maps. 1349 SubGraph(Graph& graph, NodeFilterMap& node_filter_map, 1350 EdgeFilterMap& edge_filter_map) { 1351 setGraph(graph); 1352 setNodeFilterMap(node_filter_map); 1353 setEdgeFilterMap(edge_filter_map); 1366 SubGraph(GR& graph, NF& node_filter, EF& edge_filter) { 1367 initialize(graph, node_filter, edge_filter); 1354 1368 } 1355 1369 … … 1415 1429 template<typename GR, typename NF, typename EF> 1416 1430 SubGraph<const GR, NF, EF> 1417 subGraph(const GR& graph, 1418 NF& node_filter_map, EF& edge_filter_map) { 1431 subGraph(const GR& graph, NF& node_filter, EF& edge_filter) { 1419 1432 return SubGraph<const GR, NF, EF> 1420 (graph, node_filter _map, edge_filter_map);1433 (graph, node_filter, edge_filter); 1421 1434 } 1422 1435 1423 1436 template<typename GR, typename NF, typename EF> 1424 1437 SubGraph<const GR, const NF, EF> 1425 subGraph(const GR& graph, 1426 const NF& node_filter_map, EF& edge_filter_map) { 1438 subGraph(const GR& graph, const NF& node_filter, EF& edge_filter) { 1427 1439 return SubGraph<const GR, const NF, EF> 1428 (graph, node_filter _map, edge_filter_map);1440 (graph, node_filter, edge_filter); 1429 1441 } 1430 1442 1431 1443 template<typename GR, typename NF, typename EF> 1432 1444 SubGraph<const GR, NF, const EF> 1433 subGraph(const GR& graph, 1434 NF& node_filter_map, const EF& edge_filter_map) { 1445 subGraph(const GR& graph, NF& node_filter, const EF& edge_filter) { 1435 1446 return SubGraph<const GR, NF, const EF> 1436 (graph, node_filter _map, edge_filter_map);1447 (graph, node_filter, edge_filter); 1437 1448 } 1438 1449 1439 1450 template<typename GR, typename NF, typename EF> 1440 1451 SubGraph<const GR, const NF, const EF> 1441 subGraph(const GR& graph, 1442 const NF& node_filter_map, const EF& edge_filter_map) { 1452 subGraph(const GR& graph, const NF& node_filter, const EF& edge_filter) { 1443 1453 return SubGraph<const GR, const NF, const EF> 1444 (graph, node_filter _map, edge_filter_map);1454 (graph, node_filter, edge_filter); 1445 1455 } 1446 1456 … … 1482 1492 class FilterNodes : 1483 1493 public DigraphAdaptorExtender< 1484 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, bool>, true> > { 1494 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 1495 true> > { 1485 1496 #endif 1497 typedef DigraphAdaptorExtender< 1498 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 1499 true> > Parent; 1500 1486 1501 public: 1487 1502 … … 1489 1504 typedef NF NodeFilterMap; 1490 1505 1491 typedef DigraphAdaptorExtender<1492 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, bool>, true> >1493 Parent;1494 1495 1506 typedef typename Parent::Node Node; 1496 1507 1497 1508 protected: 1498 ConstMap<typename Digraph::Arc, bool> const_true_map; 1499 1500 FilterNodes() : const_true_map(true) { 1501 Parent::setArcFilterMap(const_true_map); 1502 } 1509 ConstMap<typename Digraph::Arc, Const<bool, true> > const_true_map; 1510 1511 FilterNodes() : const_true_map() {} 1503 1512 1504 1513 public: … … 1508 1517 /// Creates a subgraph for the given digraph or graph with the 1509 1518 /// given node filter map. 1510 FilterNodes(GR& graph, N odeFilterMap& node_filter) :1511 Parent(), const_true_map(true)1519 FilterNodes(GR& graph, NF& node_filter) 1520 : Parent(), const_true_map() 1512 1521 { 1513 Parent::setDigraph(graph); 1514 Parent::setNodeFilterMap(node_filter); 1515 Parent::setArcFilterMap(const_true_map); 1522 Parent::initialize(graph, node_filter, const_true_map); 1516 1523 } 1517 1524 … … 1548 1555 typename enable_if<UndirectedTagIndicator<GR> >::type> : 1549 1556 public GraphAdaptorExtender< 1550 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, bool>, true> > { 1551 1552 public: 1557 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1558 true> > { 1559 1560 typedef GraphAdaptorExtender< 1561 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1562 true> > Parent; 1563 1564 public: 1565 1553 1566 typedef GR Graph; 1554 1567 typedef NF NodeFilterMap; 1555 typedef GraphAdaptorExtender<1556 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, bool>, true> >1557 Parent;1558 1568 1559 1569 typedef typename Parent::Node Node; 1570 1560 1571 protected: 1561 ConstMap<typename Graph::Edge, bool> const_true_map; 1562 1563 FilterNodes() : const_true_map(true) { 1564 Parent::setEdgeFilterMap(const_true_map); 1565 } 1566 1567 public: 1568 1569 FilterNodes(Graph& _graph, NodeFilterMap& node_filter_map) : 1570 Parent(), const_true_map(true) { 1571 Parent::setGraph(_graph); 1572 Parent::setNodeFilterMap(node_filter_map); 1573 Parent::setEdgeFilterMap(const_true_map); 1572 ConstMap<typename GR::Edge, Const<bool, true> > const_true_map; 1573 1574 FilterNodes() : const_true_map() {} 1575 1576 public: 1577 1578 FilterNodes(GR& graph, NodeFilterMap& node_filter) : 1579 Parent(), const_true_map() { 1580 Parent::initialize(graph, node_filter, const_true_map); 1574 1581 } 1575 1582 … … 1589 1596 template<typename GR, typename NF> 1590 1597 FilterNodes<const GR, NF> 1591 filterNodes(const GR& graph, NF& node_filter _map) {1592 return FilterNodes<const GR, NF>(graph, node_filter _map);1598 filterNodes(const GR& graph, NF& node_filter) { 1599 return FilterNodes<const GR, NF>(graph, node_filter); 1593 1600 } 1594 1601 1595 1602 template<typename GR, typename NF> 1596 1603 FilterNodes<const GR, const NF> 1597 filterNodes(const GR& graph, const NF& node_filter _map) {1598 return FilterNodes<const GR, const NF>(graph, node_filter _map);1604 filterNodes(const GR& graph, const NF& node_filter) { 1605 return FilterNodes<const GR, const NF>(graph, node_filter); 1599 1606 } 1600 1607 … … 1613 1620 /// parameter is set to be \c const. 1614 1621 /// 1615 /// \tparam GR The type of the adapted digraph.1622 /// \tparam DGR The type of the adapted digraph. 1616 1623 /// It must conform to the \ref concepts::Digraph "Digraph" concept. 1617 1624 /// It can also be specified to be \c const. … … 1619 1626 /// It must be a \c bool (or convertible) arc map of the 1620 1627 /// adapted digraph. The default type is 1621 /// \ref concepts::Digraph::ArcMap " GR::ArcMap<bool>".1628 /// \ref concepts::Digraph::ArcMap "DGR::ArcMap<bool>". 1622 1629 /// 1623 1630 /// \note The \c Node and \c Arc types of this adaptor and the adapted 1624 1631 /// digraph are convertible to each other. 1625 1632 #ifdef DOXYGEN 1626 template<typename GR,1633 template<typename DGR, 1627 1634 typename AF> 1628 1635 class FilterArcs { 1629 1636 #else 1630 template<typename GR,1631 typename AF = typename GR::template ArcMap<bool> >1637 template<typename DGR, 1638 typename AF = typename DGR::template ArcMap<bool> > 1632 1639 class FilterArcs : 1633 1640 public DigraphAdaptorExtender< 1634 SubDigraphBase<GR, ConstMap<typename GR::Node, bool>, AF, false> > { 1641 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 1642 AF, false> > { 1635 1643 #endif 1636 public: 1644 typedef DigraphAdaptorExtender< 1645 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 1646 AF, false> > Parent; 1647 1648 public: 1649 1637 1650 /// The type of the adapted digraph. 1638 typedef GR Digraph;1651 typedef DGR Digraph; 1639 1652 /// The type of the arc filter map. 1640 1653 typedef AF ArcFilterMap; 1641 1654 1642 typedef DigraphAdaptorExtender<1643 SubDigraphBase<GR, ConstMap<typename GR::Node, bool>, AF, false> >1644 Parent;1645 1646 1655 typedef typename Parent::Arc Arc; 1647 1656 1648 1657 protected: 1649 ConstMap<typename Digraph::Node, bool> const_true_map; 1650 1651 FilterArcs() : const_true_map(true) { 1652 Parent::setNodeFilterMap(const_true_map); 1653 } 1658 ConstMap<typename DGR::Node, Const<bool, true> > const_true_map; 1659 1660 FilterArcs() : const_true_map() {} 1654 1661 1655 1662 public: … … 1659 1666 /// Creates a subdigraph for the given digraph with the given arc 1660 1667 /// filter map. 1661 FilterArcs(Digraph& digraph, ArcFilterMap& arc_filter) 1662 : Parent(), const_true_map(true) { 1663 Parent::setDigraph(digraph); 1664 Parent::setNodeFilterMap(const_true_map); 1665 Parent::setArcFilterMap(arc_filter); 1668 FilterArcs(DGR& digraph, ArcFilterMap& arc_filter) 1669 : Parent(), const_true_map() { 1670 Parent::initialize(digraph, const_true_map, arc_filter); 1666 1671 } 1667 1672 … … 1699 1704 /// \ingroup graph_adaptors 1700 1705 /// \relates FilterArcs 1701 template<typename GR, typename AF>1702 FilterArcs<const GR, AF>1703 filterArcs(const GR& digraph, AF& arc_filter_map) {1704 return FilterArcs<const GR, AF>(digraph, arc_filter_map);1706 template<typename DGR, typename AF> 1707 FilterArcs<const DGR, AF> 1708 filterArcs(const DGR& digraph, AF& arc_filter) { 1709 return FilterArcs<const DGR, AF>(digraph, arc_filter); 1705 1710 } 1706 1711 1707 template<typename GR, typename AF>1708 FilterArcs<const GR, const AF>1709 filterArcs(const GR& digraph, const AF& arc_filter_map) {1710 return FilterArcs<const GR, const AF>(digraph, arc_filter_map);1712 template<typename DGR, typename AF> 1713 FilterArcs<const DGR, const AF> 1714 filterArcs(const DGR& digraph, const AF& arc_filter) { 1715 return FilterArcs<const DGR, const AF>(digraph, arc_filter); 1711 1716 } 1712 1717 … … 1744 1749 class FilterEdges : 1745 1750 public GraphAdaptorExtender< 1746 SubGraphBase<GR, ConstMap<typename GR::Node,bool>, EF, false> > { 1751 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 1752 EF, false> > { 1747 1753 #endif 1748 public: 1754 typedef GraphAdaptorExtender< 1755 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 1756 EF, false> > Parent; 1757 1758 public: 1759 1749 1760 /// The type of the adapted graph. 1750 1761 typedef GR Graph; … … 1752 1763 typedef EF EdgeFilterMap; 1753 1764 1754 typedef GraphAdaptorExtender<1755 SubGraphBase<GR, ConstMap<typename GR::Node,bool>, EF, false> >1756 Parent;1757 1758 1765 typedef typename Parent::Edge Edge; 1759 1766 1760 1767 protected: 1761 ConstMap<typename G raph::Node, bool> const_true_map;1768 ConstMap<typename GR::Node, Const<bool, true> > const_true_map; 1762 1769 1763 1770 FilterEdges() : const_true_map(true) { … … 1771 1778 /// Creates a subgraph for the given graph with the given edge 1772 1779 /// filter map. 1773 FilterEdges(Graph& graph, EdgeFilterMap& edge_filter_map) : 1774 Parent(), const_true_map(true) { 1775 Parent::setGraph(graph); 1776 Parent::setNodeFilterMap(const_true_map); 1777 Parent::setEdgeFilterMap(edge_filter_map); 1780 FilterEdges(GR& graph, EF& edge_filter) 1781 : Parent(), const_true_map() { 1782 Parent::initialize(graph, const_true_map, edge_filter); 1778 1783 } 1779 1784 … … 1813 1818 template<typename GR, typename EF> 1814 1819 FilterEdges<const GR, EF> 1815 filterEdges(const GR& graph, EF& edge_filter _map) {1816 return FilterEdges<const GR, EF>(graph, edge_filter _map);1820 filterEdges(const GR& graph, EF& edge_filter) { 1821 return FilterEdges<const GR, EF>(graph, edge_filter); 1817 1822 } 1818 1823 1819 1824 template<typename GR, typename EF> 1820 1825 FilterEdges<const GR, const EF> 1821 filterEdges(const GR& graph, const EF& edge_filter _map) {1822 return FilterEdges<const GR, const EF>(graph, edge_filter _map);1826 filterEdges(const GR& graph, const EF& edge_filter) { 1827 return FilterEdges<const GR, const EF>(graph, edge_filter); 1823 1828 } 1824 1829 1825 1830 1826 template <typename _Digraph>1831 template <typename DGR> 1827 1832 class UndirectorBase { 1828 1833 public: 1829 typedef _DigraphDigraph;1834 typedef DGR Digraph; 1830 1835 typedef UndirectorBase Adaptor; 1831 1836 … … 1835 1840 typedef typename Digraph::Node Node; 1836 1841 1837 class Arc : public Edge{1842 class Arc { 1838 1843 friend class UndirectorBase; 1839 1844 protected: 1845 Edge _edge; 1840 1846 bool _forward; 1841 1847 1842 Arc(const Edge& edge, bool forward) :1843 Edge(edge), _forward(forward) {}1848 Arc(const Edge& edge, bool forward) 1849 : _edge(edge), _forward(forward) {} 1844 1850 1845 1851 public: 1846 1852 Arc() {} 1847 1853 1848 Arc(Invalid) : Edge(INVALID), _forward(true) {} 1854 Arc(Invalid) : _edge(INVALID), _forward(true) {} 1855 1856 operator const Edge&() const { return _edge; } 1849 1857 1850 1858 bool operator==(const Arc &other) const { 1851 return _forward == other._forward && 1852 static_cast<const Edge&>(*this) == static_cast<const Edge&>(other); 1859 return _forward == other._forward && _edge == other._edge; 1853 1860 } 1854 1861 bool operator!=(const Arc &other) const { 1855 return _forward != other._forward || 1856 static_cast<const Edge&>(*this) != static_cast<const Edge&>(other); 1862 return _forward != other._forward || _edge != other._edge; 1857 1863 } 1858 1864 bool operator<(const Arc &other) const { 1859 1865 return _forward < other._forward || 1860 (_forward == other._forward && 1861 static_cast<const Edge&>(*this) < static_cast<const Edge&>(other)); 1866 (_forward == other._forward && _edge < other._edge); 1862 1867 } 1863 1868 }; … … 1872 1877 1873 1878 void first(Arc& a) const { 1874 _digraph->first(a );1879 _digraph->first(a._edge); 1875 1880 a._forward = true; 1876 1881 } … … 1880 1885 a._forward = false; 1881 1886 } else { 1882 _digraph->next(a );1887 _digraph->next(a._edge); 1883 1888 a._forward = true; 1884 1889 } … … 1894 1899 1895 1900 void firstOut(Arc& a, const Node& n) const { 1896 _digraph->firstIn(a , n);1897 if ( static_cast<const Edge&>(a)!= INVALID ) {1901 _digraph->firstIn(a._edge, n); 1902 if (a._edge != INVALID ) { 1898 1903 a._forward = false; 1899 1904 } else { 1900 _digraph->firstOut(a , n);1905 _digraph->firstOut(a._edge, n); 1901 1906 a._forward = true; 1902 1907 } … … 1904 1909 void nextOut(Arc &a) const { 1905 1910 if (!a._forward) { 1906 Node n = _digraph->target(a );1907 _digraph->nextIn(a );1908 if ( static_cast<const Edge&>(a) == INVALID) {1909 _digraph->firstOut(a , n);1911 Node n = _digraph->target(a._edge); 1912 _digraph->nextIn(a._edge); 1913 if (a._edge == INVALID) { 1914 _digraph->firstOut(a._edge, n); 1910 1915 a._forward = true; 1911 1916 } 1912 1917 } 1913 1918 else { 1914 _digraph->nextOut(a );1919 _digraph->nextOut(a._edge); 1915 1920 } 1916 1921 } 1917 1922 1918 1923 void firstIn(Arc &a, const Node &n) const { 1919 _digraph->firstOut(a , n);1920 if ( static_cast<const Edge&>(a)!= INVALID ) {1924 _digraph->firstOut(a._edge, n); 1925 if (a._edge != INVALID ) { 1921 1926 a._forward = false; 1922 1927 } else { 1923 _digraph->firstIn(a , n);1928 _digraph->firstIn(a._edge, n); 1924 1929 a._forward = true; 1925 1930 } … … 1927 1932 void nextIn(Arc &a) const { 1928 1933 if (!a._forward) { 1929 Node n = _digraph->source(a );1930 _digraph->nextOut(a );1931 if ( static_cast<const Edge&>(a)== INVALID ) {1932 _digraph->firstIn(a , n);1934 Node n = _digraph->source(a._edge); 1935 _digraph->nextOut(a._edge); 1936 if (a._edge == INVALID ) { 1937 _digraph->firstIn(a._edge, n); 1933 1938 a._forward = true; 1934 1939 } 1935 1940 } 1936 1941 else { 1937 _digraph->nextIn(a );1942 _digraph->nextIn(a._edge); 1938 1943 } 1939 1944 } … … 1968 1973 1969 1974 Node source(const Arc &a) const { 1970 return a._forward ? _digraph->source(a ) : _digraph->target(a);1975 return a._forward ? _digraph->source(a._edge) : _digraph->target(a._edge); 1971 1976 } 1972 1977 1973 1978 Node target(const Arc &a) const { 1974 return a._forward ? _digraph->target(a ) : _digraph->source(a);1979 return a._forward ? _digraph->target(a._edge) : _digraph->source(a._edge); 1975 1980 } 1976 1981 1977 1982 static Arc direct(const Edge &e, bool d) { 1978 1983 return Arc(e, d); 1979 }1980 Arc direct(const Edge &e, const Node& n) const {1981 return Arc(e, _digraph->source(e) == n);1982 1984 } 1983 1985 … … 2063 2065 private: 2064 2066 2065 template <typename _Value>2067 template <typename V> 2066 2068 class ArcMapBase { 2067 2069 private: 2068 2070 2069 typedef typename D igraph::template ArcMap<_Value> MapImpl;2071 typedef typename DGR::template ArcMap<V> MapImpl; 2070 2072 2071 2073 public: … … 2073 2075 typedef typename MapTraits<MapImpl>::ReferenceMapTag ReferenceMapTag; 2074 2076 2075 typedef _ValueValue;2077 typedef V Value; 2076 2078 typedef Arc Key; 2077 2079 typedef typename MapTraits<MapImpl>::ConstReturnValue ConstReturnValue; … … 2080 2082 typedef typename MapTraits<MapImpl>::ReturnValue Reference; 2081 2083 2082 ArcMapBase(const Adaptor& adaptor) :2084 ArcMapBase(const UndirectorBase<DGR>& adaptor) : 2083 2085 _forward(*adaptor._digraph), _backward(*adaptor._digraph) {} 2084 2086 2085 ArcMapBase(const Adaptor& adaptor, const Value& v) 2086 : _forward(*adaptor._digraph, v), _backward(*adaptor._digraph, v) {} 2087 2088 void set(const Arc& a, const Value& v) { 2087 ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value) 2088 : _forward(*adaptor._digraph, value), 2089 _backward(*adaptor._digraph, value) {} 2090 2091 void set(const Arc& a, const V& value) { 2089 2092 if (direction(a)) { 2090 _forward.set(a, v );2093 _forward.set(a, value); 2091 2094 } else { 2092 _backward.set(a, v );2095 _backward.set(a, value); 2093 2096 } 2094 2097 } … … 2118 2121 public: 2119 2122 2120 template <typename _Value> 2121 class NodeMap : public Digraph::template NodeMap<_Value> { 2123 template <typename V> 2124 class NodeMap : public DGR::template NodeMap<V> { 2125 typedef typename DGR::template NodeMap<V> Parent; 2126 2122 2127 public: 2123 2124 typedef _Value Value; 2125 typedef typename Digraph::template NodeMap<Value> Parent; 2126 2127 explicit NodeMap(const Adaptor& adaptor) 2128 typedef V Value; 2129 2130 explicit NodeMap(const UndirectorBase<DGR>& adaptor) 2128 2131 : Parent(*adaptor._digraph) {} 2129 2132 2130 NodeMap(const Adaptor& adaptor, const _Value& value)2133 NodeMap(const UndirectorBase<DGR>& adaptor, const V& value) 2131 2134 : Parent(*adaptor._digraph, value) { } 2132 2135 … … 2144 2147 }; 2145 2148 2146 template <typename _Value>2149 template <typename V> 2147 2150 class ArcMap 2148 : public SubMapExtender<Adaptor, ArcMapBase<_Value> > 2149 { 2151 : public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > { 2152 typedef SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > Parent; 2153 2150 2154 public: 2151 typedef _Value Value; 2152 typedef SubMapExtender<Adaptor, ArcMapBase<Value> > Parent; 2153 2154 explicit ArcMap(const Adaptor& adaptor) 2155 typedef V Value; 2156 2157 explicit ArcMap(const UndirectorBase<DGR>& adaptor) 2155 2158 : Parent(adaptor) {} 2156 2159 2157 ArcMap(const Adaptor& adaptor, const Value& value)2160 ArcMap(const UndirectorBase<DGR>& adaptor, const V& value) 2158 2161 : Parent(adaptor, value) {} 2159 2162 … … 2170 2173 }; 2171 2174 2172 template <typename _Value> 2173 class EdgeMap : public Digraph::template ArcMap<_Value> { 2175 template <typename V> 2176 class EdgeMap : public Digraph::template ArcMap<V> { 2177 typedef typename Digraph::template ArcMap<V> Parent; 2178 2174 2179 public: 2175 2176 typedef _Value Value; 2177 typedef typename Digraph::template ArcMap<Value> Parent; 2178 2179 explicit EdgeMap(const Adaptor& adaptor) 2180 typedef V Value; 2181 2182 explicit EdgeMap(const UndirectorBase<DGR>& adaptor) 2180 2183 : Parent(*adaptor._digraph) {} 2181 2184 2182 EdgeMap(const Adaptor& adaptor, const Value& value)2185 EdgeMap(const UndirectorBase<DGR>& adaptor, const V& value) 2183 2186 : Parent(*adaptor._digraph, value) {} 2184 2187 … … 2196 2199 }; 2197 2200 2198 typedef typename ItemSetTraits<D igraph, Node>::ItemNotifier NodeNotifier;2201 typedef typename ItemSetTraits<DGR, Node>::ItemNotifier NodeNotifier; 2199 2202 NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); } 2200 2203 2201 typedef typename ItemSetTraits<D igraph, Edge>::ItemNotifier EdgeNotifier;2204 typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier; 2202 2205 EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); } 2206 2207 typedef EdgeNotifier ArcNotifier; 2208 ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); } 2203 2209 2204 2210 protected: … … 2206 2212 UndirectorBase() : _digraph(0) {} 2207 2213 2208 D igraph* _digraph;2209 2210 void setDigraph(Digraph& digraph) {2214 DGR* _digraph; 2215 2216 void initialize(DGR& digraph) { 2211 2217 _digraph = &digraph; 2212 2218 } … … 2227 2233 /// parameter is set to be \c const. 2228 2234 /// 2229 /// \tparam GR The type of the adapted digraph.2235 /// \tparam DGR The type of the adapted digraph. 2230 2236 /// It must conform to the \ref concepts::Digraph "Digraph" concept. 2231 2237 /// It can also be specified to be \c const. … … 2237 2243 /// (Thus the \c Arc type of the adaptor is convertible to the \c Arc type 2238 2244 /// of the adapted digraph.) 2239 template<typename GR>2245 template<typename DGR> 2240 2246 #ifdef DOXYGEN 2241 2247 class Undirector { 2242 2248 #else 2243 2249 class Undirector : 2244 public GraphAdaptorExtender<UndirectorBase< GR> > {2250 public GraphAdaptorExtender<UndirectorBase<DGR> > { 2245 2251 #endif 2252 typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent; 2246 2253 public: 2247 2254 /// The type of the adapted digraph. 2248 typedef GR Digraph; 2249 typedef GraphAdaptorExtender<UndirectorBase<GR> > Parent; 2255 typedef DGR Digraph; 2250 2256 protected: 2251 2257 Undirector() { } … … 2255 2261 /// 2256 2262 /// Creates an undirected graph from the given digraph. 2257 Undirector(D igraph& digraph) {2258 setDigraph(digraph);2263 Undirector(DGR& digraph) { 2264 initialize(digraph); 2259 2265 } 2260 2266 … … 2263 2269 /// This map adaptor class adapts two arc maps of the underlying 2264 2270 /// digraph to get an arc map of the undirected graph. 2265 /// Its value type is inherited from the first arc map type 2266 /// (\c %ForwardMap). 2267 template <typename ForwardMap, typename BackwardMap> 2271 /// Its value type is inherited from the first arc map type (\c FW). 2272 /// \tparam FW The type of the "foward" arc map. 2273 /// \tparam BK The type of the "backward" arc map. 2274 template <typename FW, typename BK> 2268 2275 class CombinedArcMap { 2269 2276 public: … … 2272 2279 typedef typename Parent::Arc Key; 2273 2280 /// The value type of the map 2274 typedef typename F orwardMap::Value Value;2275 2276 typedef typename MapTraits<F orwardMap>::ReferenceMapTag ReferenceMapTag;2277 2278 typedef typename MapTraits<F orwardMap>::ReturnValue ReturnValue;2279 typedef typename MapTraits<F orwardMap>::ConstReturnValue ConstReturnValue;2280 typedef typename MapTraits<F orwardMap>::ReturnValue Reference;2281 typedef typename MapTraits<F orwardMap>::ConstReturnValue ConstReference;2281 typedef typename FW::Value Value; 2282 2283 typedef typename MapTraits<FW>::ReferenceMapTag ReferenceMapTag; 2284 2285 typedef typename MapTraits<FW>::ReturnValue ReturnValue; 2286 typedef typename MapTraits<FW>::ConstReturnValue ConstReturnValue; 2287 typedef typename MapTraits<FW>::ReturnValue Reference; 2288 typedef typename MapTraits<FW>::ConstReturnValue ConstReference; 2282 2289 2283 2290 /// Constructor 2284 CombinedArcMap(F orwardMap& forward, BackwardMap& backward)2291 CombinedArcMap(FW& forward, BK& backward) 2285 2292 : _forward(&forward), _backward(&backward) {} 2286 2293 … … 2314 2321 protected: 2315 2322 2316 F orwardMap* _forward;2317 B ackwardMap* _backward;2323 FW* _forward; 2324 BK* _backward; 2318 2325 2319 2326 }; … … 2322 2329 /// 2323 2330 /// This function just returns a combined arc map. 2324 template <typename ForwardMap, typename BackwardMap> 2325 static CombinedArcMap<ForwardMap, BackwardMap> 2326 combinedArcMap(ForwardMap& forward, BackwardMap& backward) { 2327 return CombinedArcMap<ForwardMap, BackwardMap>(forward, backward); 2328 } 2329 2330 template <typename ForwardMap, typename BackwardMap> 2331 static CombinedArcMap<const ForwardMap, BackwardMap> 2332 combinedArcMap(const ForwardMap& forward, BackwardMap& backward) { 2333 return CombinedArcMap<const ForwardMap, 2334 BackwardMap>(forward, backward); 2335 } 2336 2337 template <typename ForwardMap, typename BackwardMap> 2338 static CombinedArcMap<ForwardMap, const BackwardMap> 2339 combinedArcMap(ForwardMap& forward, const BackwardMap& backward) { 2340 return CombinedArcMap<ForwardMap, 2341 const BackwardMap>(forward, backward); 2342 } 2343 2344 template <typename ForwardMap, typename BackwardMap> 2345 static CombinedArcMap<const ForwardMap, const BackwardMap> 2346 combinedArcMap(const ForwardMap& forward, const BackwardMap& backward) { 2347 return CombinedArcMap<const ForwardMap, 2348 const BackwardMap>(forward, backward); 2331 template <typename FW, typename BK> 2332 static CombinedArcMap<FW, BK> 2333 combinedArcMap(FW& forward, BK& backward) { 2334 return CombinedArcMap<FW, BK>(forward, backward); 2335 } 2336 2337 template <typename FW, typename BK> 2338 static CombinedArcMap<const FW, BK> 2339 combinedArcMap(const FW& forward, BK& backward) { 2340 return CombinedArcMap<const FW, BK>(forward, backward); 2341 } 2342 2343 template <typename FW, typename BK> 2344 static CombinedArcMap<FW, const BK> 2345 combinedArcMap(FW& forward, const BK& backward) { 2346 return CombinedArcMap<FW, const BK>(forward, backward); 2347 } 2348 2349 template <typename FW, typename BK> 2350 static CombinedArcMap<const FW, const BK> 2351 combinedArcMap(const FW& forward, const BK& backward) { 2352 return CombinedArcMap<const FW, const BK>(forward, backward); 2349 2353 } 2350 2354 … … 2356 2360 /// \ingroup graph_adaptors 2357 2361 /// \relates Undirector 2358 template<typename GR>2359 Undirector<const GR> undirector(constGR& digraph) {2360 return Undirector<const GR>(digraph);2362 template<typename DGR> 2363 Undirector<const DGR> undirector(const DGR& digraph) { 2364 return Undirector<const DGR>(digraph); 2361 2365 } 2362 2366 2363 2367 2364 template <typename _Graph, typename _DirectionMap>2368 template <typename GR, typename DM> 2365 2369 class OrienterBase { 2366 2370 public: 2367 2371 2368 typedef _GraphGraph;2369 typedef _DirectionMapDirectionMap;2370 2371 typedef typename G raph::Node Node;2372 typedef typename G raph::Edge Arc;2372 typedef GR Graph; 2373 typedef DM DirectionMap; 2374 2375 typedef typename GR::Node Node; 2376 typedef typename GR::Edge Arc; 2373 2377 2374 2378 void reverseArc(const Arc& arc) { … … 2449 2453 int maxArcId() const { return _graph->maxEdgeId(); } 2450 2454 2451 typedef typename ItemSetTraits<G raph, Node>::ItemNotifier NodeNotifier;2455 typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; 2452 2456 NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); } 2453 2457 2454 typedef typename ItemSetTraits<G raph, Arc>::ItemNotifier ArcNotifier;2458 typedef typename ItemSetTraits<GR, Arc>::ItemNotifier ArcNotifier; 2455 2459 ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); } 2456 2460 2457 template <typename _Value> 2458 class NodeMap : public _Graph::template NodeMap<_Value> { 2461 template <typename V> 2462 class NodeMap : public GR::template NodeMap<V> { 2463 typedef typename GR::template NodeMap<V> Parent; 2464 2459 2465 public: 2460 2466 2461 typedef typename _Graph::template NodeMap<_Value> Parent; 2462 2463 explicit NodeMap(const OrienterBase& adapter) 2467 explicit NodeMap(const OrienterBase<GR, DM>& adapter) 2464 2468 : Parent(*adapter._graph) {} 2465 2469 2466 NodeMap(const OrienterBase & adapter, const _Value& value)2470 NodeMap(const OrienterBase<GR, DM>& adapter, const V& value) 2467 2471 : Parent(*adapter._graph, value) {} 2468 2472 … … 2480 2484 }; 2481 2485 2482 template <typename _Value> 2483 class ArcMap : public _Graph::template EdgeMap<_Value> { 2486 template <typename V> 2487 class ArcMap : public GR::template EdgeMap<V> { 2488 typedef typename Graph::template EdgeMap<V> Parent; 2489 2484 2490 public: 2485 2491 2486 typedef typename Graph::template EdgeMap<_Value> Parent; 2487 2488 explicit ArcMap(const OrienterBase& adapter) 2492 explicit ArcMap(const OrienterBase<GR, DM>& adapter) 2489 2493 : Parent(*adapter._graph) { } 2490 2494 2491 ArcMap(const OrienterBase & adapter, const _Value& value)2495 ArcMap(const OrienterBase<GR, DM>& adapter, const V& value) 2492 2496 : Parent(*adapter._graph, value) { } 2493 2497 … … 2508 2512 protected: 2509 2513 Graph* _graph; 2510 DirectionMap* _direction; 2511 2512 void setDirectionMap(DirectionMap& direction) { 2514 DM* _direction; 2515 2516 void initialize(GR& graph, DM& direction) { 2517 _graph = &graph; 2513 2518 _direction = &direction; 2514 }2515 2516 void setGraph(Graph& graph) {2517 _graph = &graph;2518 2519 } 2519 2520 … … 2557 2558 public DigraphAdaptorExtender<OrienterBase<GR, DM> > { 2558 2559 #endif 2560 typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent; 2559 2561 public: 2560 2562 … … 2564 2566 typedef DM DirectionMap; 2565 2567 2566 typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent;2567 2568 typedef typename Parent::Arc Arc; 2569 2568 2570 protected: 2569 2571 Orienter() { } 2572 2570 2573 public: 2571 2574 … … 2573 2576 /// 2574 2577 /// Constructor of the adaptor. 2575 Orienter(Graph& graph, DirectionMap& direction) { 2576 setGraph(graph); 2577 setDirectionMap(direction); 2578 Orienter(GR& graph, DM& direction) { 2579 Parent::initialize(graph, direction); 2578 2580 } 2579 2581 … … 2595 2597 template<typename GR, typename DM> 2596 2598 Orienter<const GR, DM> 2597 orienter(const GR& graph, DM& direction _map) {2598 return Orienter<const GR, DM>(graph, direction _map);2599 orienter(const GR& graph, DM& direction) { 2600 return Orienter<const GR, DM>(graph, direction); 2599 2601 } 2600 2602 2601 2603 template<typename GR, typename DM> 2602 2604 Orienter<const GR, const DM> 2603 orienter(const GR& graph, const DM& direction _map) {2604 return Orienter<const GR, const DM>(graph, direction _map);2605 orienter(const GR& graph, const DM& direction) { 2606 return Orienter<const GR, const DM>(graph, direction); 2605 2607 } 2606 2608 2607 2609 namespace _adaptor_bits { 2608 2610 2609 template<typename Digraph, 2610 typename CapacityMap, 2611 typename FlowMap, 2612 typename Tolerance> 2611 template <typename DGR, typename CM, typename FM, typename TL> 2613 2612 class ResForwardFilter { 2614 2613 public: 2615 2614 2616 typedef typename D igraph::Arc Key;2615 typedef typename DGR::Arc Key; 2617 2616 typedef bool Value; 2618 2617 2619 2618 private: 2620 2619 2621 const CapacityMap* _capacity; 2622 const FlowMap* _flow; 2623 Tolerance _tolerance; 2620 const CM* _capacity; 2621 const FM* _flow; 2622 TL _tolerance; 2623 2624 2624 public: 2625 2625 2626 ResForwardFilter(const C apacityMap& capacity, const FlowMap& flow,2627 const T olerance& tolerance = Tolerance())2626 ResForwardFilter(const CM& capacity, const FM& flow, 2627 const TL& tolerance = TL()) 2628 2628 : _capacity(&capacity), _flow(&flow), _tolerance(tolerance) { } 2629 2629 2630 bool operator[](const typename D igraph::Arc& a) const {2630 bool operator[](const typename DGR::Arc& a) const { 2631 2631 return _tolerance.positive((*_capacity)[a] - (*_flow)[a]); 2632 2632 } 2633 2633 }; 2634 2634 2635 template<typename Digraph, 2636 typename CapacityMap, 2637 typename FlowMap, 2638 typename Tolerance> 2635 template<typename DGR,typename CM, typename FM, typename TL> 2639 2636 class ResBackwardFilter { 2640 2637 public: 2641 2638 2642 typedef typename D igraph::Arc Key;2639 typedef typename DGR::Arc Key; 2643 2640 typedef bool Value; 2644 2641 2645 2642 private: 2646 2643 2647 const C apacityMap* _capacity;2648 const F lowMap* _flow;2649 T olerance_tolerance;2644 const CM* _capacity; 2645 const FM* _flow; 2646 TL _tolerance; 2650 2647 2651 2648 public: 2652 2649 2653 ResBackwardFilter(const C apacityMap& capacity, const FlowMap& flow,2654 const T olerance& tolerance = Tolerance())2650 ResBackwardFilter(const CM& capacity, const FM& flow, 2651 const TL& tolerance = TL()) 2655 2652 : _capacity(&capacity), _flow(&flow), _tolerance(tolerance) { } 2656 2653 2657 bool operator[](const typename D igraph::Arc& a) const {2654 bool operator[](const typename DGR::Arc& a) const { 2658 2655 return _tolerance.positive((*_flow)[a]); 2659 2656 } … … 2667 2664 /// flow and circulation problems. 2668 2665 /// 2669 /// Residual can be used for composing the \e residual digraph for directed2670 /// f low and circulation problems. Let \f$ G=(V, A) \f$ be a directed graph2671 /// and let \f$ F \f$ be a number type. Let \f$ flow, cap: A\to F \f$ be2672 /// functions on the arcs.2666 /// ResidualDigraph can be used for composing the \e residual digraph 2667 /// for directed flow and circulation problems. Let \f$ G=(V, A) \f$ 2668 /// be a directed graph and let \f$ F \f$ be a number type. 2669 /// Let \f$ flow, cap: A\to F \f$ be functions on the arcs. 2673 2670 /// This adaptor implements a digraph structure with node set \f$ V \f$ 2674 2671 /// and arc set \f$ A_{forward}\cup A_{backward} \f$, … … 2682 2679 /// This class conforms to the \ref concepts::Digraph "Digraph" concept. 2683 2680 /// 2684 /// \tparam GR The type of the adapted digraph.2681 /// \tparam DGR The type of the adapted digraph. 2685 2682 /// It must conform to the \ref concepts::Digraph "Digraph" concept. 2686 2683 /// It is implicitly \c const. … … 2704 2701 /// is convertible to the \c Arc type of the adapted digraph. 2705 2702 #ifdef DOXYGEN 2706 template<typename GR, typename CM, typename FM, typename TL>2707 class Residual 2703 template<typename DGR, typename CM, typename FM, typename TL> 2704 class ResidualDigraph 2708 2705 #else 2709 template<typename GR,2710 typename CM = typename GR::template ArcMap<int>,2706 template<typename DGR, 2707 typename CM = typename DGR::template ArcMap<int>, 2711 2708 typename FM = CM, 2712 2709 typename TL = Tolerance<typename CM::Value> > 2713 class Residual : 2714 public FilterArcs< 2715 Undirector<const GR>, 2716 typename Undirector<const GR>::template CombinedArcMap< 2717 _adaptor_bits::ResForwardFilter<const GR, CM, FM, TL>, 2718 _adaptor_bits::ResBackwardFilter<const GR, CM, FM, TL> > > 2710 class ResidualDigraph 2711 : public SubDigraph< 2712 Undirector<const DGR>, 2713 ConstMap<typename DGR::Node, Const<bool, true> >, 2714 typename Undirector<const DGR>::template CombinedArcMap< 2715 _adaptor_bits::ResForwardFilter<const DGR, CM, FM, TL>, 2716 _adaptor_bits::ResBackwardFilter<const DGR, CM, FM, TL> > > 2719 2717 #endif 2720 2718 { … … 2722 2720 2723 2721 /// The type of the underlying digraph. 2724 typedef GR Digraph;2722 typedef DGR Digraph; 2725 2723 /// The type of the capacity map. 2726 2724 typedef CM CapacityMap; … … 2731 2729 2732 2730 typedef typename CapacityMap::Value Value; 2733 typedef Residual Adaptor;2731 typedef ResidualDigraph Adaptor; 2734 2732 2735 2733 protected: … … 2737 2735 typedef Undirector<const Digraph> Undirected; 2738 2736 2739 typedef _adaptor_bits::ResForwardFilter<const Digraph, CapacityMap, 2740 FlowMap, Tolerance> ForwardFilter; 2741 2742 typedef _adaptor_bits::ResBackwardFilter<const Digraph, CapacityMap, 2743 FlowMap, Tolerance> BackwardFilter; 2737 typedef ConstMap<typename DGR::Node, Const<bool, true> > NodeFilter; 2738 2739 typedef _adaptor_bits::ResForwardFilter<const DGR, CM, 2740 FM, TL> ForwardFilter; 2741 2742 typedef _adaptor_bits::ResBackwardFilter<const DGR, CM, 2743 FM, TL> BackwardFilter; 2744 2744 2745 2745 typedef typename Undirected:: 2746 2746 template CombinedArcMap<ForwardFilter, BackwardFilter> ArcFilter; 2747 2747 2748 typedef FilterArcs<Undirected, ArcFilter> Parent;2748 typedef SubDigraph<Undirected, NodeFilter, ArcFilter> Parent; 2749 2749 2750 2750 const CapacityMap* _capacity; … … 2752 2752 2753 2753 Undirected _graph; 2754 NodeFilter _node_filter; 2754 2755 ForwardFilter _forward_filter; 2755 2756 BackwardFilter _backward_filter; … … 2762 2763 /// Constructor of the residual digraph adaptor. The parameters are the 2763 2764 /// digraph, the capacity map, the flow map, and a tolerance object. 2764 Residual(const Digraph& digraph, const CapacityMap& capacity, 2765 FlowMap& flow, const Tolerance& tolerance = Tolerance()) 2766 : Parent(), _capacity(&capacity), _flow(&flow), _graph(digraph), 2765 ResidualDigraph(const DGR& digraph, const CM& capacity, 2766 FM& flow, const TL& tolerance = Tolerance()) 2767 : Parent(), _capacity(&capacity), _flow(&flow), 2768 _graph(digraph), _node_filter(), 2767 2769 _forward_filter(capacity, flow, tolerance), 2768 2770 _backward_filter(capacity, flow, tolerance), 2769 2771 _arc_filter(_forward_filter, _backward_filter) 2770 2772 { 2771 Parent::setDigraph(_graph); 2772 Parent::setArcFilterMap(_arc_filter); 2773 Parent::initialize(_graph, _node_filter, _arc_filter); 2773 2774 } 2774 2775 … … 2846 2847 2847 2848 /// Constructor 2848 ResidualCapacity(const Adaptor& adaptor) : _adaptor(&adaptor) {} 2849 ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 2850 : _adaptor(&adaptor) {} 2849 2851 2850 2852 /// Returns the value associated with the given residual arc … … 2866 2868 /// \brief Returns a (read-only) Residual adaptor 2867 2869 /// 2868 /// This function just returns a (read-only) \ref Residual adaptor.2870 /// This function just returns a (read-only) \ref ResidualDigraph adaptor. 2869 2871 /// \ingroup graph_adaptors 2870 /// \relates Residual 2871 template<typename GR, typename CM, typename FM> 2872 Residual<GR, CM, FM> residual(const GR& digraph, 2873 const CM& capacity_map, 2874 FM& flow_map) { 2875 return Residual<GR, CM, FM> (digraph, capacity_map, flow_map); 2872 /// \relates ResidualDigraph 2873 template<typename DGR, typename CM, typename FM> 2874 ResidualDigraph<DGR, CM, FM> 2875 residualDigraph(const DGR& digraph, const CM& capacity_map, FM& flow_map) { 2876 return ResidualDigraph<DGR, CM, FM> (digraph, capacity_map, flow_map); 2876 2877 } 2877 2878 2878 2879 2879 template <typename _Digraph>2880 template <typename DGR> 2880 2881 class SplitNodesBase { 2881 public: 2882 2883 typedef _Digraph Digraph; 2884 typedef DigraphAdaptorBase<const _Digraph> Parent; 2882 typedef DigraphAdaptorBase<const DGR> Parent; 2883 2884 public: 2885 2886 typedef DGR Digraph; 2885 2887 typedef SplitNodesBase Adaptor; 2886 2888 2887 typedef typename D igraph::Node DigraphNode;2888 typedef typename D igraph::Arc DigraphArc;2889 typedef typename DGR::Node DigraphNode; 2890 typedef typename DGR::Arc DigraphArc; 2889 2891 2890 2892 class Node; … … 3150 3152 private: 3151 3153 3152 template <typename _Value>3154 template <typename V> 3153 3155 class NodeMapBase 3154 : public MapTraits<typename Parent::template NodeMap< _Value> > {3155 typedef typename Parent::template NodeMap< _Value> NodeImpl;3156 : public MapTraits<typename Parent::template NodeMap<V> > { 3157 typedef typename Parent::template NodeMap<V> NodeImpl; 3156 3158 public: 3157 3159 typedef Node Key; 3158 typedef _ValueValue;3160 typedef V Value; 3159 3161 typedef typename MapTraits<NodeImpl>::ReferenceMapTag ReferenceMapTag; 3160 3162 typedef typename MapTraits<NodeImpl>::ReturnValue ReturnValue; … … 3163 3165 typedef typename MapTraits<NodeImpl>::ConstReturnValue ConstReference; 3164 3166 3165 NodeMapBase(const Adaptor& adaptor)3167 NodeMapBase(const SplitNodesBase<DGR>& adaptor) 3166 3168 : _in_map(*adaptor._digraph), _out_map(*adaptor._digraph) {} 3167 NodeMapBase(const Adaptor& adaptor, const Value& value)3169 NodeMapBase(const SplitNodesBase<DGR>& adaptor, const V& value) 3168 3170 : _in_map(*adaptor._digraph, value), 3169 3171 _out_map(*adaptor._digraph, value) {} 3170 3172 3171 void set(const Node& key, const V alue& val) {3172 if ( Adaptor::inNode(key)) { _in_map.set(key, val); }3173 void set(const Node& key, const V& val) { 3174 if (SplitNodesBase<DGR>::inNode(key)) { _in_map.set(key, val); } 3173 3175 else {_out_map.set(key, val); } 3174 3176 } 3175 3177 3176 3178 ReturnValue operator[](const Node& key) { 3177 if ( Adaptor::inNode(key)) { return _in_map[key]; }3179 if (SplitNodesBase<DGR>::inNode(key)) { return _in_map[key]; } 3178 3180 else { return _out_map[key]; } 3179 3181 } … … 3188 3190 }; 3189 3191 3190 template <typename _Value>3192 template <typename V> 3191 3193 class ArcMapBase 3192 : public MapTraits<typename Parent::template ArcMap< _Value> > {3193 typedef typename Parent::template ArcMap< _Value> ArcImpl;3194 typedef typename Parent::template NodeMap< _Value> NodeImpl;3194 : public MapTraits<typename Parent::template ArcMap<V> > { 3195 typedef typename Parent::template ArcMap<V> ArcImpl; 3196 typedef typename Parent::template NodeMap<V> NodeImpl; 3195 3197 public: 3196 3198 typedef Arc Key; 3197 typedef _ValueValue;3199 typedef V Value; 3198 3200 typedef typename MapTraits<ArcImpl>::ReferenceMapTag ReferenceMapTag; 3199 3201 typedef typename MapTraits<ArcImpl>::ReturnValue ReturnValue; … … 3202 3204 typedef typename MapTraits<ArcImpl>::ConstReturnValue ConstReference; 3203 3205 3204 ArcMapBase(const Adaptor& adaptor)3206 ArcMapBase(const SplitNodesBase<DGR>& adaptor) 3205 3207 : _arc_map(*adaptor._digraph), _node_map(*adaptor._digraph) {} 3206 ArcMapBase(const Adaptor& adaptor, const Value& value)3208 ArcMapBase(const SplitNodesBase<DGR>& adaptor, const V& value) 3207 3209 : _arc_map(*adaptor._digraph, value), 3208 3210 _node_map(*adaptor._digraph, value) {} 3209 3211 3210 void set(const Arc& key, const V alue& val) {3211 if ( Adaptor::origArc(key)) {3212 _arc_map.set( key._item.first(), val);3212 void set(const Arc& key, const V& val) { 3213 if (SplitNodesBase<DGR>::origArc(key)) { 3214 _arc_map.set(static_cast<const DigraphArc&>(key), val); 3213 3215 } else { 3214 _node_map.set( key._item.second(), val);3216 _node_map.set(static_cast<const DigraphNode&>(key), val); 3215 3217 } 3216 3218 } 3217 3219 3218 3220 ReturnValue operator[](const Arc& key) { 3219 if ( Adaptor::origArc(key)) {3220 return _arc_map[ key._item.first()];3221 if (SplitNodesBase<DGR>::origArc(key)) { 3222 return _arc_map[static_cast<const DigraphArc&>(key)]; 3221 3223 } else { 3222 return _node_map[ key._item.second()];3224 return _node_map[static_cast<const DigraphNode&>(key)]; 3223 3225 } 3224 3226 } 3225 3227 3226 3228 ConstReturnValue operator[](const Arc& key) const { 3227 if ( Adaptor::origArc(key)) {3228 return _arc_map[ key._item.first()];3229 if (SplitNodesBase<DGR>::origArc(key)) { 3230 return _arc_map[static_cast<const DigraphArc&>(key)]; 3229 3231 } else { 3230 return _node_map[ key._item.second()];3232 return _node_map[static_cast<const DigraphNode&>(key)]; 3231 3233 } 3232 3234 } … … 3239 3241 public: 3240 3242 3241 template <typename _Value>3243 template <typename V> 3242 3244 class NodeMap 3243 : public SubMapExtender<Adaptor, NodeMapBase<_Value> > 3244 { 3245 : public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > { 3246 typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > Parent; 3247 3245 3248 public: 3246 typedef _Value Value; 3247 typedef SubMapExtender<Adaptor, NodeMapBase<Value> > Parent; 3248 3249 NodeMap(const Adaptor& adaptor) 3249 typedef V Value; 3250 3251 NodeMap(const SplitNodesBase<DGR>& adaptor) 3250 3252 : Parent(adaptor) {} 3251 3253 3252 NodeMap(const Adaptor& adaptor, const Value& value)3254 NodeMap(const SplitNodesBase<DGR>& adaptor, const V& value) 3253 3255 : Parent(adaptor, value) {} 3254 3256 … … 3265 3267 }; 3266 3268 3267 template <typename _Value>3269 template <typename V> 3268 3270 class ArcMap 3269 : public SubMapExtender<Adaptor, ArcMapBase<_Value> > 3270 { 3271 : public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > { 3272 typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > Parent; 3273 3271 3274 public: 3272 typedef _Value Value; 3273 typedef SubMapExtender<Adaptor, ArcMapBase<Value> > Parent; 3274 3275 ArcMap(const Adaptor& adaptor) 3275 typedef V Value; 3276 3277 ArcMap(const SplitNodesBase<DGR>& adaptor) 3276 3278 : Parent(adaptor) {} 3277 3279 3278 ArcMap(const Adaptor& adaptor, const Value& value)3280 ArcMap(const SplitNodesBase<DGR>& adaptor, const V& value) 3279 3281 : Parent(adaptor, value) {} 3280 3282 … … 3295 3297 SplitNodesBase() : _digraph(0) {} 3296 3298 3297 D igraph* _digraph;3298 3299 void setDigraph(Digraph& digraph) {3299 DGR* _digraph; 3300 3301 void initialize(Digraph& digraph) { 3300 3302 _digraph = &digraph; 3301 3303 } … … 3324 3326 /// in the adaptor. 3325 3327 /// 3326 /// \tparam GR The type of the adapted digraph.3328 /// \tparam DGR The type of the adapted digraph. 3327 3329 /// It must conform to the \ref concepts::Digraph "Digraph" concept. 3328 3330 /// It is implicitly \c const. … … 3330 3332 /// \note The \c Node type of this adaptor is converible to the \c Node 3331 3333 /// type of the adapted digraph. 3332 template <typename GR>3334 template <typename DGR> 3333 3335 #ifdef DOXYGEN 3334 3336 class SplitNodes { 3335 3337 #else 3336 3338 class SplitNodes 3337 : public DigraphAdaptorExtender<SplitNodesBase<const GR> > {3339 : public DigraphAdaptorExtender<SplitNodesBase<const DGR> > { 3338 3340 #endif 3339 public: 3340 typedef GR Digraph; 3341 typedef DigraphAdaptorExtender<SplitNodesBase<const GR> > Parent; 3342 3343 typedef typename Digraph::Node DigraphNode; 3344 typedef typename Digraph::Arc DigraphArc; 3341 typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent; 3342 3343 public: 3344 typedef DGR Digraph; 3345 3346 typedef typename DGR::Node DigraphNode; 3347 typedef typename DGR::Arc DigraphArc; 3345 3348 3346 3349 typedef typename Parent::Node Node; … … 3350 3353 /// 3351 3354 /// Constructor of the adaptor. 3352 SplitNodes(const D igraph& g) {3353 Parent:: setDigraph(g);3355 SplitNodes(const DGR& g) { 3356 Parent::initialize(g); 3354 3357 } 3355 3358 … … 3420 3423 /// This map adaptor class adapts two node maps of the original digraph 3421 3424 /// to get a node map of the split digraph. 3422 /// Its value type is inherited from the first node map type 3423 /// (\c InNodeMap). 3424 template <typename InNodeMap, typename OutNodeMap> 3425 /// Its value type is inherited from the first node map type (\c IN). 3426 /// \tparam IN The type of the node map for the in-nodes. 3427 /// \tparam OUT The type of the node map for the out-nodes. 3428 template <typename IN, typename OUT> 3425 3429 class CombinedNodeMap { 3426 3430 public: … … 3429 3433 typedef Node Key; 3430 3434 /// The value type of the map 3431 typedef typename I nNodeMap::Value Value;3432 3433 typedef typename MapTraits<I nNodeMap>::ReferenceMapTag ReferenceMapTag;3434 typedef typename MapTraits<I nNodeMap>::ReturnValue ReturnValue;3435 typedef typename MapTraits<I nNodeMap>::ConstReturnValue ConstReturnValue;3436 typedef typename MapTraits<I nNodeMap>::ReturnValue Reference;3437 typedef typename MapTraits<I nNodeMap>::ConstReturnValue ConstReference;3435 typedef typename IN::Value Value; 3436 3437 typedef typename MapTraits<IN>::ReferenceMapTag ReferenceMapTag; 3438 typedef typename MapTraits<IN>::ReturnValue ReturnValue; 3439 typedef typename MapTraits<IN>::ConstReturnValue ConstReturnValue; 3440 typedef typename MapTraits<IN>::ReturnValue Reference; 3441 typedef typename MapTraits<IN>::ConstReturnValue ConstReference; 3438 3442 3439 3443 /// Constructor 3440 CombinedNodeMap(I nNodeMap& in_map, OutNodeMap& out_map)3444 CombinedNodeMap(IN& in_map, OUT& out_map) 3441 3445 : _in_map(in_map), _out_map(out_map) {} 3442 3446 3443 3447 /// Returns the value associated with the given key. 3444 3448 Value operator[](const Key& key) const { 3445 if ( Parent::inNode(key)) {3449 if (SplitNodesBase<const DGR>::inNode(key)) { 3446 3450 return _in_map[key]; 3447 3451 } else { … … 3452 3456 /// Returns a reference to the value associated with the given key. 3453 3457 Value& operator[](const Key& key) { 3454 if ( Parent::inNode(key)) {3458 if (SplitNodesBase<const DGR>::inNode(key)) { 3455 3459 return _in_map[key]; 3456 3460 } else { … … 3461 3465 /// Sets the value associated with the given key. 3462 3466 void set(const Key& key, const Value& value) { 3463 if ( Parent::inNode(key)) {3467 if (SplitNodesBase<const DGR>::inNode(key)) { 3464 3468 _in_map.set(key, value); 3465 3469 } else { … … 3470 3474 private: 3471 3475 3472 I nNodeMap& _in_map;3473 O utNodeMap& _out_map;3476 IN& _in_map; 3477 OUT& _out_map; 3474 3478 3475 3479 }; … … 3479 3483 /// 3480 3484 /// This function just returns a combined node map. 3481 template <typename InNodeMap, typename OutNodeMap> 3482 static CombinedNodeMap<InNodeMap, OutNodeMap> 3483 combinedNodeMap(InNodeMap& in_map, OutNodeMap& out_map) { 3484 return CombinedNodeMap<InNodeMap, OutNodeMap>(in_map, out_map); 3485 } 3486 3487 template <typename InNodeMap, typename OutNodeMap> 3488 static CombinedNodeMap<const InNodeMap, OutNodeMap> 3489 combinedNodeMap(const InNodeMap& in_map, OutNodeMap& out_map) { 3490 return CombinedNodeMap<const InNodeMap, OutNodeMap>(in_map, out_map); 3491 } 3492 3493 template <typename InNodeMap, typename OutNodeMap> 3494 static CombinedNodeMap<InNodeMap, const OutNodeMap> 3495 combinedNodeMap(InNodeMap& in_map, const OutNodeMap& out_map) { 3496 return CombinedNodeMap<InNodeMap, const OutNodeMap>(in_map, out_map); 3497 } 3498 3499 template <typename InNodeMap, typename OutNodeMap> 3500 static CombinedNodeMap<const InNodeMap, const OutNodeMap> 3501 combinedNodeMap(const InNodeMap& in_map, const OutNodeMap& out_map) { 3502 return CombinedNodeMap<const InNodeMap, 3503 const OutNodeMap>(in_map, out_map); 3485 template <typename IN, typename OUT> 3486 static CombinedNodeMap<IN, OUT> 3487 combinedNodeMap(IN& in_map, OUT& out_map) { 3488 return CombinedNodeMap<IN, OUT>(in_map, out_map); 3489 } 3490 3491 template <typename IN, typename OUT> 3492 static CombinedNodeMap<const IN, OUT> 3493 combinedNodeMap(const IN& in_map, OUT& out_map) { 3494 return CombinedNodeMap<const IN, OUT>(in_map, out_map); 3495 } 3496 3497 template <typename IN, typename OUT> 3498 static CombinedNodeMap<IN, const OUT> 3499 combinedNodeMap(IN& in_map, const OUT& out_map) { 3500 return CombinedNodeMap<IN, const OUT>(in_map, out_map); 3501 } 3502 3503 template <typename IN, typename OUT> 3504 static CombinedNodeMap<const IN, const OUT> 3505 combinedNodeMap(const IN& in_map, const OUT& out_map) { 3506 return CombinedNodeMap<const IN, const OUT>(in_map, out_map); 3504 3507 } 3505 3508 … … 3509 3512 /// This map adaptor class adapts an arc map and a node map of the 3510 3513 /// original digraph to get an arc map of the split digraph. 3511 /// Its value type is inherited from the original arc map type 3512 /// (\c ArcMap). 3513 template <typename ArcMap, typename NodeMap> 3514 /// Its value type is inherited from the original arc map type (\c AM). 3515 /// \tparam AM The type of the arc map. 3516 /// \tparam NM the type of the node map. 3517 template <typename AM, typename NM> 3514 3518 class CombinedArcMap { 3515 3519 public: … … 3518 3522 typedef Arc Key; 3519 3523 /// The value type of the map 3520 typedef typename A rcMap::Value Value;3521 3522 typedef typename MapTraits<A rcMap>::ReferenceMapTag ReferenceMapTag;3523 typedef typename MapTraits<A rcMap>::ReturnValue ReturnValue;3524 typedef typename MapTraits<A rcMap>::ConstReturnValue ConstReturnValue;3525 typedef typename MapTraits<A rcMap>::ReturnValue Reference;3526 typedef typename MapTraits<A rcMap>::ConstReturnValue ConstReference;3524 typedef typename AM::Value Value; 3525 3526 typedef typename MapTraits<AM>::ReferenceMapTag ReferenceMapTag; 3527 typedef typename MapTraits<AM>::ReturnValue ReturnValue; 3528 typedef typename MapTraits<AM>::ConstReturnValue ConstReturnValue; 3529 typedef typename MapTraits<AM>::ReturnValue Reference; 3530 typedef typename MapTraits<AM>::ConstReturnValue ConstReference; 3527 3531 3528 3532 /// Constructor 3529 CombinedArcMap(A rcMap& arc_map, NodeMap& node_map)3533 CombinedArcMap(AM& arc_map, NM& node_map) 3530 3534 : _arc_map(arc_map), _node_map(node_map) {} 3531 3535 3532 3536 /// Returns the value associated with the given key. 3533 3537 Value operator[](const Key& arc) const { 3534 if ( Parent::origArc(arc)) {3538 if (SplitNodesBase<const DGR>::origArc(arc)) { 3535 3539 return _arc_map[arc]; 3536 3540 } else { … … 3541 3545 /// Returns a reference to the value associated with the given key. 3542 3546 Value& operator[](const Key& arc) { 3543 if ( Parent::origArc(arc)) {3547 if (SplitNodesBase<const DGR>::origArc(arc)) { 3544 3548 return _arc_map[arc]; 3545 3549 } else { … … 3550 3554 /// Sets the value associated with the given key. 3551 3555 void set(const Arc& arc, const Value& val) { 3552 if ( Parent::origArc(arc)) {3556 if (SplitNodesBase<const DGR>::origArc(arc)) { 3553 3557 _arc_map.set(arc, val); 3554 3558 } else { … … 3558 3562 3559 3563 private: 3560 ArcMap& _arc_map; 3561 NodeMap& _node_map; 3564 3565 AM& _arc_map; 3566 NM& _node_map; 3567 3562 3568 }; 3563 3569 … … 3596 3602 /// \ingroup graph_adaptors 3597 3603 /// \relates SplitNodes 3598 template<typename GR>3599 SplitNodes< GR>3600 splitNodes(const GR& digraph) {3601 return SplitNodes< GR>(digraph);3604 template<typename DGR> 3605 SplitNodes<DGR> 3606 splitNodes(const DGR& digraph) { 3607 return SplitNodes<DGR>(digraph); 3602 3608 } 3603 3609 3610 #undef LEMON_SCOPE_FIX 3611 3604 3612 } //namespace lemon 3605 3613 -
lemon/base.cc
r463 r554 24 24 namespace lemon { 25 25 26 float Tolerance<float>::def_epsilon = 1e-4;26 float Tolerance<float>::def_epsilon = static_cast<float>(1e-4); 27 27 double Tolerance<double>::def_epsilon = 1e-10; 28 28 long double Tolerance<long double>::def_epsilon = 1e-14; -
lemon/bfs.h
r463 r525 50 50 ///It must meet the \ref concepts::WriteMap "WriteMap" concept. 51 51 typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; 52 ///Instantiates a PredMap.53 54 ///This function instantiates a PredMap.52 ///Instantiates a \c PredMap. 53 54 ///This function instantiates a \ref PredMap. 55 55 ///\param g is the digraph, to which we would like to define the 56 /// PredMap.56 ///\ref PredMap. 57 57 static PredMap *createPredMap(const Digraph &g) 58 58 { … … 65 65 ///It must meet the \ref concepts::WriteMap "WriteMap" concept. 66 66 typedef NullMap<typename Digraph::Node,bool> ProcessedMap; 67 ///Instantiates a ProcessedMap.68 69 ///This function instantiates a ProcessedMap.67 ///Instantiates a \c ProcessedMap. 68 69 ///This function instantiates a \ref ProcessedMap. 70 70 ///\param g is the digraph, to which 71 ///we would like to define the ProcessedMap71 ///we would like to define the \ref ProcessedMap 72 72 #ifdef DOXYGEN 73 73 static ProcessedMap *createProcessedMap(const Digraph &g) … … 84 84 ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 85 85 typedef typename Digraph::template NodeMap<bool> ReachedMap; 86 ///Instantiates a ReachedMap.87 88 ///This function instantiates a ReachedMap.86 ///Instantiates a \c ReachedMap. 87 88 ///This function instantiates a \ref ReachedMap. 89 89 ///\param g is the digraph, to which 90 ///we would like to define the ReachedMap.90 ///we would like to define the \ref ReachedMap. 91 91 static ReachedMap *createReachedMap(const Digraph &g) 92 92 { … … 99 99 ///It must meet the \ref concepts::WriteMap "WriteMap" concept. 100 100 typedef typename Digraph::template NodeMap<int> DistMap; 101 ///Instantiates a DistMap.102 103 ///This function instantiates a DistMap.101 ///Instantiates a \c DistMap. 102 103 ///This function instantiates a \ref DistMap. 104 104 ///\param g is the digraph, to which we would like to define the 105 /// DistMap.105 ///\ref DistMap. 106 106 static DistMap *createDistMap(const Digraph &g) 107 107 { … … 222 222 }; 223 223 ///\brief \ref named-templ-param "Named parameter" for setting 224 /// PredMap type.224 ///\c PredMap type. 225 225 /// 226 226 ///\ref named-templ-param "Named parameter" for setting 227 /// PredMap type.227 ///\c PredMap type. 228 228 ///It must meet the \ref concepts::WriteMap "WriteMap" concept. 229 229 template <class T> … … 242 242 }; 243 243 ///\brief \ref named-templ-param "Named parameter" for setting 244 /// DistMap type.244 ///\c DistMap type. 245 245 /// 246 246 ///\ref named-templ-param "Named parameter" for setting 247 /// DistMap type.247 ///\c DistMap type. 248 248 ///It must meet the \ref concepts::WriteMap "WriteMap" concept. 249 249 template <class T> … … 262 262 }; 263 263 ///\brief \ref named-templ-param "Named parameter" for setting 264 /// ReachedMap type.264 ///\c ReachedMap type. 265 265 /// 266 266 ///\ref named-templ-param "Named parameter" for setting 267 /// ReachedMap type.267 ///\c ReachedMap type. 268 268 ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 269 269 template <class T> … … 282 282 }; 283 283 ///\brief \ref named-templ-param "Named parameter" for setting 284 /// ProcessedMap type.284 ///\c ProcessedMap type. 285 285 /// 286 286 ///\ref named-templ-param "Named parameter" for setting 287 /// ProcessedMap type.287 ///\c ProcessedMap type. 288 288 ///It must meet the \ref concepts::WriteMap "WriteMap" concept. 289 289 template <class T> … … 301 301 }; 302 302 ///\brief \ref named-templ-param "Named parameter" for setting 303 /// ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.303 ///\c ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. 304 304 /// 305 305 ///\ref named-templ-param "Named parameter" for setting 306 /// ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.306 ///\c ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. 307 307 ///If you don't set it explicitly, it will be automatically allocated. 308 308 struct SetStandardProcessedMap : … … 1195 1195 /// This class defines the interface of the BfsVisit events, and 1196 1196 /// it could be the base of a real visitor class. 1197 template <typename _Digraph>1197 template <typename GR> 1198 1198 struct BfsVisitor { 1199 typedef _DigraphDigraph;1199 typedef GR Digraph; 1200 1200 typedef typename Digraph::Arc Arc; 1201 1201 typedef typename Digraph::Node Node; … … 1225 1225 }; 1226 1226 #else 1227 template <typename _Digraph>1227 template <typename GR> 1228 1228 struct BfsVisitor { 1229 typedef _DigraphDigraph;1229 typedef GR Digraph; 1230 1230 typedef typename Digraph::Arc Arc; 1231 1231 typedef typename Digraph::Node Node; … … 1255 1255 /// 1256 1256 /// Default traits class of BfsVisit class. 1257 /// \tparam _DigraphThe type of the digraph the algorithm runs on.1258 template<class _Digraph>1257 /// \tparam GR The type of the digraph the algorithm runs on. 1258 template<class GR> 1259 1259 struct BfsVisitDefaultTraits { 1260 1260 1261 1261 /// \brief The type of the digraph the algorithm runs on. 1262 typedef _DigraphDigraph;1262 typedef GR Digraph; 1263 1263 1264 1264 /// \brief The type of the map that indicates which nodes are reached. … … 1281 1281 /// \ingroup search 1282 1282 /// 1283 /// \brief %BFS algorithm class with visitor interface.1283 /// \brief BFS algorithm class with visitor interface. 1284 1284 /// 1285 /// This class provides an efficient implementation of the %BFS algorithm1285 /// This class provides an efficient implementation of the BFS algorithm 1286 1286 /// with visitor interface. 1287 1287 /// 1288 /// The %BfsVisit class provides an alternative interface to the Bfs1288 /// The BfsVisit class provides an alternative interface to the Bfs 1289 1289 /// class. It works with callback mechanism, the BfsVisit object calls 1290 1290 /// the member functions of the \c Visitor class on every BFS event. … … 1295 1295 /// instead. 1296 1296 /// 1297 /// \tparam _DigraphThe type of the digraph the algorithm runs on.1298 /// The default value is1299 /// \ref ListDigraph. The value of _Digraph is not used directly by1300 /// \ref BfsVisit,it is only passed to \ref BfsVisitDefaultTraits.1301 /// \tparam _VisitorThe Visitor type that is used by the algorithm.1302 /// \ref BfsVisitor "BfsVisitor< _Digraph>" is an empty visitor, which1297 /// \tparam GR The type of the digraph the algorithm runs on. 1298 /// The default type is \ref ListDigraph. 1299 /// The value of GR is not used directly by \ref BfsVisit, 1300 /// it is only passed to \ref BfsVisitDefaultTraits. 1301 /// \tparam VS The Visitor type that is used by the algorithm. 1302 /// \ref BfsVisitor "BfsVisitor<GR>" is an empty visitor, which 1303 1303 /// does not observe the BFS events. If you want to observe the BFS 1304 1304 /// events, you should implement your own visitor class. 1305 /// \tparam _TraitsTraits class to set various data types used by the1305 /// \tparam TR Traits class to set various data types used by the 1306 1306 /// algorithm. The default traits class is 1307 /// \ref BfsVisitDefaultTraits "BfsVisitDefaultTraits< _Digraph>".1307 /// \ref BfsVisitDefaultTraits "BfsVisitDefaultTraits<GR>". 1308 1308 /// See \ref BfsVisitDefaultTraits for the documentation of 1309 1309 /// a BFS visit traits class. 1310 1310 #ifdef DOXYGEN 1311 template <typename _Digraph, typename _Visitor, typename _Traits>1311 template <typename GR, typename VS, typename TR> 1312 1312 #else 1313 template <typename _Digraph= ListDigraph,1314 typename _Visitor = BfsVisitor<_Digraph>,1315 typename _Traits = BfsVisitDefaultTraits<_Digraph> >1313 template <typename GR = ListDigraph, 1314 typename VS = BfsVisitor<GR>, 1315 typename TR = BfsVisitDefaultTraits<GR> > 1316 1316 #endif 1317 1317 class BfsVisit { … … 1319 1319 1320 1320 ///The traits class. 1321 typedef _TraitsTraits;1321 typedef TR Traits; 1322 1322 1323 1323 ///The type of the digraph the algorithm runs on. … … 1325 1325 1326 1326 ///The visitor type used by the algorithm. 1327 typedef _VisitorVisitor;1327 typedef VS Visitor; 1328 1328 1329 1329 ///The type of the map that indicates which nodes are reached. -
lemon/bin_heap.h
r463 r730 34 34 ///\brief A Binary Heap implementation. 35 35 /// 36 ///This class implements the \e binary \e heap data structure. A \e heap 37 ///is a data structure for storing items with specified values called \e 38 ///priorities in such a way that finding the item with minimum priority is 39 ///efficient. \c Compare specifies the ordering of the priorities. In a heap 40 ///one can change the priority of an item, add or erase an item, etc. 41 /// 42 ///\tparam _Prio Type of the priority of the items. 43 ///\tparam _ItemIntMap A read and writable Item int map, used internally 36 ///This class implements the \e binary \e heap data structure. 37 /// 38 ///A \e heap is a data structure for storing items with specified values 39 ///called \e priorities in such a way that finding the item with minimum 40 ///priority is efficient. \c CMP specifies the ordering of the priorities. 41 ///In a heap one can change the priority of an item, add or erase an 42 ///item, etc. 43 /// 44 ///\tparam PR Type of the priority of the items. 45 ///\tparam IM A read and writable item map with int values, used internally 44 46 ///to handle the cross references. 45 ///\tparam _Compare A class for the ordering of the priorities. The46 /// default is \c std::less<_Prio>.47 ///\tparam CMP A functor class for the ordering of the priorities. 48 ///The default is \c std::less<PR>. 47 49 /// 48 50 ///\sa FibHeap 49 51 ///\sa Dijkstra 50 template <typename _Prio, typename _ItemIntMap, 51 typename _Compare = std::less<_Prio> > 52 template <typename PR, typename IM, typename CMP = std::less<PR> > 52 53 class BinHeap { 53 54 54 55 public: 55 56 ///\e 56 typedef _ItemIntMapItemIntMap;57 ///\e 58 typedef _PrioPrio;57 typedef IM ItemIntMap; 58 ///\e 59 typedef PR Prio; 59 60 ///\e 60 61 typedef typename ItemIntMap::Key Item; … … 62 63 typedef std::pair<Item,Prio> Pair; 63 64 ///\e 64 typedef _CompareCompare;65 typedef CMP Compare; 65 66 66 67 /// \brief Type to represent the items states. … … 70 71 /// heap's point of view, but may be useful to the user. 71 72 /// 72 /// The ItemIntMap \e should be initialized in such way that it maps73 /// PRE_HEAP (-1) to any element to be put in the heap...73 /// The item-int map must be initialized in such way that it assigns 74 /// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap. 74 75 enum State { 75 IN_HEAP = 0, 76 PRE_HEAP = -1, 77 POST_HEAP = -2 76 IN_HEAP = 0, ///< = 0. 77 PRE_HEAP = -1, ///< = -1. 78 POST_HEAP = -2 ///< = -2. 78 79 }; 79 80 80 81 private: 81 std::vector<Pair> data;82 Compare comp;83 ItemIntMap & iim;82 std::vector<Pair> _data; 83 Compare _comp; 84 ItemIntMap &_iim; 84 85 85 86 public: … … 87 88 /// 88 89 /// The constructor. 89 /// \param _iim should be given to the constructor, since it is used 90 /// \param map should be given to the constructor, since it is used 91 /// internally to handle the cross references. The value of the map 92 /// must be \c PRE_HEAP (<tt>-1</tt>) for every item. 93 explicit BinHeap(ItemIntMap &map) : _iim(map) {} 94 95 /// \brief The constructor. 96 /// 97 /// The constructor. 98 /// \param map should be given to the constructor, since it is used 90 99 /// internally to handle the cross references. The value of the map 91 100 /// should be PRE_HEAP (-1) for each element. 92 explicit BinHeap(ItemIntMap &_iim) : iim(_iim) {} 93 94 /// \brief The constructor. 95 /// 96 /// The constructor. 97 /// \param _iim should be given to the constructor, since it is used 98 /// internally to handle the cross references. The value of the map 99 /// should be PRE_HEAP (-1) for each element. 100 /// 101 /// \param _comp The comparator function object. 102 BinHeap(ItemIntMap &_iim, const Compare &_comp) 103 : iim(_iim), comp(_comp) {} 101 /// 102 /// \param comp The comparator function object. 103 BinHeap(ItemIntMap &map, const Compare &comp) 104 : _iim(map), _comp(comp) {} 104 105 105 106 … … 107 108 /// 108 109 /// \brief Returns the number of items stored in the heap. 109 int size() const { return data.size(); }110 int size() const { return _data.size(); } 110 111 111 112 /// \brief Checks if the heap stores no items. 112 113 /// 113 114 /// Returns \c true if and only if the heap stores no items. 114 bool empty() const { return data.empty(); }115 bool empty() const { return _data.empty(); } 115 116 116 117 /// \brief Make empty this heap. … … 121 122 /// each item to \c PRE_HEAP. 122 123 void clear() { 123 data.clear();124 _data.clear(); 124 125 } 125 126 … … 129 130 static int second_child(int i) { return 2*i+2; } 130 131 bool less(const Pair &p1, const Pair &p2) const { 131 return comp(p1.second, p2.second);132 return _comp(p1.second, p2.second); 132 133 } 133 134 134 135 int bubble_up(int hole, Pair p) { 135 136 int par = parent(hole); 136 while( hole>0 && less(p, data[par]) ) {137 move( data[par],hole);137 while( hole>0 && less(p,_data[par]) ) { 138 move(_data[par],hole); 138 139 hole = par; 139 140 par = parent(hole); … … 146 147 int child = second_child(hole); 147 148 while(child < length) { 148 if( less( data[child-1],data[child]) ) {149 if( less(_data[child-1], _data[child]) ) { 149 150 --child; 150 151 } 151 if( !less( data[child], p) )152 if( !less(_data[child], p) ) 152 153 goto ok; 153 move( data[child], hole);154 move(_data[child], hole); 154 155 hole = child; 155 156 child = second_child(hole); 156 157 } 157 158 child--; 158 if( child<length && less( data[child], p) ) {159 move( data[child], hole);159 if( child<length && less(_data[child], p) ) { 160 move(_data[child], hole); 160 161 hole=child; 161 162 } … … 166 167 167 168 void move(const Pair &p, int i) { 168 data[i] = p;169 iim.set(p.first, i);169 _data[i] = p; 170 _iim.set(p.first, i); 170 171 } 171 172 … … 176 177 /// \param p The pair to insert. 177 178 void push(const Pair &p) { 178 int n = data.size();179 data.resize(n+1);179 int n = _data.size(); 180 _data.resize(n+1); 180 181 bubble_up(n, p); 181 182 } … … 194 195 /// \pre The heap must be nonempty. 195 196 Item top() const { 196 return data[0].first;197 return _data[0].first; 197 198 } 198 199 … … 202 203 /// \pre The heap must be nonempty. 203 204 Prio prio() const { 204 return data[0].second;205 return _data[0].second; 205 206 } 206 207 … … 211 212 /// \pre The heap must be non-empty. 212 213 void pop() { 213 int n = data.size()-1;214 iim.set(data[0].first, POST_HEAP);214 int n = _data.size()-1; 215 _iim.set(_data[0].first, POST_HEAP); 215 216 if (n > 0) { 216 bubble_down(0, data[n], n);217 } 218 data.pop_back();217 bubble_down(0, _data[n], n); 218 } 219 _data.pop_back(); 219 220 } 220 221 … … 225 226 /// \pre The item should be in the heap. 226 227 void erase(const Item &i) { 227 int h = iim[i];228 int n = data.size()-1;229 iim.set(data[h].first, POST_HEAP);228 int h = _iim[i]; 229 int n = _data.size()-1; 230 _iim.set(_data[h].first, POST_HEAP); 230 231 if( h < n ) { 231 if ( bubble_up(h, data[n]) == h) {232 bubble_down(h, data[n], n);232 if ( bubble_up(h, _data[n]) == h) { 233 bubble_down(h, _data[n], n); 233 234 } 234 235 } 235 data.pop_back();236 _data.pop_back(); 236 237 } 237 238 … … 240 241 /// 241 242 /// This function returns the priority of item \c i. 243 /// \param i The item. 242 244 /// \pre \c i must be in the heap. 243 /// \param i The item.244 245 Prio operator[](const Item &i) const { 245 int idx = iim[i];246 return data[idx].second;246 int idx = _iim[i]; 247 return _data[idx].second; 247 248 } 248 249 … … 255 256 /// \param p The priority. 256 257 void set(const Item &i, const Prio &p) { 257 int idx = iim[i];258 int idx = _iim[i]; 258 259 if( idx < 0 ) { 259 260 push(i,p); 260 261 } 261 else if( comp(p,data[idx].second) ) {262 else if( _comp(p, _data[idx].second) ) { 262 263 bubble_up(idx, Pair(i,p)); 263 264 } 264 265 else { 265 bubble_down(idx, Pair(i,p), data.size());266 bubble_down(idx, Pair(i,p), _data.size()); 266 267 } 267 268 } … … 270 271 /// 271 272 /// This method decreases the priority of item \c i to \c p. 273 /// \param i The item. 274 /// \param p The priority. 272 275 /// \pre \c i must be stored in the heap with priority at least \c 273 276 /// p relative to \c Compare. 277 void decrease(const Item &i, const Prio &p) { 278 int idx = _iim[i]; 279 bubble_up(idx, Pair(i,p)); 280 } 281 282 /// \brief Increases the priority of \c i to \c p. 283 /// 284 /// This method sets the priority of item \c i to \c p. 274 285 /// \param i The item. 275 286 /// \param p The priority. 276 void decrease(const Item &i, const Prio &p) {277 int idx = iim[i];278 bubble_up(idx, Pair(i,p));279 }280 281 /// \brief Increases the priority of \c i to \c p.282 ///283 /// This method sets the priority of item \c i to \c p.284 287 /// \pre \c i must be stored in the heap with priority at most \c 285 288 /// p relative to \c Compare. 286 /// \param i The item.287 /// \param p The priority.288 289 void increase(const Item &i, const Prio &p) { 289 int idx = iim[i];290 bubble_down(idx, Pair(i,p), data.size());290 int idx = _iim[i]; 291 bubble_down(idx, Pair(i,p), _data.size()); 291 292 } 292 293 … … 300 301 /// \param i The item. 301 302 State state(const Item &i) const { 302 int s = iim[i];303 int s = _iim[i]; 303 304 if( s>=0 ) 304 305 s=0; … … 320 321 erase(i); 321 322 } 322 iim[i] = st;323 _iim[i] = st; 323 324 break; 324 325 case IN_HEAP: … … 334 335 /// with the same prioriority as prevoiusly the \c i item. 335 336 void replace(const Item& i, const Item& j) { 336 int idx = iim[i];337 iim.set(i,iim[j]);338 iim.set(j, idx);339 data[idx].first = j;337 int idx = _iim[i]; 338 _iim.set(i, _iim[j]); 339 _iim.set(j, idx); 340 _data[idx].first = j; 340 341 } 341 342 -
lemon/bits/array_map.h
r463 r664 48 48 public: 49 49 // The graph type. 50 typedef _Graph Graph ;50 typedef _Graph GraphType; 51 51 // The item type. 52 52 typedef _Item Item; … … 64 64 typedef _Value& Reference; 65 65 66 // The map type. 67 typedef ArrayMap Map; 68 66 69 // The notifier type. 67 70 typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier; 68 71 72 private: 73 69 74 // The MapBase of the Map which imlements the core regisitry function. 70 75 typedef typename Notifier::ObserverBase Parent; 71 76 72 private:73 77 typedef std::allocator<Value> Allocator; 74 78 … … 78 82 // 79 83 // Graph initialized map constructor. 80 explicit ArrayMap(const Graph & graph) {84 explicit ArrayMap(const GraphType& graph) { 81 85 Parent::attach(graph.notifier(Item())); 82 86 allocate_memory(); … … 92 96 // 93 97 // It constructs a map and initialize all of the the map. 94 ArrayMap(const Graph & graph, const Value& value) {98 ArrayMap(const GraphType& graph, const Value& value) { 95 99 Parent::attach(graph.notifier(Item())); 96 100 allocate_memory(); … … 136 140 // \brief Template assign operator. 137 141 // 138 // The given parameter should beconform to the ReadMap142 // The given parameter should conform to the ReadMap 139 143 // concecpt and could be indiced by the current item set of 140 144 // the NodeMap. In this case the value for each item -
lemon/bits/default_map.h
r463 r674 20 20 #define LEMON_BITS_DEFAULT_MAP_H 21 21 22 #include <lemon/config.h> 22 23 #include <lemon/bits/array_map.h> 23 24 #include <lemon/bits/vector_map.h> … … 97 98 98 99 99 #if defined __GNUC__ && !defined __STRICT_ANSI__100 #if defined LEMON_HAVE_LONG_LONG 100 101 101 102 // long long … … 153 154 class DefaultMap 154 155 : public DefaultMapSelector<_Graph, _Item, _Value>::Map { 156 typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent; 157 155 158 public: 156 typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;157 159 typedef DefaultMap<_Graph, _Item, _Value> Map; 158 159 typedef typename Parent::Graph Graph;160 161 typedef typename Parent::GraphType GraphType; 160 162 typedef typename Parent::Value Value; 161 163 162 explicit DefaultMap(const Graph & graph) : Parent(graph) {}163 DefaultMap(const Graph & graph, const Value& value)164 explicit DefaultMap(const GraphType& graph) : Parent(graph) {} 165 DefaultMap(const GraphType& graph, const Value& value) 164 166 : Parent(graph, value) {} 165 167 -
lemon/bits/graph_adaptor_extender.h
r478 r965 23 23 #include <lemon/error.h> 24 24 25 #include <lemon/bits/default_map.h>26 27 25 namespace lemon { 28 26 29 27 template <typename _Digraph> 30 28 class DigraphAdaptorExtender : public _Digraph { 29 typedef _Digraph Parent; 30 31 31 public: 32 32 33 typedef _Digraph Parent;34 33 typedef _Digraph Digraph; 35 34 typedef DigraphAdaptorExtender Adaptor; … … 176 175 template <typename _Graph> 177 176 class GraphAdaptorExtende