Changes in / [538:a76f55d7d397:675:586b65073025] in lemon
- Files:
-
- 67 added
- 106 edited
Legend:
- Unmodified
- Added
- Removed
-
.hgignore
r514 r610 23 23 lemon/stamp-h2 24 24 doc/Doxyfile 25 cmake/ cmake.version25 cmake/version.cmake 26 26 .dirstamp 27 27 .libs/* 28 28 .deps/* 29 29 demo/*.eps 30 m4/libtool.m4 31 m4/ltoptions.m4 32 m4/ltsugar.m4 33 m4/ltversion.m4 34 m4/lt~obsolete.m4 30 35 31 36 syntax: regexp … … 36 41 ^autom4te.cache/.* 37 42 ^build-aux/.* 38 ^ objs.*/.*43 ^.*objs.*/.* 39 44 ^test/[a-z_]*$ 45 ^tools/[a-z-_]*$ 40 46 ^demo/.*_demo$ 41 ^ build/.*47 ^.*build.*/.* 42 48 ^doc/gen-images/.* 43 49 CMakeFiles -
CMakeLists.txt
r520 r674 10 10 PROJECT(${PROJECT_NAME}) 11 11 12 SET(CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR}/cmake)12 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) 13 13 14 14 INCLUDE(FindDoxygen) 15 15 INCLUDE(FindGhostscript) 16 FIND_PACKAGE(GLPK 4.33) 17 FIND_PACKAGE(CPLEX) 18 FIND_PACKAGE(COIN) 19 20 ADD_DEFINITIONS(-DHAVE_CONFIG_H) 21 22 IF(MSVC) 23 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4800 /wd4996") 24 # Suppressed warnings: 25 # C4250: 'class1' : inherits 'class2::member' via dominance 26 # C4355: 'this' : used in base member initializer list 27 # C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) 28 # C4996: 'function': was declared deprecated 29 ENDIF(MSVC) 30 31 ADD_DEFINITIONS(-DHAVE_CONFIG_H) 16 32 17 33 INCLUDE(CheckTypeSize) 18 CHECK_TYPE_SIZE("long long" L ONG_LONG)34 CHECK_TYPE_SIZE("long long" LEMON_LONG_LONG) 19 35 20 36 ENABLE_TESTING() 21 37 22 38 ADD_SUBDIRECTORY(lemon) 23 ADD_SUBDIRECTORY(demo) 24 ADD_SUBDIRECTORY(doc) 25 ADD_SUBDIRECTORY(test) 39 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) 40 ADD_SUBDIRECTORY(demo) 41 ADD_SUBDIRECTORY(tools) 42 ADD_SUBDIRECTORY(doc) 43 ADD_SUBDIRECTORY(test) 44 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) 26 45 27 IF(WIN32) 28 SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) 29 SET(CPACK_PACKAGE_VENDOR "EGRES") 30 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY 31 "LEMON - Library of Efficient Models and Optimization in Networks") 32 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") 46 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) 47 IF(WIN32) 48 SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) 49 SET(CPACK_PACKAGE_VENDOR "EGRES") 50 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY 51 "LEMON - Library of Efficient Models and Optimization in Networks") 52 SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") 33 53 34 SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})54 SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) 35 55 36 SET(CPACK_PACKAGE_INSTALL_DIRECTORY37 "${PROJECT_NAME} ${PROJECT_VERSION}")38 SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY39 "${PROJECT_NAME} ${PROJECT_VERSION}")56 SET(CPACK_PACKAGE_INSTALL_DIRECTORY 57 "${PROJECT_NAME} ${PROJECT_VERSION}") 58 SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY 59 "${PROJECT_NAME} ${PROJECT_VERSION}") 40 60 41 SET(CPACK_COMPONENTS_ALL headers library html_documentation)61 SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) 42 62 43 SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") 44 SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") 45 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") 63 SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") 64 SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") 65 SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") 66 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") 46 67 47 SET(CPACK_COMPONENT_HEADERS_DESCRIPTION 48 "C++ header files") 49 SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION 50 "DLL and import library") 51 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION 52 "Doxygen generated documentation") 68 SET(CPACK_COMPONENT_HEADERS_DESCRIPTION 69 "C++ header files") 70 SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION 71 "DLL and import library") 72 SET(CPACK_COMPONENT_BIN_DESCRIPTION 73 "Command line utilities") 74 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION 75 "Doxygen generated documentation") 53 76 54 SET(CPACK_COMPONENT_HEADERS_DEPENDS library)77 SET(CPACK_COMPONENT_HEADERS_DEPENDS library) 55 78 56 SET(CPACK_COMPONENT_HEADERS_GROUP "Development")57 SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")58 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")79 SET(CPACK_COMPONENT_HEADERS_GROUP "Development") 80 SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") 81 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") 59 82 60 SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION61 "Components needed to develop software using LEMON")62 SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION63 "Documentation of LEMON")83 SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION 84 "Components needed to develop software using LEMON") 85 SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION 86 "Documentation of LEMON") 64 87 65 SET(CPACK_ALL_INSTALL_TYPES Full Developer)88 SET(CPACK_ALL_INSTALL_TYPES Full Developer) 66 89 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)90 SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) 91 SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) 92 SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) 70 93 71 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")75 SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")76 SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")77 SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")78 SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")79 SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")80 SET(CPACK_NSIS_CREATE_ICONS_EXTRA "81 CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"82 ")83 SET(CPACK_NSIS_DELETE_ICONS_EXTRA "84 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP85 Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"86 ")94 SET(CPACK_GENERATOR "NSIS") 95 SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico") 96 SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico") 97 #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp") 98 SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") 99 SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}") 100 SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu") 101 SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu") 102 SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu") 103 SET(CPACK_NSIS_CREATE_ICONS_EXTRA " 104 CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\" 105 ") 106 SET(CPACK_NSIS_DELETE_ICONS_EXTRA " 107 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP 108 Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\" 109 ") 87 110 88 INCLUDE(CPack) 89 ENDIF(WIN32) 111 INCLUDE(CPack) 112 ENDIF(WIN32) 113 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) -
INSTALL
r526 r615 28 28 29 29 This command compiles the non-template part of LEMON into libemon.a 30 file. It also compiles the programs in the tools and demo subdirectories31 when enabled.30 file. It also compiles the programs in the tools subdirectory by 31 default. 32 32 33 33 4. `make check' … … 75 75 76 76 Set the installation prefix to PREFIX. By default it is /usr/local. 77 78 --enable-demo79 80 Build the examples in the demo subdirectory.81 82 --disable-demo83 84 Do not build the examples in the demo subdirectory (default).85 77 86 78 --enable-tools … … 159 151 160 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
r530 r600 2 2 copyright/license. 3 3 4 Copyright (C) 2003-200 8Egervary Jeno Kombinatorikus Optimalizalasi4 Copyright (C) 2003-2009 Egervary Jeno Kombinatorikus Optimalizalasi 5 5 Kutatocsoport (Egervary Combinatorial Optimization Research Group, 6 6 EGRES). -
Makefile.am
r503 r614 1 1 ACLOCAL_AMFLAGS = -I m4 2 3 AM_CXXFLAGS = $(WARNINGCXXFLAGS) 2 4 3 5 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir) … … 10 12 m4/lx_check_glpk.m4 \ 11 13 m4/lx_check_soplex.m4 \ 14 m4/lx_check_clp.m4 \ 15 m4/lx_check_cbc.m4 \ 12 16 CMakeLists.txt \ 13 17 cmake/FindGhostscript.cmake \ 18 cmake/FindGLPK.cmake \ 14 19 cmake/version.cmake.in \ 15 20 cmake/version.cmake \ … … 37 42 include test/Makefile.am 38 43 include doc/Makefile.am 39 include demo/Makefile.am40 44 include tools/Makefile.am 45 46 DIST_SUBDIRS = demo 47 48 demo: 49 $(MAKE) $(AM_MAKEFLAGS) -C demo 41 50 42 51 MRPROPERFILES = \ … … 66 75 bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2 67 76 68 .PHONY: mrproper dist-bz2 distcheck-bz277 .PHONY: demo mrproper dist-bz2 distcheck-bz2 -
configure.ac
r515 r674 20 20 AC_CONFIG_HEADERS([config.h lemon/config.h]) 21 21 22 lx_cmdline_cxxflags_set=${CXXFLAGS+set}23 24 22 dnl Do compilation tests using the C++ compiler. 25 23 AC_LANG([C++]) … … 28 26 AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no]) 29 27 if test x"$long_long_found" = x"yes"; then 30 AC_DEFINE([ HAVE_LONG_LONG], [1], [Define to 1 if you have long long.])28 AC_DEFINE([LEMON_HAVE_LONG_LONG], [1], [Define to 1 if you have long long.]) 31 29 fi 32 30 … … 53 51 54 52 dnl Set custom compiler flags when using g++. 55 if test x"$lx_cmdline_cxxflags_set" != x"set" -a"$GXX" = yes -a "$ICC" = no; then56 CXXFLAGS="$CXXFLAGS -Wall -W -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-Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"53 if test "$GXX" = yes -a "$ICC" = no; then 54 WARNINGCXXFLAGS="-Wall -W -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 -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas" 57 55 fi 56 AC_SUBST([WARNINGCXXFLAGS]) 58 57 59 58 dnl Checks for libraries. 60 #LX_CHECK_GLPK 61 #LX_CHECK_CPLEX 62 #LX_CHECK_SOPLEX 59 LX_CHECK_GLPK 60 LX_CHECK_CPLEX 61 LX_CHECK_SOPLEX 62 LX_CHECK_COIN 63 63 64 dnl Disable/enable building the demo programs. 65 AC_ARG_ENABLE([demo], 66 AS_HELP_STRING([--enable-demo], [build the demo programs]) 67 AS_HELP_STRING([--disable-demo], [do not build the demo programs @<:@default@:>@]), 68 [], [enable_demo=no]) 69 AC_MSG_CHECKING([whether to build the demo programs]) 70 if test x"$enable_demo" != x"no"; then 71 AC_MSG_RESULT([yes]) 72 else 73 AC_MSG_RESULT([no]) 74 fi 75 AM_CONDITIONAL([WANT_DEMO], [test x"$enable_demo" != x"no"]) 64 AM_CONDITIONAL([HAVE_LP], [test x"$lx_lp_found" = x"yes"]) 65 AM_CONDITIONAL([HAVE_MIP], [test x"$lx_mip_found" = x"yes"]) 76 66 77 67 dnl Disable/enable building the binary tools. … … 108 98 AC_CONFIG_FILES([ 109 99 Makefile 100 demo/Makefile 110 101 cmake/version.cmake 111 102 doc/Doxyfile … … 121 112 echo 122 113 echo C++ compiler.................. : $CXX 123 echo C++ compiles flags............ : $ CXXFLAGS114 echo C++ compiles flags............ : $WARNINGCXXFLAGS $CXXFLAGS 124 115 echo 125 116 echo Compiler supports long long... : $long_long_found 126 117 echo 127 #echo GLPK support.................. : $lx_glpk_found 128 #echo CPLEX support................. : $lx_cplex_found 129 #echo SOPLEX support................ : $lx_soplex_found 130 #echo 131 echo Build demo programs........... : $enable_demo 118 echo GLPK support.................. : $lx_glpk_found 119 echo CPLEX support................. : $lx_cplex_found 120 echo SOPLEX support................ : $lx_soplex_found 121 echo CLP support................... : $lx_clp_found 122 echo CBC support................... : $lx_cbc_found 123 echo 132 124 echo Build additional tools........ : $enable_tools 133 125 echo -
demo/CMakeLists.txt
r225 r674 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(${PROJECT_BINARY_DIR}/lemon) 4 7 5 8 SET(DEMOS -
demo/Makefile.am
r164 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/arg_parser_demo.cc
r311 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
demo/graph_to_eps_demo.cc
r313 r659 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 86 86 coords(coords). 87 87 title("Sample .eps figure"). 88 copyright("(C) 2003-200 8LEMON Project").88 copyright("(C) 2003-2009 LEMON Project"). 89 89 run(); 90 90 … … 93 93 coords(coords). 94 94 title("Sample .eps figure"). 95 copyright("(C) 2003-200 8LEMON Project").95 copyright("(C) 2003-2009 LEMON Project"). 96 96 absoluteNodeSizes().absoluteArcWidths(). 97 97 nodeScale(2).nodeSizes(sizes). … … 106 106 graphToEps(g,"graph_to_eps_demo_out_3_arr.eps"). 107 107 title("Sample .eps figure (with arrowheads)"). 108 copyright("(C) 2003-200 8LEMON Project").108 copyright("(C) 2003-2009 LEMON Project"). 109 109 absoluteNodeSizes().absoluteArcWidths(). 110 110 nodeColors(composeMap(palette,colors)). … … 133 133 graphToEps(g,"graph_to_eps_demo_out_4_par.eps"). 134 134 title("Sample .eps figure (parallel arcs)"). 135 copyright("(C) 2003-200 8LEMON Project").135 copyright("(C) 2003-2009 LEMON Project"). 136 136 absoluteNodeSizes().absoluteArcWidths(). 137 137 nodeShapes(shapes). … … 148 148 graphToEps(g,"graph_to_eps_demo_out_5_par_arr.eps"). 149 149 title("Sample .eps figure (parallel arcs and arrowheads)"). 150 copyright("(C) 2003-200 8LEMON Project").150 copyright("(C) 2003-2009 LEMON Project"). 151 151 absoluteNodeSizes().absoluteArcWidths(). 152 152 nodeScale(2).nodeSizes(sizes). … … 164 164 graphToEps(g,"graph_to_eps_demo_out_6_par_arr_a4.eps"). 165 165 title("Sample .eps figure (fits to A4)"). 166 copyright("(C) 2003-200 8LEMON Project").166 copyright("(C) 2003-2009 LEMON Project"). 167 167 scaleToA4(). 168 168 absoluteNodeSizes().absoluteArcWidths(). … … 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(); … … 194 194 scale(60). 195 195 title("Sample .eps figure (Palette demo)"). 196 copyright("(C) 2003-200 8LEMON Project").196 copyright("(C) 2003-2009 LEMON Project"). 197 197 coords(hcoords). 198 198 absoluteNodeSizes().absoluteArcWidths(). -
demo/lgf_demo.cc
r294 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
doc/CMakeLists.txt
r520 r633 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 5 6 6 CONFIGURE_FILE( 7 ${ CMAKE_SOURCE_DIR}/doc/Doxyfile.in8 ${ CMAKE_BINARY_DIR}/doc/Doxyfile7 ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in 8 ${PROJECT_BINARY_DIR}/doc/Doxyfile 9 9 @ONLY) 10 10 … … 15 15 COMMAND rm -rf gen-images 16 16 COMMAND mkdir gen-images 17 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps 18 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps 19 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps 20 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps 21 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 22 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps 17 23 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 24 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 … … 20 26 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 27 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 28 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps 22 29 COMMAND rm -rf html 23 30 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile … … 27 34 COMMAND if exist gen-images rmdir /s /q gen-images 28 35 COMMAND mkdir gen-images 36 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps 37 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps 38 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps 39 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps 40 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 41 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps 29 42 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 43 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 … … 32 45 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 46 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 47 COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps 34 48 COMMAND if exist html rmdir /s /q html 35 49 COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile -
doc/Doxyfile.in
r316 r379 67 67 ENABLED_SECTIONS = 68 68 MAX_INITIALIZER_LINES = 5 69 SHOW_USED_FILES = YES69 SHOW_USED_FILES = NO 70 70 SHOW_DIRECTORIES = YES 71 71 SHOW_FILES = YES -
doc/Makefile.am
r317 r634 15 15 16 16 DOC_EPS_IMAGES18 = \ 17 grid_graph.eps \ 17 18 nodeshape_0.eps \ 18 19 nodeshape_1.eps \ … … 21 22 nodeshape_4.eps 22 23 24 DOC_EPS_IMAGES27 = \ 25 bipartite_matching.eps \ 26 bipartite_partitions.eps \ 27 connected_components.eps \ 28 edge_biconnected_components.eps \ 29 node_biconnected_components.eps \ 30 strongly_connected_components.eps 31 23 32 DOC_EPS_IMAGES = \ 24 $(DOC_EPS_IMAGES18) 33 $(DOC_EPS_IMAGES18) \ 34 $(DOC_EPS_IMAGES27) 25 35 26 36 DOC_PNG_IMAGES = \ … … 38 48 if test ${gs_found} = yes; then \ 39 49 $(GS_COMMAND) -sDEVICE=pngalpha -r18 -sOutputFile=$@ $<; \ 50 else \ 51 echo; \ 52 echo "Ghostscript not found."; \ 53 echo; \ 54 exit 1; \ 55 fi 56 57 $(DOC_EPS_IMAGES27:%.eps=doc/gen-images/%.png): doc/gen-images/%.png: doc/images/%.eps 58 -mkdir doc/gen-images 59 if test ${gs_found} = yes; then \ 60 $(GS_COMMAND) -sDEVICE=pngalpha -r27 -sOutputFile=$@ $<; \ 40 61 else \ 41 62 echo; \ -
doc/coding_style.dox
r210 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
doc/dirs.dox
r318 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 72 72 \brief Auxiliary tools for implementation. 73 73 74 This directory contains some auxiliary classes for implementing graphs, 74 This directory contains some auxiliary classes for implementing graphs, 75 75 maps and some other classes. 76 76 As a user you typically don't have to deal with these files. -
doc/groups.dox
r318 r658 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 17 17 */ 18 18 19 namespace lemon { 20 19 21 /** 20 22 @defgroup datas Data Structures 21 This group describes the several data structures implemented in LEMON.23 This group contains the several data structures implemented in LEMON. 22 24 */ 23 25 … … 61 63 62 64 /** 65 @defgroup graph_adaptors Adaptor Classes for Graphs 66 @ingroup graphs 67 \brief Adaptor classes for digraphs and graphs 68 69 This group contains several useful adaptor classes for digraphs and graphs. 70 71 The main parts of LEMON are the different graph structures, generic 72 graph algorithms, graph concepts, which couple them, and graph 73 adaptors. While the previous notions are more or less clear, the 74 latter one needs further explanation. Graph adaptors are graph classes 75 which serve for considering graph structures in different ways. 76 77 A short example makes this much clearer. Suppose that we have an 78 instance \c g of a directed graph type, say ListDigraph and an algorithm 79 \code 80 template <typename Digraph> 81 int algorithm(const Digraph&); 82 \endcode 83 is needed to run on the reverse oriented graph. It may be expensive 84 (in time or in memory usage) to copy \c g with the reversed 85 arcs. In this case, an adaptor class is used, which (according 86 to LEMON \ref concepts::Digraph "digraph concepts") works as a digraph. 87 The adaptor uses the original digraph structure and digraph operations when 88 methods of the reversed oriented graph are called. This means that the adaptor 89 have minor memory usage, and do not perform sophisticated algorithmic 90 actions. The purpose of it is to give a tool for the cases when a 91 graph have to be used in a specific alteration. If this alteration is 92 obtained by a usual construction like filtering the node or the arc set or 93 considering a new orientation, then an adaptor is worthwhile to use. 94 To come back to the reverse oriented graph, in this situation 95 \code 96 template<typename Digraph> class ReverseDigraph; 97 \endcode 98 template class can be used. The code looks as follows 99 \code 100 ListDigraph g; 101 ReverseDigraph<ListDigraph> rg(g); 102 int result = algorithm(rg); 103 \endcode 104 During running the algorithm, the original digraph \c g is untouched. 105 This techniques give rise to an elegant code, and based on stable 106 graph adaptors, complex algorithms can be implemented easily. 107 108 In flow, circulation and matching problems, the residual 109 graph is of particular importance. Combining an adaptor implementing 110 this with shortest path algorithms or minimum mean cycle algorithms, 111 a range of weighted and cardinality optimization algorithms can be 112 obtained. For other examples, the interested user is referred to the 113 detailed documentation of particular adaptors. 114 115 The behavior of graph adaptors can be very different. Some of them keep 116 capabilities of the original graph while in other cases this would be 117 meaningless. This means that the concepts that they meet depend 118 on the graph adaptor, and the wrapped graph. 119 For example, if an arc of a reversed digraph is deleted, this is carried 120 out by deleting the corresponding arc of the original digraph, thus the 121 adaptor modifies the original digraph. 122 However in case of a residual digraph, this operation has no sense. 123 124 Let us stand one more example here to simplify your work. 125 ReverseDigraph has constructor 126 \code 127 ReverseDigraph(Digraph& digraph); 128 \endcode 129 This means that in a situation, when a <tt>const %ListDigraph&</tt> 130 reference to a graph is given, then it have to be instantiated with 131 <tt>Digraph=const %ListDigraph</tt>. 132 \code 133 int algorithm1(const ListDigraph& g) { 134 ReverseDigraph<const ListDigraph> rg(g); 135 return algorithm2(rg); 136 } 137 \endcode 138 */ 139 140 /** 63 141 @defgroup semi_adaptors Semi-Adaptor Classes for Graphs 64 142 @ingroup graphs 65 143 \brief Graph types between real graphs and graph adaptors. 66 144 67 This group describes some graph types between real graphs and graph adaptors.145 This group contains some graph types between real graphs and graph adaptors. 68 146 These classes wrap graphs to give new functionality as the adaptors do it. 69 147 On the other hand they are not light-weight structures as the adaptors. … … 75 153 \brief Map structures implemented in LEMON. 76 154 77 This group describes the map structures implemented in LEMON.155 This group contains the map structures implemented in LEMON. 78 156 79 157 LEMON provides several special purpose maps and map adaptors that e.g. combine … … 88 166 \brief Special graph-related maps. 89 167 90 This group describes maps that are specifically designed to assign 91 values to the nodes and arcs of graphs. 168 This group contains maps that are specifically designed to assign 169 values to the nodes and arcs/edges of graphs. 170 171 If you are looking for the standard graph maps (\c NodeMap, \c ArcMap, 172 \c EdgeMap), see the \ref graph_concepts "Graph Structure Concepts". 92 173 */ 93 174 … … 97 178 \brief Tools to create new maps from existing ones 98 179 99 This group describes map adaptors that are used to create "implicit"180 This group contains map adaptors that are used to create "implicit" 100 181 maps from other maps. 101 182 102 Most of them are \ref lemon::concepts::ReadMap "read-only maps".183 Most of them are \ref concepts::ReadMap "read-only maps". 103 184 They can make arithmetic and logical operations between one or two maps 104 185 (negation, shifting, addition, multiplication, logical 'and', 'or', … … 160 241 \brief Two dimensional data storages implemented in LEMON. 161 242 162 This group describes two dimensional data storages implemented in LEMON.243 This group contains two dimensional data storages implemented in LEMON. 163 244 */ 164 245 … … 168 249 \brief %Path structures implemented in LEMON. 169 250 170 This group describes the path structures implemented in LEMON.251 This group contains the path structures implemented in LEMON. 171 252 172 253 LEMON provides flexible data structures to work with paths. … … 184 265 \brief Auxiliary data structures implemented in LEMON. 185 266 186 This group describes some data structures implemented in LEMON in267 This group contains some data structures implemented in LEMON in 187 268 order to make it easier to implement combinatorial algorithms. 188 269 */ … … 190 271 /** 191 272 @defgroup algs Algorithms 192 \brief This group describes the several algorithms273 \brief This group contains the several algorithms 193 274 implemented in LEMON. 194 275 195 This group describes the several algorithms276 This group contains the several algorithms 196 277 implemented in LEMON. 197 278 */ … … 202 283 \brief Common graph search algorithms. 203 284 204 This group describes the common graph search algorithms like205 Breadth-First Search (BFS) and Depth-First Search (DFS).285 This group contains the common graph search algorithms, namely 286 \e breadth-first \e search (BFS) and \e depth-first \e search (DFS). 206 287 */ 207 288 … … 211 292 \brief Algorithms for finding shortest paths. 212 293 213 This group describes the algorithms for finding shortest paths in graphs. 294 This group contains the algorithms for finding shortest paths in digraphs. 295 296 - \ref Dijkstra algorithm for finding shortest paths from a source node 297 when all arc lengths are non-negative. 298 - \ref BellmanFord "Bellman-Ford" algorithm for finding shortest paths 299 from a source node when arc lenghts can be either positive or negative, 300 but the digraph should not contain directed cycles with negative total 301 length. 302 - \ref FloydWarshall "Floyd-Warshall" and \ref Johnson "Johnson" algorithms 303 for solving the \e all-pairs \e shortest \e paths \e problem when arc 304 lenghts can be either positive or negative, but the digraph should 305 not contain directed cycles with negative total length. 306 - \ref Suurballe A successive shortest path algorithm for finding 307 arc-disjoint paths between two nodes having minimum total length. 214 308 */ 215 309 … … 219 313 \brief Algorithms for finding maximum flows. 220 314 221 This group describes the algorithms for finding maximum flows and315 This group contains the algorithms for finding maximum flows and 222 316 feasible circulations. 223 317 224 The maximum flow problem is to find a flow between a single source and 225 a single target that is maximum. Formally, there is a \f$G=(V,A)\f$ 226 directed graph, an \f$c_a:A\rightarrow\mathbf{R}^+_0\f$ capacity 227 function and given \f$s, t \in V\f$ source and target node. The 228 maximum flow is the \f$f_a\f$ solution of the next optimization problem: 229 230 \f[ 0 \le f_a \le c_a \f] 231 \f[ \sum_{v\in\delta^{-}(u)}f_{vu}=\sum_{v\in\delta^{+}(u)}f_{uv} 232 \qquad \forall u \in V \setminus \{s,t\}\f] 233 \f[ \max \sum_{v\in\delta^{+}(s)}f_{uv} - \sum_{v\in\delta^{-}(s)}f_{vu}\f] 318 The \e maximum \e flow \e problem is to find a flow of maximum value between 319 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 and 321 \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 the 323 following optimization problem. 324 325 \f[ \max\sum_{sv\in A} f(sv) - \sum_{vs\in A} f(vs) \f] 326 \f[ \sum_{uv\in A} f(uv) = \sum_{vu\in A} f(vu) 327 \quad \forall u\in V\setminus\{s,t\} \f] 328 \f[ 0 \leq f(uv) \leq cap(uv) \quad \forall uv\in A \f] 234 329 235 330 LEMON contains several algorithms for solving maximum flow problems: 236 - \ref lemon::EdmondsKarp "Edmonds-Karp"237 - \ref lemon::Preflow "Goldberg's Preflow algorithm"238 - \ref lemon::DinitzSleatorTarjan "Dinitz's blocking flow algorithm with dynamic trees"239 - \ref lemon::GoldbergTarjan "Preflow algorithm with dynamic trees"240 241 In most cases the \ref lemon::Preflow "Preflow" algorithm provides the242 fastest method to compute the maximum flow. All impelementations243 provides functions to query the minimum cut, which is the dual linear244 pro gramming problem of the maximum flow.331 - \ref EdmondsKarp Edmonds-Karp algorithm. 332 - \ref Preflow Goldberg-Tarjan's preflow push-relabel algorithm. 333 - \ref DinitzSleatorTarjan Dinitz's blocking flow algorithm with dynamic trees. 334 - \ref GoldbergTarjan Preflow push-relabel algorithm with dynamic trees. 335 336 In most cases the \ref Preflow "Preflow" algorithm provides the 337 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. 245 340 */ 246 341 … … 251 346 \brief Algorithms for finding minimum cost flows and circulations. 252 347 253 This group describes the algorithms for finding minimum cost flows and348 This group contains the algorithms for finding minimum cost flows and 254 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 (lower and upper bounds) 354 and arc costs. 355 Formally, let \f$G=(V,A)\f$ be a digraph, 356 \f$lower, upper: A\rightarrow\mathbf{Z}^+_0\f$ denote the lower and 357 upper bounds for the flow values on the arcs, for which 358 \f$0 \leq lower(uv) \leq upper(uv)\f$ holds for all \f$uv\in A\f$. 359 \f$cost: A\rightarrow\mathbf{Z}^+_0\f$ denotes the cost per unit flow 360 on the arcs, and \f$sup: V\rightarrow\mathbf{Z}\f$ denotes the 361 signed supply values of the nodes. 362 If \f$sup(u)>0\f$, then \f$u\f$ is a supply node with \f$sup(u)\f$ 363 supply, if \f$sup(u)<0\f$, then \f$u\f$ is a demand node with 364 \f$-sup(u)\f$ demand. 365 A minimum cost flow is an \f$f: A\rightarrow\mathbf{Z}^+_0\f$ solution 366 of the following optimization problem. 367 368 \f[ \min\sum_{uv\in A} f(uv) \cdot cost(uv) \f] 369 \f[ \sum_{uv\in A} f(uv) - \sum_{vu\in A} f(vu) \geq 370 sup(u) \quad \forall u\in V \f] 371 \f[ lower(uv) \leq f(uv) \leq upper(uv) \quad \forall uv\in A \f] 372 373 The sum of the supply values, i.e. \f$\sum_{u\in V} sup(u)\f$ must be 374 zero or negative in order to have a feasible solution (since the sum 375 of the expressions on the left-hand side of the inequalities is zero). 376 It means that the total demand must be greater or equal to the total 377 supply and all the supplies have to be carried out from the supply nodes, 378 but there could be demands that are not satisfied. 379 If \f$\sum_{u\in V} sup(u)\f$ is zero, then all the supply/demand 380 constraints have to be satisfied with equality, i.e. all demands 381 have to be satisfied and all supplies have to be used. 382 383 If you need the opposite inequalities in the supply/demand constraints 384 (i.e. the total demand is less than the total supply and all the demands 385 have to be satisfied while there could be supplies that are not used), 386 then you could easily transform the problem to the above form by reversing 387 the direction of the arcs and taking the negative of the supply values 388 (e.g. using \ref ReverseDigraph and \ref NegMap adaptors). 389 However \ref NetworkSimplex algorithm also supports this form directly 390 for the sake of convenience. 391 392 A feasible solution for this problem can be found using \ref Circulation. 393 394 Note that the above formulation is actually more general than the usual 395 definition of the minimum cost flow problem, in which strict equalities 396 are required in the supply/demand contraints, i.e. 397 398 \f[ \sum_{uv\in A} f(uv) - \sum_{vu\in A} f(vu) = 399 sup(u) \quad \forall u\in V. \f] 400 401 However if the sum of the supply values is zero, then these two problems 402 are equivalent. So if you need the equality form, you have to ensure this 403 additional contraint for the algorithms. 404 405 The dual solution of the minimum cost flow problem is represented by node 406 potentials \f$\pi: V\rightarrow\mathbf{Z}\f$. 407 An \f$f: A\rightarrow\mathbf{Z}^+_0\f$ feasible solution of the problem 408 is optimal if and only if for some \f$\pi: V\rightarrow\mathbf{Z}\f$ 409 node potentials the following \e complementary \e slackness optimality 410 conditions hold. 411 412 - For all \f$uv\in A\f$ arcs: 413 - if \f$cost^\pi(uv)>0\f$, then \f$f(uv)=lower(uv)\f$; 414 - if \f$lower(uv)<f(uv)<upper(uv)\f$, then \f$cost^\pi(uv)=0\f$; 415 - if \f$cost^\pi(uv)<0\f$, then \f$f(uv)=upper(uv)\f$. 416 - For all \f$u\in V\f$: 417 - if \f$\sum_{uv\in A} f(uv) - \sum_{vu\in A} f(vu) \neq sup(u)\f$, 418 then \f$\pi(u)=0\f$. 419 420 Here \f$cost^\pi(uv)\f$ denotes the \e reduced \e cost of the arc 421 \f$uv\in A\f$ with respect to the node potentials \f$\pi\f$, i.e. 422 \f[ cost^\pi(uv) = cost(uv) + \pi(u) - \pi(v).\f] 423 424 All algorithms provide dual solution (node potentials) as well 425 if an optimal flow is found. 426 427 LEMON contains several algorithms for solving minimum cost flow problems. 428 - \ref NetworkSimplex Primal Network Simplex algorithm with various 429 pivot strategies. 430 - \ref CostScaling Push-Relabel and Augment-Relabel algorithms based on 431 cost scaling. 432 - \ref CapacityScaling Successive Shortest %Path algorithm with optional 433 capacity scaling. 434 - \ref CancelAndTighten The Cancel and Tighten algorithm. 435 - \ref CycleCanceling Cycle-Canceling algorithms. 436 437 Most of these implementations support the general inequality form of the 438 minimum cost flow problem, but CancelAndTighten and CycleCanceling 439 only support the equality form due to the primal method they use. 440 441 In general NetworkSimplex is the most efficient implementation, 442 but in special cases other algorithms could be faster. 443 For example, if the total supply and/or capacities are rather small, 444 CapacityScaling is usually the fastest algorithm (without effective scaling). 255 445 */ 256 446 … … 261 451 \brief Algorithms for finding minimum cut in graphs. 262 452 263 This group describes the algorithms for finding minimum cut in graphs.264 265 The minimum cutproblem is to find a non-empty and non-complete266 \f$X\f$ subset of the vertices with minimum overall capacity on267 outgoing arcs. Formally, there is \f$G=(V,A)\f$ directed graph, an268 \f$c _a:A\rightarrow\mathbf{R}^+_0\f$ capacity function. The minimum453 This group contains the algorithms for finding minimum cut in graphs. 454 455 The \e minimum \e cut \e problem is to find a non-empty and non-complete 456 \f$X\f$ subset of the nodes with minimum overall capacity on 457 outgoing arcs. Formally, there is a \f$G=(V,A)\f$ digraph, a 458 \f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function. The minimum 269 459 cut is the \f$X\f$ solution of the next optimization problem: 270 460 271 461 \f[ \min_{X \subset V, X\not\in \{\emptyset, V\}} 272 \sum_{uv\in A, u\in X, v\not\in X}c_{uv}\f]462 \sum_{uv\in A, u\in X, v\not\in X}cap(uv) \f] 273 463 274 464 LEMON contains several algorithms related to minimum cut problems: 275 465 276 - \ref lemon::HaoOrlin "Hao-Orlin algorithm" to calculateminimum cut277 in directed graphs 278 - \ref lemon::NagamochiIbaraki "Nagamochi-Ibaraki algorithm" to279 calculat e minimum cut in undirected graphs280 - \ref lemon::GomoryHuTree "Gomory-Hu tree computation" to calculate all281 pairs minimum cut in undirected graphs466 - \ref HaoOrlin "Hao-Orlin algorithm" for calculating minimum cut 467 in directed graphs. 468 - \ref NagamochiIbaraki "Nagamochi-Ibaraki algorithm" for 469 calculating minimum cut in undirected graphs. 470 - \ref GomoryHu "Gomory-Hu tree computation" for calculating 471 all-pairs minimum cut in undirected graphs. 282 472 283 473 If you want to find minimum cut just between two distinict nodes, 284 please see the \ref max_flow "Maximum Flow page".285 */ 286 287 /** 288 @defgroup graph_prop Connectivity and Other Graph Properties474 see the \ref max_flow "maximum flow problem". 475 */ 476 477 /** 478 @defgroup graph_properties Connectivity and Other Graph Properties 289 479 @ingroup algs 290 480 \brief Algorithms for discovering the graph properties 291 481 292 This group describes the algorithms for discovering the graph properties482 This group contains the algorithms for discovering the graph properties 293 483 like connectivity, bipartiteness, euler property, simplicity etc. 294 484 … … 302 492 \brief Algorithms for planarity checking, embedding and drawing 303 493 304 This group describes the algorithms for planarity checking,494 This group contains the algorithms for planarity checking, 305 495 embedding and drawing. 306 496 … … 314 504 \brief Algorithms for finding matchings in graphs and bipartite graphs. 315 505 316 This group contains algorithm objects and functions to calculate506 This group contains the algorithms for calculating 317 507 matchings in graphs and bipartite graphs. The general matching problem is 318 finding a subset of the arcs which does not shares common endpoints. 508 finding a subset of the edges for which each node has at most one incident 509 edge. 319 510 320 511 There are several different algorithms for calculate matchings in 321 512 graphs. The matching problems in bipartite graphs are generally 322 513 easier than in general graphs. The goal of the matching optimization 323 can be thefinding maximum cardinality, maximum weight or minimum cost514 can be finding maximum cardinality, maximum weight or minimum cost 324 515 matching. The search can be constrained to find perfect or 325 516 maximum cardinality matching. 326 517 327 LEMON contains the next algorithms: 328 - \ref lemon::MaxBipartiteMatching "MaxBipartiteMatching" Hopcroft-Karp 329 augmenting path algorithm for calculate maximum cardinality matching in 330 bipartite graphs 331 - \ref lemon::PrBipartiteMatching "PrBipartiteMatching" Push-Relabel 332 algorithm for calculate maximum cardinality matching in bipartite graphs 333 - \ref lemon::MaxWeightedBipartiteMatching "MaxWeightedBipartiteMatching" 334 Successive shortest path algorithm for calculate maximum weighted matching 335 and maximum weighted bipartite matching in bipartite graph 336 - \ref lemon::MinCostMaxBipartiteMatching "MinCostMaxBipartiteMatching" 337 Successive shortest path algorithm for calculate minimum cost maximum 338 matching in bipartite graph 339 - \ref lemon::MaxMatching "MaxMatching" Edmond's blossom shrinking algorithm 340 for calculate maximum cardinality matching in general graph 341 - \ref lemon::MaxWeightedMatching "MaxWeightedMatching" Edmond's blossom 342 shrinking algorithm for calculate maximum weighted matching in general 343 graph 344 - \ref lemon::MaxWeightedPerfectMatching "MaxWeightedPerfectMatching" 345 Edmond's blossom shrinking algorithm for calculate maximum weighted 346 perfect matching in general graph 518 The matching algorithms implemented in LEMON: 519 - \ref MaxBipartiteMatching Hopcroft-Karp augmenting path algorithm 520 for calculating maximum cardinality matching in bipartite graphs. 521 - \ref PrBipartiteMatching Push-relabel algorithm 522 for calculating maximum cardinality matching in bipartite graphs. 523 - \ref MaxWeightedBipartiteMatching 524 Successive shortest path algorithm for calculating maximum weighted 525 matching and maximum weighted bipartite matching in bipartite graphs. 526 - \ref MinCostMaxBipartiteMatching 527 Successive shortest path algorithm for calculating minimum cost maximum 528 matching in bipartite graphs. 529 - \ref MaxMatching Edmond's blossom shrinking algorithm for calculating 530 maximum cardinality matching in general graphs. 531 - \ref MaxWeightedMatching Edmond's blossom shrinking algorithm for calculating 532 maximum weighted matching in general graphs. 533 - \ref MaxWeightedPerfectMatching 534 Edmond's blossom shrinking algorithm for calculating maximum weighted 535 perfect matching in general graphs. 347 536 348 537 \image html bipartite_matching.png … … 355 544 \brief Algorithms for finding a minimum cost spanning tree in a graph. 356 545 357 This group describes the algorithms for finding a minimum cost spanning358 tree in a graph 546 This group contains the algorithms for finding a minimum cost spanning 547 tree in a graph. 359 548 */ 360 549 … … 364 553 \brief Auxiliary algorithms implemented in LEMON. 365 554 366 This group describes some algorithms implemented in LEMON555 This group contains some algorithms implemented in LEMON 367 556 in order to make it easier to implement complex algorithms. 368 557 */ … … 373 562 \brief Approximation algorithms. 374 563 375 This group describes the approximation and heuristic algorithms564 This group contains the approximation and heuristic algorithms 376 565 implemented in LEMON. 377 566 */ … … 379 568 /** 380 569 @defgroup gen_opt_group General Optimization Tools 381 \brief This group describes some general optimization frameworks570 \brief This group contains some general optimization frameworks 382 571 implemented in LEMON. 383 572 384 This group describes some general optimization frameworks573 This group contains some general optimization frameworks 385 574 implemented in LEMON. 386 575 */ … … 391 580 \brief Lp and Mip solver interfaces for LEMON. 392 581 393 This group describes Lp and Mip solver interfaces for LEMON. The582 This group contains Lp and Mip solver interfaces for LEMON. The 394 583 various LP solvers could be used in the same manner with this 395 584 interface. … … 410 599 \brief Metaheuristics for LEMON library. 411 600 412 This group describes some metaheuristic optimization tools.601 This group contains some metaheuristic optimization tools. 413 602 */ 414 603 … … 425 614 \brief Simple basic graph utilities. 426 615 427 This group describes some simple basic graph utilities.616 This group contains some simple basic graph utilities. 428 617 */ 429 618 … … 433 622 \brief Tools for development, debugging and testing. 434 623 435 This group describes several useful tools for development,624 This group contains several useful tools for development, 436 625 debugging and testing. 437 626 */ … … 442 631 \brief Simple tools for measuring the performance of algorithms. 443 632 444 This group describes simple tools for measuring the performance633 This group contains simple tools for measuring the performance 445 634 of algorithms. 446 635 */ … … 451 640 \brief Exceptions defined in LEMON. 452 641 453 This group describes the exceptions defined in LEMON.642 This group contains the exceptions defined in LEMON. 454 643 */ 455 644 … … 458 647 \brief Graph Input-Output methods 459 648 460 This group describes the tools for importing and exporting graphs649 This group contains the tools for importing and exporting graphs 461 650 and graph related data. Now it supports the \ref lgf-format 462 651 "LEMON Graph Format", the \c DIMACS format and the encapsulated … … 465 654 466 655 /** 467 @defgroup lemon_io LEMON Input-Output656 @defgroup lemon_io LEMON Graph Format 468 657 @ingroup io_group 469 658 \brief Reading and writing LEMON Graph Format. 470 659 471 This group describes methods for reading and writing660 This group contains methods for reading and writing 472 661 \ref lgf-format "LEMON Graph Format". 473 662 */ … … 478 667 \brief General \c EPS drawer and graph exporter 479 668 480 This group describes general \c EPS drawing methods and special669 This group contains general \c EPS drawing methods and special 481 670 graph exporting tools. 671 */ 672 673 /** 674 @defgroup dimacs_group DIMACS format 675 @ingroup io_group 676 \brief Read and write files in DIMACS format 677 678 Tools to read a digraph from or write it to a file in DIMACS format data. 679 */ 680 681 /** 682 @defgroup nauty_group NAUTY Format 683 @ingroup io_group 684 \brief Read \e Nauty format 685 686 Tool to read graphs from \e Nauty format data. 482 687 */ 483 688 … … 486 691 \brief Skeleton classes and concept checking classes 487 692 488 This group describes the data/algorithm skeletons and concept checking693 This group contains the data/algorithm skeletons and concept checking 489 694 classes implemented in LEMON. 490 695 … … 516 721 \brief Skeleton and concept checking classes for graph structures 517 722 518 This group describes the skeletons and concept checking classes of LEMON's723 This group contains the skeletons and concept checking classes of LEMON's 519 724 graph structures and helper classes used to implement these. 520 725 */ … … 525 730 \brief Skeleton and concept checking classes for maps 526 731 527 This group describes the skeletons and concept checking classes of maps.732 This group contains the skeletons and concept checking classes of maps. 528 733 */ 529 734 … … 531 736 \anchor demoprograms 532 737 533 @defgroup demos Demo programs738 @defgroup demos Demo Programs 534 739 535 740 Some demo programs are listed here. Their full source codes can be found in 536 741 the \c demo subdirectory of the source tree. 537 742 538 I t order to compile them, use <tt>--enable-demo</tt> configure option when539 build the library.540 */ 541 542 /** 543 @defgroup tools Standalone utility applications743 In order to compile them, use the <tt>make demo</tt> or the 744 <tt>make check</tt> commands. 745 */ 746 747 /** 748 @defgroup tools Standalone Utility Applications 544 749 545 750 Some utility applications are listed here. … … 549 754 */ 550 755 756 } -
doc/lgf.dox
r313 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
doc/license.dox
r209 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
doc/mainpage.dox
r314 r606 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 46 46 "Quick Tour to LEMON" which will guide you along. 47 47 48 If you already feel like using our library, see the page that tells you 49 \ref getstart "How to start using LEMON". 50 51 If you 52 want to see how LEMON works, see 53 some \ref demoprograms "demo programs". 48 If you already feel like using our library, see the 49 <a class="el" href="http://lemon.cs.elte.hu/pub/tutorial/">LEMON Tutorial</a>. 54 50 55 51 If you know what you are looking for then try to find it under the 56 <a class="el" href="modules.html">Modules</a> 57 section. 52 <a class="el" href="modules.html">Modules</a> section. 58 53 59 54 If you are a user of the old (0.x) series of LEMON, please check out the -
doc/migration.dox
r314 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 26 26 27 27 Many of these changes adjusted automatically by the 28 <tt> script/lemon-0.x-to-1.x.sh</tt> tool. Those requiring manual28 <tt>lemon-0.x-to-1.x.sh</tt> tool. Those requiring manual 29 29 update are typeset <b>boldface</b>. 30 30 … … 54 54 55 55 \warning 56 <b>The <tt>script/lemon-0.x-to-1.x.sh</tt> tool replaces all instances of 57 the words \c graph, \c digraph, \c edge and \c arc, so it replaces them 58 in strings, comments etc. as well as in all identifiers.</b> 56 <b>The <tt>lemon-0.x-to-1.x.sh</tt> script replaces the words \c graph, 57 \c ugraph, \c edge and \c uedge in your own identifiers and in 58 strings, comments etc. as well as in all LEMON specific identifiers. 59 So use the script carefully and make a backup copy of your source files 60 before applying the script to them.</b> 59 61 60 62 \section migration-lgf LGF tools -
doc/named-param.dox
r269 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
doc/namespaces.dox
r209 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
doc/template.h
r209 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/CMakeLists.txt
r511 r674 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 SET(LEMON_SOURCES 4 12 arg_parser.cc 5 13 base.cc 6 14 color.cc 15 lp_base.cc 16 lp_skeleton.cc 7 17 random.cc 8 18 bits/windows.cc 9 19 ) 20 21 IF(LEMON_HAVE_GLPK) 22 SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc) 23 INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIRS}) 24 IF(WIN32) 25 INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin) 26 INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin) 27 INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin) 28 ENDIF(WIN32) 29 ENDIF(LEMON_HAVE_GLPK) 30 31 IF(LEMON_HAVE_CPLEX) 32 SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc) 33 INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS}) 34 ENDIF(LEMON_HAVE_CPLEX) 35 36 IF(LEMON_HAVE_CLP) 37 SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc) 38 INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) 39 ENDIF(LEMON_HAVE_CLP) 40 41 IF(LEMON_HAVE_CBC) 42 SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc) 43 INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) 44 ENDIF(LEMON_HAVE_CBC) 45 46 ADD_LIBRARY(lemon ${LEMON_SOURCES}) 10 47 11 48 INSTALL( … … 19 56 COMPONENT headers 20 57 FILES_MATCHING PATTERN "*.h") 58 59 INSTALL( 60 FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h 61 DESTINATION include/lemon 62 COMPONENT headers) -
lemon/Makefile.am
r511 r674 8 8 9 9 lemon_libemon_la_SOURCES = \ 10 lemon/arg_parser.cc \ 11 lemon/base.cc \ 12 lemon/color.cc \ 13 lemon/random.cc \ 10 lemon/arg_parser.cc \ 11 lemon/base.cc \ 12 lemon/color.cc \ 13 lemon/lp_base.cc \ 14 lemon/lp_skeleton.cc \ 15 lemon/random.cc \ 14 16 lemon/bits/windows.cc 15 17 16 #lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS) 17 #lemon_libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) $(SOPLEX_LIBS) 18 19 lemon_libemon_la_CXXFLAGS = \ 20 $(AM_CXXFLAGS) \ 21 $(GLPK_CFLAGS) \ 22 $(CPLEX_CFLAGS) \ 23 $(SOPLEX_CXXFLAGS) \ 24 $(CLP_CXXFLAGS) \ 25 $(CBC_CXXFLAGS) 26 27 lemon_libemon_la_LDFLAGS = \ 28 $(GLPK_LIBS) \ 29 $(CPLEX_LIBS) \ 30 $(SOPLEX_LIBS) \ 31 $(CLP_LIBS) \ 32 $(CBC_LIBS) 33 34 if HAVE_GLPK 35 lemon_libemon_la_SOURCES += lemon/glpk.cc 36 endif 37 38 if HAVE_CPLEX 39 lemon_libemon_la_SOURCES += lemon/cplex.cc 40 endif 41 42 if HAVE_SOPLEX 43 lemon_libemon_la_SOURCES += lemon/soplex.cc 44 endif 45 46 if HAVE_CLP 47 lemon_libemon_la_SOURCES += lemon/clp.cc 48 endif 49 50 if HAVE_CBC 51 lemon_libemon_la_SOURCES += lemon/cbc.cc 52 endif 18 53 19 54 lemon_HEADERS += \ 20 lemon/arg_parser.h \ 55 lemon/adaptors.h \ 56 lemon/arg_parser.h \ 21 57 lemon/assert.h \ 22 lemon/bfs.h \ 23 lemon/bin_heap.h \ 24 lemon/color.h \ 58 lemon/bfs.h \ 59 lemon/bin_heap.h \ 60 lemon/circulation.h \ 61 lemon/clp.h \ 62 lemon/color.h \ 25 63 lemon/concept_check.h \ 26 lemon/counter.h \ 64 lemon/config.h \ 65 lemon/connectivity.h \ 66 lemon/counter.h \ 27 67 lemon/core.h \ 28 lemon/dfs.h \ 29 lemon/dijkstra.h \ 30 lemon/dim2.h \ 68 lemon/cplex.h \ 69 lemon/dfs.h \ 70 lemon/dijkstra.h \ 71 lemon/dim2.h \ 72 lemon/dimacs.h \ 73 lemon/edge_set.h \ 74 lemon/elevator.h \ 31 75 lemon/error.h \ 32 lemon/graph_to_eps.h \ 76 lemon/euler.h \ 77 lemon/full_graph.h \ 78 lemon/glpk.h \ 79 lemon/gomory_hu.h \ 80 lemon/graph_to_eps.h \ 81 lemon/grid_graph.h \ 82 lemon/hypercube_graph.h \ 33 83 lemon/kruskal.h \ 84 lemon/hao_orlin.h \ 34 85 lemon/lgf_reader.h \ 35 86 lemon/lgf_writer.h \ 36 87 lemon/list_graph.h \ 88 lemon/lp.h \ 89 lemon/lp_base.h \ 90 lemon/lp_skeleton.h \ 91 lemon/list_graph.h \ 37 92 lemon/maps.h \ 93 lemon/matching.h \ 38 94 lemon/math.h \ 95 lemon/min_cost_arborescence.h \ 96 lemon/nauty_reader.h \ 97 lemon/network_simplex.h \ 39 98 lemon/path.h \ 40 lemon/random.h \ 99 lemon/preflow.h \ 100 lemon/radix_sort.h \ 101 lemon/random.h \ 41 102 lemon/smart_graph.h \ 42 lemon/time_measure.h \ 43 lemon/tolerance.h \ 103 lemon/soplex.h \ 104 lemon/suurballe.h \ 105 lemon/time_measure.h \ 106 lemon/tolerance.h \ 44 107 lemon/unionfind.h \ 45 108 lemon/bits/windows.h … … 49 112 lemon/bits/array_map.h \ 50 113 lemon/bits/base_extender.h \ 51 114 lemon/bits/bezier.h \ 52 115 lemon/bits/default_map.h \ 53 lemon/bits/enable_if.h \ 116 lemon/bits/edge_set_extender.h \ 117 lemon/bits/enable_if.h \ 118 lemon/bits/graph_adaptor_extender.h \ 54 119 lemon/bits/graph_extender.h \ 55 120 lemon/bits/map_extender.h \ 56 121 lemon/bits/path_dump.h \ 122 lemon/bits/solver_bits.h \ 57 123 lemon/bits/traits.h \ 124 lemon/bits/variant.h \ 58 125 lemon/bits/vector_map.h 59 126 -
lemon/arg_parser.cc
r311 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/arg_parser.h
r311 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/assert.h
r290 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/base.cc
r220 r554 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 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
r301 r525 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 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 { … … 120 120 /// 121 121 ///\tparam GR The type of the digraph the algorithm runs on. 122 ///The default value is \ref ListDigraph. The value of GR is not used 123 ///directly by \ref Bfs, it is only passed to \ref BfsDefaultTraits. 124 ///\tparam TR Traits class to set various data types used by the algorithm. 125 ///The default traits class is 126 ///\ref BfsDefaultTraits "BfsDefaultTraits<GR>". 127 ///See \ref BfsDefaultTraits for the documentation of 128 ///a Bfs traits class. 122 ///The default type is \ref ListDigraph. 129 123 #ifdef DOXYGEN 130 124 template <typename GR, … … 152 146 typedef PredMapPath<Digraph, PredMap> Path; 153 147 154 ///The traits class.148 ///The \ref BfsDefaultTraits "traits class" of the algorithm. 155 149 typedef TR Traits; 156 150 … … 214 208 typedef Bfs Create; 215 209 216 ///\name Named template parameters210 ///\name Named Template Parameters 217 211 218 212 ///@{ … … 228 222 }; 229 223 ///\brief \ref named-templ-param "Named parameter" for setting 230 /// PredMap type.224 ///\c PredMap type. 231 225 /// 232 226 ///\ref named-templ-param "Named parameter" for setting 233 ///PredMap type. 227 ///\c PredMap type. 228 ///It must meet the \ref concepts::WriteMap "WriteMap" concept. 234 229 template <class T> 235 230 struct SetPredMap : public Bfs< Digraph, SetPredMapTraits<T> > { … … 247 242 }; 248 243 ///\brief \ref named-templ-param "Named parameter" for setting 249 /// DistMap type.244 ///\c DistMap type. 250 245 /// 251 246 ///\ref named-templ-param "Named parameter" for setting 252 ///DistMap type. 247 ///\c DistMap type. 248 ///It must meet the \ref concepts::WriteMap "WriteMap" concept. 253 249 template <class T> 254 250 struct SetDistMap : public Bfs< Digraph, SetDistMapTraits<T> > { … … 266 262 }; 267 263 ///\brief \ref named-templ-param "Named parameter" for setting 268 /// ReachedMap type.264 ///\c ReachedMap type. 269 265 /// 270 266 ///\ref named-templ-param "Named parameter" for setting 271 ///ReachedMap type. 267 ///\c ReachedMap type. 268 ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. 272 269 template <class T> 273 270 struct SetReachedMap : public Bfs< Digraph, SetReachedMapTraits<T> > { … … 285 282 }; 286 283 ///\brief \ref named-templ-param "Named parameter" for setting 287 /// ProcessedMap type.284 ///\c ProcessedMap type. 288 285 /// 289 286 ///\ref named-templ-param "Named parameter" for setting 290 ///ProcessedMap type. 287 ///\c ProcessedMap type. 288 ///It must meet the \ref concepts::WriteMap "WriteMap" concept. 291 289 template <class T> 292 290 struct SetProcessedMap : public Bfs< Digraph, SetProcessedMapTraits<T> > { … … 303 301 }; 304 302 ///\brief \ref named-templ-param "Named parameter" for setting 305 /// ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.303 ///\c ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. 306 304 /// 307 305 ///\ref named-templ-param "Named parameter" for setting 308 /// ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.306 ///\c ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. 309 307 ///If you don't set it explicitly, it will be automatically allocated. 310 308 struct SetStandardProcessedMap : … … 341 339 342 340 ///Sets the map that stores the predecessor arcs. 343 ///If you don't use this function before calling \ref run(), 344 ///it will allocate one. The destructor deallocates this 345 ///automatically allocated map, of course. 341 ///If you don't use this function before calling \ref run(Node) "run()" 342 ///or \ref init(), an instance will be allocated automatically. 343 ///The destructor deallocates this automatically allocated map, 344 ///of course. 346 345 ///\return <tt> (*this) </tt> 347 346 Bfs &predMap(PredMap &m) … … 358 357 359 358 ///Sets the map that indicates which nodes are reached. 360 ///If you don't use this function before calling \ref run(), 361 ///it will allocate one. The destructor deallocates this 362 ///automatically allocated map, of course. 359 ///If you don't use this function before calling \ref run(Node) "run()" 360 ///or \ref init(), an instance will be allocated automatically. 361 ///The destructor deallocates this automatically allocated map, 362 ///of course. 363 363 ///\return <tt> (*this) </tt> 364 364 Bfs &reachedMap(ReachedMap &m) … … 375 375 376 376 ///Sets the map that indicates which nodes are processed. 377 ///If you don't use this function before calling \ref run(), 378 ///it will allocate one. The destructor deallocates this 379 ///automatically allocated map, of course. 377 ///If you don't use this function before calling \ref run(Node) "run()" 378 ///or \ref init(), an instance will be allocated automatically. 379 ///The destructor deallocates this automatically allocated map, 380 ///of course. 380 381 ///\return <tt> (*this) </tt> 381 382 Bfs &processedMap(ProcessedMap &m) … … 393 394 ///Sets the map that stores the distances of the nodes calculated by 394 395 ///the algorithm. 395 ///If you don't use this function before calling \ref run(), 396 ///it will allocate one. The destructor deallocates this 397 ///automatically allocated map, of course. 396 ///If you don't use this function before calling \ref run(Node) "run()" 397 ///or \ref init(), an instance will be allocated automatically. 398 ///The destructor deallocates this automatically allocated map, 399 ///of course. 398 400 ///\return <tt> (*this) </tt> 399 401 Bfs &distMap(DistMap &m) … … 409 411 public: 410 412 411 ///\name Execution control 412 ///The simplest way to execute the algorithm is to use 413 ///one of the member functions called \ref lemon::Bfs::run() "run()". 414 ///\n 415 ///If you need more control on the execution, first you must call 416 ///\ref lemon::Bfs::init() "init()", then you can add several source 417 ///nodes with \ref lemon::Bfs::addSource() "addSource()". 418 ///Finally \ref lemon::Bfs::start() "start()" will perform the 419 ///actual path computation. 413 ///\name Execution Control 414 ///The simplest way to execute the BFS algorithm is to use one of the 415 ///member functions called \ref run(Node) "run()".\n 416 ///If you need more control on the execution, first you have to call 417 ///\ref init(), then you can add several source nodes with 418 ///\ref addSource(). Finally the actual path computation can be 419 ///performed with one of the \ref start() functions. 420 420 421 421 ///@{ 422 422 423 ///\brief Initializes the internal data structures. 424 /// 423 425 ///Initializes the internal data structures. 424 425 ///Initializes the internal data structures.426 ///427 426 void init() 428 427 { … … 558 557 } 559 558 560 ///\brief Returns \c false if there are nodes 561 ///to be processed. 562 /// 563 ///Returns \c false if there are nodes 564 ///to be processed in the queue. 559 ///Returns \c false if there are nodes to be processed. 560 561 ///Returns \c false if there are nodes to be processed 562 ///in the queue. 565 563 bool emptyQueue() const { return _queue_tail==_queue_head; } 566 564 567 565 ///Returns the number of the nodes to be processed. 568 566 569 ///Returns the number of the nodes to be processed in the queue. 567 ///Returns the number of the nodes to be processed 568 ///in the queue. 570 569 int queueSize() const { return _queue_head-_queue_tail; } 571 570 … … 732 731 733 732 ///\name Query Functions 734 ///The result of the %BFS algorithm can be obtained using these733 ///The results of the BFS algorithm can be obtained using these 735 734 ///functions.\n 736 ///Either \ref lemon::Bfs::run() "run()" or \ref lemon::Bfs::start()737 /// "start()" must be calledbefore using them.735 ///Either \ref run(Node) "run()" or \ref start() should be called 736 ///before using them. 738 737 739 738 ///@{ … … 743 742 ///Returns the shortest path to a node. 744 743 /// 745 ///\warning \c t should be reach ablefrom the root(s).746 /// 747 ///\pre Either \ref run( ) or \ref start() must be called before748 /// using this function.744 ///\warning \c t should be reached from the root(s). 745 /// 746 ///\pre Either \ref run(Node) "run()" or \ref init() 747 ///must be called before using this function. 749 748 Path path(Node t) const { return Path(*G, *_pred, t); } 750 749 … … 753 752 ///Returns the distance of a node from the root(s). 754 753 /// 755 ///\warning If node \c v is not reach ablefrom the root(s), then754 ///\warning If node \c v is not reached from the root(s), then 756 755 ///the return value of this function is undefined. 757 756 /// 758 ///\pre Either \ref run( ) or \ref start() must be called before759 /// using this function.757 ///\pre Either \ref run(Node) "run()" or \ref init() 758 ///must be called before using this function. 760 759 int dist(Node v) const { return (*_dist)[v]; } 761 760 … … 764 763 ///This function returns the 'previous arc' of the shortest path 765 764 ///tree for the node \c v, i.e. it returns the last arc of a 766 ///shortest path from the root(s)to \c v. It is \c INVALID if \c v767 ///is not reach ablefrom the root(s) or if \c v is a root.765 ///shortest path from a root to \c v. It is \c INVALID if \c v 766 ///is not reached from the root(s) or if \c v is a root. 768 767 /// 769 768 ///The shortest path tree used here is equal to the shortest path 770 769 ///tree used in \ref predNode(). 771 770 /// 772 ///\pre Either \ref run( ) or \ref start() must be called before773 /// using this function.771 ///\pre Either \ref run(Node) "run()" or \ref init() 772 ///must be called before using this function. 774 773 Arc predArc(Node v) const { return (*_pred)[v];} 775 774 … … 778 777 ///This function returns the 'previous node' of the shortest path 779 778 ///tree for the node \c v, i.e. it returns the last but one node 780 ///from a shortest path from the root(s)to \c v. It is \c INVALID781 ///if \c v is not reach ablefrom the root(s) or if \c v is a root.779 ///from a shortest path from a root to \c v. It is \c INVALID 780 ///if \c v is not reached from the root(s) or if \c v is a root. 782 781 /// 783 782 ///The shortest path tree used here is equal to the shortest path 784 783 ///tree used in \ref predArc(). 785 784 /// 786 ///\pre Either \ref run( ) or \ref start() must be called before787 /// using this function.785 ///\pre Either \ref run(Node) "run()" or \ref init() 786 ///must be called before using this function. 788 787 Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID: 789 788 G->source((*_pred)[v]); } … … 795 794 ///of the nodes calculated by the algorithm. 796 795 /// 797 ///\pre Either \ref run( )or \ref init()796 ///\pre Either \ref run(Node) "run()" or \ref init() 798 797 ///must be called before using this function. 799 798 const DistMap &distMap() const { return *_dist;} … … 805 804 ///arcs, which form the shortest path tree. 806 805 /// 807 ///\pre Either \ref run( )or \ref init()806 ///\pre Either \ref run(Node) "run()" or \ref init() 808 807 ///must be called before using this function. 809 808 const PredMap &predMap() const { return *_pred;} 810 809 811 ///Checks if a node is reachable from the root(s). 812 813 ///Returns \c true if \c v is reachable from the root(s). 814 ///\pre Either \ref run() or \ref start() 810 ///Checks if a node is reached from the root(s). 811 812 ///Returns \c true if \c v is reached from the root(s). 813 /// 814 ///\pre Either \ref run(Node) "run()" or \ref init() 815 815 ///must be called before using this function. 816 816 bool reached(Node v) const { return (*_reached)[v]; } … … 958 958 /// This auxiliary class is created to implement the 959 959 /// \ref bfs() "function-type interface" of \ref Bfs algorithm. 960 /// It does not have own \ref run( ) method, it uses the functions961 /// and features of the plain \ref Bfs.960 /// It does not have own \ref run(Node) "run()" method, it uses the 961 /// functions and features of the plain \ref Bfs. 962 962 /// 963 963 /// This class should only be used through the \ref bfs() function, … … 1179 1179 /// bool reached = bfs(g).path(p).dist(d).run(s,t); 1180 1180 ///\endcode 1181 ///\warning Don't forget to put the \ref BfsWizard::run( ) "run()"1181 ///\warning Don't forget to put the \ref BfsWizard::run(Node) "run()" 1182 1182 ///to the end of the parameter list. 1183 1183 ///\sa BfsWizard … … 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. … … 1365 1365 typedef BfsVisit Create; 1366 1366 1367 /// \name Named template parameters1367 /// \name Named Template Parameters 1368 1368 1369 1369 ///@{ … … 1407 1407 /// 1408 1408 /// Sets the map that indicates which nodes are reached. 1409 /// If you don't use this function before calling \ref run(), 1410 /// it will allocate one. The destructor deallocates this 1411 /// automatically allocated map, of course. 1409 /// If you don't use this function before calling \ref run(Node) "run()" 1410 /// or \ref init(), an instance will be allocated automatically. 1411 /// The destructor deallocates this automatically allocated map, 1412 /// of course. 1412 1413 /// \return <tt> (*this) </tt> 1413 1414 BfsVisit &reachedMap(ReachedMap &m) { … … 1422 1423 public: 1423 1424 1424 /// \name Execution control 1425 /// The simplest way to execute the algorithm is to use 1426 /// one of the member functions called \ref lemon::BfsVisit::run() 1427 /// "run()". 1428 /// \n 1429 /// If you need more control on the execution, first you must call 1430 /// \ref lemon::BfsVisit::init() "init()", then you can add several 1431 /// source nodes with \ref lemon::BfsVisit::addSource() "addSource()". 1432 /// Finally \ref lemon::BfsVisit::start() "start()" will perform the 1433 /// actual path computation. 1425 /// \name Execution Control 1426 /// The simplest way to execute the BFS algorithm is to use one of the 1427 /// member functions called \ref run(Node) "run()".\n 1428 /// If you need more control on the execution, first you have to call 1429 /// \ref init(), then you can add several source nodes with 1430 /// \ref addSource(). Finally the actual path computation can be 1431 /// performed with one of the \ref start() functions. 1434 1432 1435 1433 /// @{ … … 1731 1729 1732 1730 /// \name Query Functions 1733 /// The result of the %BFS algorithm can be obtained using these1731 /// The results of the BFS algorithm can be obtained using these 1734 1732 /// functions.\n 1735 /// Either \ref lemon::BfsVisit::run() "run()" or1736 /// \ref lemon::BfsVisit::start() "start()" must be called before1737 /// using them. 1733 /// Either \ref run(Node) "run()" or \ref start() should be called 1734 /// before using them. 1735 1738 1736 ///@{ 1739 1737 1740 /// \brief Checks if a node is reachable from the root(s). 1741 /// 1742 /// Returns \c true if \c v is reachable from the root(s). 1743 /// \pre Either \ref run() or \ref start() 1738 /// \brief Checks if a node is reached from the root(s). 1739 /// 1740 /// Returns \c true if \c v is reached from the root(s). 1741 /// 1742 /// \pre Either \ref run(Node) "run()" or \ref init() 1744 1743 /// must be called before using this function. 1745 bool reached(Node v) { return (*_reached)[v]; }1744 bool reached(Node v) const { return (*_reached)[v]; } 1746 1745 1747 1746 ///@} -
lemon/bin_heap.h
r209 r631 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 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. 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 Comp 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. 41 43 /// 42 ///\tparam _PrioType of the priority of the items.43 ///\tparam _ItemIntMap A read and writable Item int map, used internally44 ///\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 Comp 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 Comp = 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 Comp 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/alteration_notifier.h
r314 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 36 36 // a container. 37 37 // 38 // The simple graph 's can be refered as two containers, onenode container39 // and one edge container. But they are not standard containersthey40 // does not store values directly they are just key continars for more41 // value containers which are thenode and edge maps.42 // 43 // The graph's node and edge sets can be changed as we add or erase38 // The simple graphs can be refered as two containers: a node container 39 // and an edge container. But they do not store values directly, they 40 // are just key continars for more value containers, which are the 41 // node and edge maps. 42 // 43 // The node and edge sets of the graphs can be changed as we add or erase 44 44 // nodes and edges in the graph. LEMON would like to handle easily 45 45 // that the node and edge maps should contain values for all nodes or 46 46 // edges. If we want to check on every indicing if the map contains 47 47 // the current indicing key that cause a drawback in the performance 48 // in the library. We use another solution we notify all maps about48 // in the library. We use another solution: we notify all maps about 49 49 // an alteration in the graph, which cause only drawback on the 50 50 // alteration of the graph. 51 51 // 52 // This class provides an interface to the container. The \e first() and \e 53 // next() member functions make possible to iterate on the keys of the 54 // container. The \e id() function returns an integer id for each key. 55 // The \e maxId() function gives back an upper bound of the ids. 52 // This class provides an interface to a node or edge container. 53 // The first() and next() member functions make possible 54 // to iterate on the keys of the container. 55 // The id() function returns an integer id for each key. 56 // The maxId() function gives back an upper bound of the ids. 56 57 // 57 58 // For the proper functonality of this class, we should notify it 58 // about each alteration in the container. The alterations have four type 59 // a s \e add(), \e erase(), \e build() and \e clear(). The \e add() and60 // \e erase() signalsthat only one or few items added or erased to or61 // from the graph. If all items are erased from the graph or from an empty62 // graph a new graph is buildedthen it can be signaled with the59 // about each alteration in the container. The alterations have four type: 60 // add(), erase(), build() and clear(). The add() and 61 // erase() signal that only one or few items added or erased to or 62 // from the graph. If all items are erased from the graph or if a new graph 63 // is built from an empty graph, then it can be signaled with the 63 64 // clear() and build() members. Important rule that if we erase items 64 // from graph we should first signal the alteration and after that erase65 // from graphs we should first signal the alteration and after that erase 65 66 // them from the container, on the other way on item addition we should 66 67 // first extend the container and just after that signal the alteration. 67 68 // 68 69 // The alteration can be observed with a class inherited from the 69 // \eObserverBase nested class. The signals can be handled with70 // ObserverBase nested class. The signals can be handled with 70 71 // overriding the virtual functions defined in the base class. The 71 72 // observer base can be attached to the notifier with the 72 // \eattach() member and can be detached with detach() function. The73 // attach() member and can be detached with detach() function. The 73 74 // alteration handlers should not call any function which signals 74 75 // an other alteration in the same notifier and should not 75 76 // detach any observer from the notifier. 76 77 // 77 // Alteration observers try to be exception safe. If an \eadd() or78 // a \eclear() function throws an exception then the remaining78 // Alteration observers try to be exception safe. If an add() or 79 // a clear() function throws an exception then the remaining 79 80 // observeres will not be notified and the fulfilled additions will 80 // be rolled back by calling the \e erase() or \e clear()81 // functions. Thence the \e erase() and \e clear() should not throw82 // exception. Actullay, it can be throw only \ref ImmediateDetach83 // exceptionwhich detach the observer from the notifier.84 // 85 // There are some placewhen the alteration observing is not completly81 // be rolled back by calling the erase() or clear() functions. 82 // Hence erase() and clear() should not throw exception. 83 // Actullay, they can throw only \ref ImmediateDetach exception, 84 // which detach the observer from the notifier. 85 // 86 // There are some cases, when the alteration observing is not completly 86 87 // reliable. If we want to carry out the node degree in the graph 87 // as in the \ref InDegMap and we use the reverse Edge that cause88 // as in the \ref InDegMap and we use the reverseArc(), then it cause 88 89 // unreliable functionality. Because the alteration observing signals 89 // only erasing and adding but not the reversing it will stores bad90 // degrees. The sub graph adaptors cannot signal the alterations because91 // just a setting in the filter map can modify the graph and this cannot92 // be watched in any way.90 // only erasing and adding but not the reversing, it will stores bad 91 // degrees. Apart form that the subgraph adaptors cannot even signal 92 // the alterations because just a setting in the filter map can modify 93 // the graph and this cannot be watched in any way. 93 94 // 94 95 // \param _Container The container which is observed. … … 104 105 typedef _Item Item; 105 106 106 // \brief Exception which can be called from \eclear() and107 // \eerase().108 // 109 // From the \e clear() and \eerase() function only this107 // \brief Exception which can be called from clear() and 108 // erase(). 109 // 110 // From the clear() and erase() function only this 110 111 // exception is allowed to throw. The exception immediatly 111 112 // detaches the current observer from the notifier. Because the 112 // \e clear() and \eerase() should not throw other exceptions113 // clear() and erase() should not throw other exceptions 113 114 // it can be used to invalidate the observer. 114 115 struct ImmediateDetach {}; … … 122 123 // The observer interface contains some pure virtual functions 123 124 // to override. The add() and erase() functions are 124 // to notify the oberver when one item is added or 125 // erased. 125 // to notify the oberver when one item is added or erased. 126 126 // 127 127 // The build() and clear() members are to notify the observer -
lemon/bits/array_map.h
r314 r664 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 37 37 // \brief Graph map based on the array storage. 38 38 // 39 // The ArrayMap template class is graph map structure what 40 // automatically updates the map when a key is added to or erased from 41 // the map. This map uses the allocators to implement 42 // the container functionality. 39 // The ArrayMap template class is graph map structure that automatically 40 // updates the map when a key is added to or erased from the graph. 41 // This map uses the allocators to implement the container functionality. 43 42 // 44 // The template parameters are the Graph the current Item type and43 // The template parameters are the Graph, the current Item type and 45 44 // the Value type of the map. 46 45 template <typename _Graph, typename _Item, typename _Value> … … 48 47 : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase { 49 48 public: 50 // The graph type of the maps.51 typedef _Graph Graph ;52 // The item type of the map.49 // The graph type. 50 typedef _Graph GraphType; 51 // The item type. 53 52 typedef _Item Item; 54 53 // The reference map tag. 55 54 typedef True ReferenceMapTag; 56 55 57 // The key type of the map s.56 // The key type of the map. 58 57 typedef _Item Key; 59 58 // The value type of the map. … … 65 64 typedef _Value& Reference; 66 65 66 // The map type. 67 typedef ArrayMap Map; 68 67 69 // The notifier type. 68 70 typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier; 69 71 72 private: 73 70 74 // The MapBase of the Map which imlements the core regisitry function. 71 75 typedef typename Notifier::ObserverBase Parent; 72 76 73 private:74 77 typedef std::allocator<Value> Allocator; 75 78 … … 79 82 // 80 83 // Graph initialized map constructor. 81 explicit ArrayMap(const Graph & graph) {84 explicit ArrayMap(const GraphType& graph) { 82 85 Parent::attach(graph.notifier(Item())); 83 86 allocate_memory(); … … 93 96 // 94 97 // It constructs a map and initialize all of the the map. 95 ArrayMap(const Graph & graph, const Value& value) {98 ArrayMap(const GraphType& graph, const Value& value) { 96 99 Parent::attach(graph.notifier(Item())); 97 100 allocate_memory(); … … 137 140 // \brief Template assign operator. 138 141 // 139 // The given parameter should beconform to the ReadMap142 // The given parameter should conform to the ReadMap 140 143 // concecpt and could be indiced by the current item set of 141 144 // the NodeMap. In this case the value for each item … … 201 204 // \brief Adds a new key to the map. 202 205 // 203 // It adds a new key to the map. It called by the observer notifier206 // It adds a new key to the map. It is called by the observer notifier 204 207 // and it overrides the add() member function of the observer base. 205 208 virtual void add(const Key& key) { … … 229 232 // \brief Adds more new keys to the map. 230 233 // 231 // It adds more new keys to the map. It called by the observer notifier234 // It adds more new keys to the map. It is called by the observer notifier 232 235 // and it overrides the add() member function of the observer base. 233 236 virtual void add(const std::vector<Key>& keys) { … … 273 276 // \brief Erase a key from the map. 274 277 // 275 // Erase a key from the map. It called by the observer notifier278 // Erase a key from the map. It is called by the observer notifier 276 279 // and it overrides the erase() member function of the observer base. 277 280 virtual void erase(const Key& key) { … … 282 285 // \brief Erase more keys from the map. 283 286 // 284 // Erase more keys from the map. It called by the observer notifier287 // Erase more keys from the map. It is called by the observer notifier 285 288 // and it overrides the erase() member function of the observer base. 286 289 virtual void erase(const std::vector<Key>& keys) { … … 291 294 } 292 295 293 // \brief Build es the map.294 // 295 // It build es the map. Itcalled by the observer notifier296 // \brief Builds the map. 297 // 298 // It builds the map. It is called by the observer notifier 296 299 // and it overrides the build() member function of the observer base. 297 300 virtual void build() { … … 307 310 // \brief Clear the map. 308 311 // 309 // It erase all items from the map. It called by the observer notifier312 // It erase all items from the map. It is called by the observer notifier 310 313 // and it overrides the clear() member function of the observer base. 311 314 virtual void clear() { -
lemon/bits/base_extender.h
r314 r664 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 31 31 //\ingroup digraphbits 32 32 //\file 33 //\brief Extenders for the digraph types33 //\brief Extenders for the graph types 34 34 namespace lemon { 35 35 … … 39 39 template <typename Base> 40 40 class UndirDigraphExtender : public Base { 41 typedef Base Parent; 41 42 42 43 public: 43 44 44 typedef Base Parent;45 45 typedef typename Parent::Arc Edge; 46 46 typedef typename Parent::Node Node; … … 281 281 template <typename Base> 282 282 class BidirBpGraphExtender : public Base { 283 typedef Base Parent; 284 283 285 public: 284 typedef Base Parent;285 286 typedef BidirBpGraphExtender Digraph; 286 287 -
lemon/bits/bezier.h
r314 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/default_map.h
r523 r674 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 98 98 99 99 100 #if defined HAVE_LONG_LONG100 #if defined LEMON_HAVE_LONG_LONG 101 101 102 102 // long long … … 154 154 class DefaultMap 155 155 : public DefaultMapSelector<_Graph, _Item, _Value>::Map { 156 typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent; 157 156 158 public: 157 typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;158 159 typedef DefaultMap<_Graph, _Item, _Value> Map; 159 160 typedef typename Parent::Graph Graph;160 161 typedef typename Parent::GraphType GraphType; 161 162 typedef typename Parent::Value Value; 162 163 163 explicit DefaultMap(const Graph & graph) : Parent(graph) {}164 DefaultMap(const Graph & graph, const Value& value)164 explicit DefaultMap(const GraphType& graph) : Parent(graph) {} 165 DefaultMap(const GraphType& graph, const Value& value) 165 166 : Parent(graph, value) {} 166 167 -
lemon/bits/enable_if.h
r314 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/graph_extender.h
r314 r664 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 30 30 //\ingroup graphbits 31 31 //\file 32 //\brief Extenders for the digraph types32 //\brief Extenders for the graph types 33 33 namespace lemon { 34 34 35 35 // \ingroup graphbits 36 36 // 37 // \brief Extender for the Digraphs37 // \brief Extender for the digraph implementations 38 38 template <typename Base> 39 39 class DigraphExtender : public Base { 40 typedef Base Parent; 41 40 42 public: 41 43 42 typedef Base Parent;43 44 typedef DigraphExtender Digraph; 44 45 … … 219 220 class NodeMap 220 221 : public MapExtender<DefaultMap<Digraph, Node, _Value> > { 221 public:222 typedef DigraphExtender Digraph;223 222 typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent; 224 223 224 public: 225 225 explicit NodeMap(const Digraph& digraph) 226 226 : Parent(digraph) {} … … 244 244 class ArcMap 245 245 : public MapExtender<DefaultMap<Digraph, Arc, _Value> > { 246 public:247 typedef DigraphExtender Digraph;248 246 typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; 249 247 248 public: 250 249 explicit ArcMap(const Digraph& digraph) 251 250 : Parent(digraph) {} … … 331 330 template <typename Base> 332 331 class GraphExtender : public Base { 332 typedef Base Parent; 333 333 334 public: 334 335 335 typedef Base Parent;336 336 typedef GraphExtender Graph; 337 337 … … 602 602 class NodeMap 603 603 : public MapExtender<DefaultMap<Graph, Node, _Value> > { 604 public:605 typedef GraphExtender Graph;606 604 typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent; 607 605 606 public: 608 607 NodeMap(const Graph& graph) 609 608 : Parent(graph) {} … … 627 626 class ArcMap 628 627 : public MapExtender<DefaultMap<Graph, Arc, _Value> > { 629 public:630 typedef GraphExtender Graph;631 628 typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent; 632 629 630 public: 633 631 ArcMap(const Graph& graph) 634 632 : Parent(graph) {} … … 652 650 class EdgeMap 653 651 : public MapExtender<DefaultMap<Graph, Edge, _Value> > { 654 public:655 typedef GraphExtender Graph;656 652 typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent; 657 653 654 public: 658 655 EdgeMap(const Graph& graph) 659 656 : Parent(graph) {} -
lemon/bits/map_extender.h
r314 r664 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 37 37 template <typename _Map> 38 38 class MapExtender : public _Map { 39 public:40 41 39 typedef _Map Parent; 40 typedef typename Parent::GraphType GraphType; 41 42 public: 43 42 44 typedef MapExtender Map; 43 44 45 typedef typename Parent::Graph Graph;46 45 typedef typename Parent::Key Item; 47 46 48 47 typedef typename Parent::Key Key; 49 48 typedef typename Parent::Value Value; 49 typedef typename Parent::Reference Reference; 50 typedef typename Parent::ConstReference ConstReference; 50 51 51 52 class MapIt; … … 57 58 public: 58 59 59 MapExtender(const Graph & graph)60 MapExtender(const GraphType& graph) 60 61 : Parent(graph) {} 61 62 62 MapExtender(const Graph & graph, const Value& value)63 MapExtender(const GraphType& graph, const Value& value) 63 64 : Parent(graph, value) {} 64 65 … … 76 77 public: 77 78 class MapIt : public Item { 78 public: 79 80 typedef Item Parent; 79 typedef Item Parent; 80 81 public: 82 81 83 typedef typename Map::Value Value; 82 84 … … 115 117 116 118 class ConstMapIt : public Item { 117 public:118 119 typedef Item Parent;119 typedef Item Parent; 120 121 public: 120 122 121 123 typedef typename Map::Value Value; … … 146 148 147 149 class ItemIt : public Item { 148 public:149 150 typedef Item Parent;150 typedef Item Parent; 151 152 public: 151 153 152 154 ItemIt() {} … … 177 179 template <typename _Graph, typename _Map> 178 180 class SubMapExtender : public _Map { 179 public:180 181 181 typedef _Map Parent; 182 typedef _Graph GraphType; 183 184 public: 185 182 186 typedef SubMapExtender Map; 183 184 typedef _Graph Graph;185 186 187 typedef typename Parent::Key Item; 187 188 188 189 typedef typename Parent::Key Key; 189 190 typedef typename Parent::Value Value; 191 typedef typename Parent::Reference Reference; 192 typedef typename Parent::ConstReference ConstReference; 190 193 191 194 class MapIt; … … 197 200 public: 198 201 199 SubMapExtender(const Graph & _graph)202 SubMapExtender(const GraphType& _graph) 200 203 : Parent(_graph), graph(_graph) {} 201 204 202 SubMapExtender(const Graph & _graph, const Value& _value)205 SubMapExtender(const GraphType& _graph, const Value& _value) 203 206 : Parent(_graph, _value), graph(_graph) {} 204 207 … … 220 223 public: 221 224 class MapIt : public Item { 222 public:223 224 typedef Item Parent;225 typedef Item Parent; 226 227 public: 225 228 typedef typename Map::Value Value; 226 229 … … 259 262 260 263 class ConstMapIt : public Item { 261 public:262 263 typedef Item Parent;264 typedef Item Parent; 265 266 public: 264 267 265 268 typedef typename Map::Value Value; … … 290 293 291 294 class ItemIt : public Item { 292 public:293 294 typedef Item Parent;295 typedef Item Parent; 296 297 public: 295 298 296 299 ItemIt() {} … … 317 320 private: 318 321 319 const Graph & graph;322 const GraphType& graph; 320 323 321 324 }; -
lemon/bits/path_dump.h
r209 r576 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 17 17 */ 18 18 19 #ifndef LEMON_BITS_PRED_MAP_PATH_H 20 #define LEMON_BITS_PRED_MAP_PATH_H 19 #ifndef LEMON_BITS_PATH_DUMP_H 20 #define LEMON_BITS_PATH_DUMP_H 21 22 #include <lemon/core.h> 23 #include <lemon/concept_check.h> 21 24 22 25 namespace lemon { -
lemon/bits/traits.h
r314 r663 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 30 30 struct InvalidType {}; 31 31 32 template <typename _Graph, typename _Item>32 template <typename GR, typename _Item> 33 33 class ItemSetTraits {}; 34 34 35 35 36 template <typename G raph, typename Enable = void>36 template <typename GR, typename Enable = void> 37 37 struct NodeNotifierIndicator { 38 38 typedef InvalidType Type; 39 39 }; 40 template <typename G raph>40 template <typename GR> 41 41 struct NodeNotifierIndicator< 42 G raph,43 typename enable_if<typename G raph::NodeNotifier::Notifier, void>::type44 > { 45 typedef typename G raph::NodeNotifier Type;46 }; 47 48 template <typename _Graph>49 class ItemSetTraits< _Graph, typename _Graph::Node> {42 GR, 43 typename enable_if<typename GR::NodeNotifier::Notifier, void>::type 44 > { 45 typedef typename GR::NodeNotifier Type; 46 }; 47 48 template <typename GR> 49 class ItemSetTraits<GR, typename GR::Node> { 50 50 public: 51 51 52 typedef _Graph Graph; 53 54 typedef typename Graph::Node Item; 55 typedef typename Graph::NodeIt ItemIt; 56 57 typedef typename NodeNotifierIndicator<Graph>::Type ItemNotifier; 58 59 template <typename _Value> 60 class Map : public Graph::template NodeMap<_Value> { 52 typedef GR Graph; 53 typedef GR Digraph; 54 55 typedef typename GR::Node Item; 56 typedef typename GR::NodeIt ItemIt; 57 58 typedef typename NodeNotifierIndicator<GR>::Type ItemNotifier; 59 60 template <typename V> 61 class Map : public GR::template NodeMap<V> { 62 typedef typename GR::template NodeMap<V> Parent; 63 61 64 public: 62 typedef typename Graph::template NodeMap<_Value> Parent; 63 typedef typename Graph::template NodeMap<_Value> Type; 65 typedef typename GR::template NodeMap<V> Type; 64 66 typedef typename Parent::Value Value; 65 67 66 Map(const G raph& _digraph) : Parent(_digraph) {}67 Map(const G raph& _digraph, const Value& _value)68 Map(const GR& _digraph) : Parent(_digraph) {} 69 Map(const GR& _digraph, const Value& _value) 68 70 : Parent(_digraph, _value) {} 69 71 … … 72 74 }; 73 75 74 template <typename G raph, typename Enable = void>76 template <typename GR, typename Enable = void> 75 77 struct ArcNotifierIndicator { 76 78 typedef InvalidType Type; 77 79 }; 78 template <typename G raph>80 template <typename GR> 79 81 struct ArcNotifierIndicator< 80 G raph,81 typename enable_if<typename G raph::ArcNotifier::Notifier, void>::type82 > { 83 typedef typename G raph::ArcNotifier Type;84 }; 85 86 template <typename _Graph>87 class ItemSetTraits< _Graph, typename _Graph::Arc> {82 GR, 83 typename enable_if<typename GR::ArcNotifier::Notifier, void>::type 84 > { 85 typedef typename GR::ArcNotifier Type; 86 }; 87 88 template <typename GR> 89 class ItemSetTraits<GR, typename GR::Arc> { 88 90 public: 89 91 90 typedef _Graph Graph; 91 92 typedef typename Graph::Arc Item; 93 typedef typename Graph::ArcIt ItemIt; 94 95 typedef typename ArcNotifierIndicator<Graph>::Type ItemNotifier; 96 97 template <typename _Value> 98 class Map : public Graph::template ArcMap<_Value> { 92 typedef GR Graph; 93 typedef GR Digraph; 94 95 typedef typename GR::Arc Item; 96 typedef typename GR::ArcIt ItemIt; 97 98 typedef typename ArcNotifierIndicator<GR>::Type ItemNotifier; 99 100 template <typename V> 101 class Map : public GR::template ArcMap<V> { 102 typedef typename GR::template ArcMap<V> Parent; 103 99 104 public: 100 typedef typename Graph::template ArcMap<_Value> Parent; 101 typedef typename Graph::template ArcMap<_Value> Type; 105 typedef typename GR::template ArcMap<V> Type; 102 106 typedef typename Parent::Value Value; 103 107 104 Map(const G raph& _digraph) : Parent(_digraph) {}105 Map(const G raph& _digraph, const Value& _value)108 Map(const GR& _digraph) : Parent(_digraph) {} 109 Map(const GR& _digraph, const Value& _value) 106 110 : Parent(_digraph, _value) {} 107 111 }; … … 109 113 }; 110 114 111 template <typename G raph, typename Enable = void>115 template <typename GR, typename Enable = void> 112 116 struct EdgeNotifierIndicator { 113 117 typedef InvalidType Type; 114 118 }; 115 template <typename G raph>119 template <typename GR> 116 120 struct EdgeNotifierIndicator< 117 G raph,118 typename enable_if<typename G raph::EdgeNotifier::Notifier, void>::type119 > { 120 typedef typename G raph::EdgeNotifier Type;121 }; 122 123 template <typename _Graph>124 class ItemSetTraits< _Graph, typename _Graph::Edge> {121 GR, 122 typename enable_if<typename GR::EdgeNotifier::Notifier, void>::type 123 > { 124 typedef typename GR::EdgeNotifier Type; 125 }; 126 127 template <typename GR> 128 class ItemSetTraits<GR, typename GR::Edge> { 125 129 public: 126 130 127 typedef _Graph Graph; 128 129 typedef typename Graph::Edge Item; 130 typedef typename Graph::EdgeIt ItemIt; 131 132 typedef typename EdgeNotifierIndicator<Graph>::Type ItemNotifier; 133 134 template <typename _Value> 135 class Map : public Graph::template EdgeMap<_Value> { 131 typedef GR Graph; 132 typedef GR Digraph; 133 134 typedef typename GR::Edge Item; 135 typedef typename GR::EdgeIt ItemIt; 136 137 typedef typename EdgeNotifierIndicator<GR>::Type ItemNotifier; 138 139 template <typename V> 140 class Map : public GR::template EdgeMap<V> { 141 typedef typename GR::template EdgeMap<V> Parent; 142 136 143 public: 137 typedef typename Graph::template EdgeMap<_Value> Parent; 138 typedef typename Graph::template EdgeMap<_Value> Type; 144 typedef typename GR::template EdgeMap<V> Type; 139 145 typedef typename Parent::Value Value; 140 146 141 Map(const G raph& _digraph) : Parent(_digraph) {}142 Map(const G raph& _digraph, const Value& _value)147 Map(const GR& _digraph) : Parent(_digraph) {} 148 Map(const GR& _digraph, const Value& _value) 143 149 : Parent(_digraph, _value) {} 144 150 }; … … 205 211 // Indicators for the tags 206 212 207 template <typename G raph, typename Enable = void>213 template <typename GR, typename Enable = void> 208 214 struct NodeNumTagIndicator { 209 215 static const bool value = false; 210 216 }; 211 217 212 template <typename G raph>218 template <typename GR> 213 219 struct NodeNumTagIndicator< 214 Graph, 215 typename enable_if<typename Graph::NodeNumTag, void>::type 216 > { 217 static const bool value = true; 218 }; 219 220 template <typename Graph, typename Enable = void> 220 GR, 221 typename enable_if<typename GR::NodeNumTag, void>::type 222 > { 223 static const bool value = true; 224 }; 225 226 template <typename GR, typename Enable = void> 227 struct ArcNumTagIndicator { 228 static const bool value = false; 229 }; 230 231 template <typename GR> 232 struct ArcNumTagIndicator< 233 GR, 234 typename enable_if<typename GR::ArcNumTag, void>::type 235 > { 236 static const bool value = true; 237 }; 238 239 template <typename GR, typename Enable = void> 221 240 struct EdgeNumTagIndicator { 222 241 static const bool value = false; 223 242 }; 224 243 225 template <typename G raph>244 template <typename GR> 226 245 struct EdgeNumTagIndicator< 227 Graph, 228 typename enable_if<typename Graph::EdgeNumTag, void>::type 229 > { 230 static const bool value = true; 231 }; 232 233 template <typename Graph, typename Enable = void> 246 GR, 247 typename enable_if<typename GR::EdgeNumTag, void>::type 248 > { 249 static const bool value = true; 250 }; 251 252 template <typename GR, typename Enable = void> 253 struct FindArcTagIndicator { 254 static const bool value = false; 255 }; 256 257 template <typename GR> 258 struct FindArcTagIndicator< 259 GR, 260 typename enable_if<typename GR::FindArcTag, void>::type 261 > { 262 static const bool value = true; 263 }; 264 265 template <typename GR, typename Enable = void> 234 266 struct FindEdgeTagIndicator { 235 267 static const bool value = false; 236 268 }; 237 269 238 template <typename G raph>270 template <typename GR> 239 271 struct FindEdgeTagIndicator< 240 G raph,241 typename enable_if<typename G raph::FindEdgeTag, void>::type242 > { 243 static const bool value = true; 244 }; 245 246 template <typename G raph, typename Enable = void>272 GR, 273 typename enable_if<typename GR::FindEdgeTag, void>::type 274 > { 275 static const bool value = true; 276 }; 277 278 template <typename GR, typename Enable = void> 247 279 struct UndirectedTagIndicator { 248 280 static const bool value = false; 249 281 }; 250 282 251 template <typename G raph>283 template <typename GR> 252 284 struct UndirectedTagIndicator< 253 G raph,254 typename enable_if<typename G raph::UndirectedTag, void>::type255 > { 256 static const bool value = true; 257 }; 258 259 template <typename G raph, typename Enable = void>285 GR, 286 typename enable_if<typename GR::UndirectedTag, void>::type 287 > { 288 static const bool value = true; 289 }; 290 291 template <typename GR, typename Enable = void> 260 292 struct BuildTagIndicator { 261 293 static const bool value = false; 262 294 }; 263 295 264 template <typename G raph>296 template <typename GR> 265 297 struct BuildTagIndicator< 266 G raph,267 typename enable_if<typename G raph::BuildTag, void>::type298 GR, 299 typename enable_if<typename GR::BuildTag, void>::type 268 300 > { 269 301 static const bool value = true; -
lemon/bits/vector_map.h
r314 r664 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 39 39 // \brief Graph map based on the std::vector storage. 40 40 // 41 // The VectorMap template class is graph map structure what42 // automatically updates the map when a key is added to or erased from43 // the map. This map type uses thestd::vector to store the values.41 // The VectorMap template class is graph map structure that automatically 42 // updates the map when a key is added to or erased from the graph. 43 // This map type uses std::vector to store the values. 44 44 // 45 45 // \tparam _Graph The graph this map is attached to. … … 57 57 58 58 // The graph type of the map. 59 typedef _Graph Graph ;59 typedef _Graph GraphType; 60 60 // The item type of the map. 61 61 typedef _Item Item; … … 73 73 // The map type. 74 74 typedef VectorMap Map; 75 // The base class of the map.76 typedef typename Notifier::ObserverBase Parent;77 75 78 76 // The reference type of the map; … … 81 79 typedef typename Container::const_reference ConstReference; 82 80 81 private: 82 83 // The base class of the map. 84 typedef typename Notifier::ObserverBase Parent; 85 86 public: 83 87 84 88 // \brief Constructor to attach the new map into the notifier. … … 86 90 // It constructs a map and attachs it into the notifier. 87 91 // It adds all the items of the graph to the map. 88 VectorMap(const Graph & graph) {92 VectorMap(const GraphType& graph) { 89 93 Parent::attach(graph.notifier(Item())); 90 94 container.resize(Parent::notifier()->maxId() + 1); … … 95 99 // It constructs a map uses a given value to initialize the map. 96 100 // It adds all the items of the graph to the map. 97 VectorMap(const Graph & graph, const Value& value) {101 VectorMap(const GraphType& graph, const Value& value) { 98 102 Parent::attach(graph.notifier(Item())); 99 103 container.resize(Parent::notifier()->maxId() + 1, value); … … 125 129 // \brief Template assign operator. 126 130 // 127 // The given parameter should beconform to the ReadMap131 // The given parameter should conform to the ReadMap 128 132 // concecpt and could be indiced by the current item set of 129 133 // the NodeMap. In this case the value for each item … … 170 174 // \brief Adds a new key to the map. 171 175 // 172 // It adds a new key to the map. It called by the observer notifier176 // It adds a new key to the map. It is called by the observer notifier 173 177 // and it overrides the add() member function of the observer base. 174 178 virtual void add(const Key& key) { … … 181 185 // \brief Adds more new keys to the map. 182 186 // 183 // It adds more new keys to the map. It called by the observer notifier187 // It adds more new keys to the map. It is called by the observer notifier 184 188 // and it overrides the add() member function of the observer base. 185 189 virtual void add(const std::vector<Key>& keys) { … … 196 200 // \brief Erase a key from the map. 197 201 // 198 // Erase a key from the map. It called by the observer notifier202 // Erase a key from the map. It is called by the observer notifier 199 203 // and it overrides the erase() member function of the observer base. 200 204 virtual void erase(const Key& key) { … … 204 208 // \brief Erase more keys from the map. 205 209 // 206 // Erase more keys from the map. Itcalled by the observer notifier210 // It erases more keys from the map. It is called by the observer notifier 207 211 // and it overrides the erase() member function of the observer base. 208 212 virtual void erase(const std::vector<Key>& keys) { … … 212 216 } 213 217 214 // \brief Build esthe map.215 // 216 // It build es the map. Itcalled by the observer notifier218 // \brief Build the map. 219 // 220 // It builds the map. It is called by the observer notifier 217 221 // and it overrides the build() member function of the observer base. 218 222 virtual void build() { … … 224 228 // \brief Clear the map. 225 229 // 226 // It erase all items from the map. Itcalled by the observer notifier230 // It erases all items from the map. It is called by the observer notifier 227 231 // and it overrides the clear() member function of the observer base. 228 232 virtual void clear() { -
lemon/bits/windows.h
r511 r576 17 17 */ 18 18 19 #ifndef LEMON_ WINDOWS_H20 #define LEMON_ WINDOWS_H19 #ifndef LEMON_BITS_WINDOWS_H 20 #define LEMON_BITS_WINDOWS_H 21 21 22 22 #include <string> -
lemon/color.cc
r209 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/color.h
r313 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/concept_check.h
r285 r463 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/concepts/digraph.h
r263 r627 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 17 17 */ 18 18 19 #ifndef LEMON_CONCEPT _DIGRAPH_H20 #define LEMON_CONCEPT _DIGRAPH_H19 #ifndef LEMON_CONCEPTS_DIGRAPH_H 20 #define LEMON_CONCEPTS_DIGRAPH_H 21 21 22 22 ///\ingroup graph_concepts … … 422 422 Node oppositeNode(const Node&, const Arc&) const { return INVALID; } 423 423 424 /// \brief Read write map of the nodes to type \c T. 425 /// 426 /// ReadWrite map of the nodes to type \c T. 427 /// \sa Reference 424 /// \brief Reference map of the nodes to type \c T. 425 /// 426 /// Reference map of the nodes to type \c T. 428 427 template<class T> 429 class NodeMap : public Re adWriteMap< Node, T> {428 class NodeMap : public ReferenceMap<Node, T, T&, const T&> { 430 429 public: 431 430 … … 437 436 private: 438 437 ///Copy constructor 439 NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } 438 NodeMap(const NodeMap& nm) : 439 ReferenceMap<Node, T, T&, const T&>(nm) { } 440 440 ///Assignment operator 441 441 template <typename CMap> … … 446 446 }; 447 447 448 /// \brief Re ad write map of the arcs to type \c T.448 /// \brief Reference map of the arcs to type \c T. 449 449 /// 450 450 /// Reference map of the arcs to type \c T. 451 /// \sa Reference452 451 template<class T> 453 class ArcMap : public Re adWriteMap<Arc,T> {452 class ArcMap : public ReferenceMap<Arc, T, T&, const T&> { 454 453 public: 455 454 … … 460 459 private: 461 460 ///Copy constructor 462 ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { } 461 ArcMap(const ArcMap& em) : 462 ReferenceMap<Arc, T, T&, const T&>(em) { } 463 463 ///Assignment operator 464 464 template <typename CMap> … … 472 472 struct Constraints { 473 473 void constraints() { 474 checkConcept<BaseDigraphComponent, _Digraph>(); 474 475 checkConcept<IterableDigraphComponent<>, _Digraph>(); 475 476 checkConcept<IDableDigraphComponent<>, _Digraph>(); … … 485 486 486 487 487 #endif // LEMON_CONCEPT_DIGRAPH_H488 #endif -
lemon/concepts/graph.h
r263 r627 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 21 21 ///\brief The concept of Undirected Graphs. 22 22 23 #ifndef LEMON_CONCEPT _GRAPH_H24 #define LEMON_CONCEPT _GRAPH_H23 #ifndef LEMON_CONCEPTS_GRAPH_H 24 #define LEMON_CONCEPTS_GRAPH_H 25 25 26 26 #include <lemon/concepts/graph_components.h> 27 #include <lemon/concepts/graph.h>28 27 #include <lemon/core.h> 29 28 … … 499 498 }; 500 499 501 /// \brief Read write map of the nodes to type \c T. 502 /// 503 /// ReadWrite map of the nodes to type \c T. 504 /// \sa Reference 500 /// \brief Reference map of the nodes to type \c T. 501 /// 502 /// Reference map of the nodes to type \c T. 505 503 template<class T> 506 class NodeMap : public Re adWriteMap< Node, T>504 class NodeMap : public ReferenceMap<Node, T, T&, const T&> 507 505 { 508 506 public: … … 515 513 private: 516 514 ///Copy constructor 517 NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } 515 NodeMap(const NodeMap& nm) : 516 ReferenceMap<Node, T, T&, const T&>(nm) { } 518 517 ///Assignment operator 519 518 template <typename CMap> … … 524 523 }; 525 524 526 /// \brief Read write map of the directed arcs to type \c T. 527 /// 528 /// Reference map of the directed arcs to type \c T. 529 /// \sa Reference 525 /// \brief Reference map of the arcs to type \c T. 526 /// 527 /// Reference map of the arcs to type \c T. 530 528 template<class T> 531 class ArcMap : public Re adWriteMap<Arc,T>529 class ArcMap : public ReferenceMap<Arc, T, T&, const T&> 532 530 { 533 531 public: … … 539 537 private: 540 538 ///Copy constructor 541 ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { } 539 ArcMap(const ArcMap& em) : 540 ReferenceMap<Arc, T, T&, const T&>(em) { } 542 541 ///Assignment operator 543 542 template <typename CMap> … … 548 547 }; 549 548 550 /// Read write map of the edges to type \c T. 551 552 /// Reference map of the arcs to type \c T. 553 /// \sa Reference 549 /// Reference map of the edges to type \c T. 550 551 /// Reference map of the edges to type \c T. 554 552 template<class T> 555 class EdgeMap : public Re adWriteMap<Edge,T>553 class EdgeMap : public ReferenceMap<Edge, T, T&, const T&> 556 554 { 557 555 public: … … 563 561 private: 564 562 ///Copy constructor 565 EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) {} 563 EdgeMap(const EdgeMap& em) : 564 ReferenceMap<Edge, T, T&, const T&>(em) {} 566 565 ///Assignment operator 567 566 template <typename CMap> … … 603 602 /// \brief Opposite node on an arc 604 603 /// 605 /// \return the opposite of the given Node on the given Edge604 /// \return The opposite of the given node on the given edge. 606 605 Node oppositeNode(Node, Edge) const { return INVALID; } 607 606 608 607 /// \brief First node of the edge. 609 608 /// 610 /// \return the first node of the given Edge.609 /// \return The first node of the given edge. 611 610 /// 612 611 /// Naturally edges don't have direction and thus 613 /// don't have source and target node. But we use these two methods614 /// to query the two nodes of the arc. The direction of the arc615 /// which arises this way is called the inherent direction of the612 /// don't have source and target node. However we use \c u() and \c v() 613 /// methods to query the two nodes of the arc. The direction of the 614 /// arc which arises this way is called the inherent direction of the 616 615 /// edge, and is used to define the "default" direction 617 616 /// of the directed versions of the arcs. 618 /// \sa direction 617 /// \sa v() 618 /// \sa direction() 619 619 Node u(Edge) const { return INVALID; } 620 620 621 621 /// \brief Second node of the edge. 622 /// 623 /// \return The second node of the given edge. 624 /// 625 /// Naturally edges don't have direction and thus 626 /// don't have source and target node. However we use \c u() and \c v() 627 /// methods to query the two nodes of the arc. The direction of the 628 /// arc which arises this way is called the inherent direction of the 629 /// edge, and is used to define the "default" direction 630 /// of the directed versions of the arcs. 631 /// \sa u() 632 /// \sa direction() 622 633 Node v(Edge) const { return INVALID; } 623 634 … … 738 749 struct Constraints { 739 750 void constraints() { 751 checkConcept<BaseGraphComponent, _Graph>(); 740 752 checkConcept<IterableGraphComponent<>, _Graph>(); 741 753 checkConcept<IDableGraphComponent<>, _Graph>(); -
lemon/concepts/graph_components.h
r313 r664 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 21 21 ///\brief The concept of graph components. 22 22 23 24 #ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H 25 #define LEMON_CONCEPT_GRAPH_COMPONENTS_H 23 #ifndef LEMON_CONCEPTS_GRAPH_COMPONENTS_H 24 #define LEMON_CONCEPTS_GRAPH_COMPONENTS_H 26 25 27 26 #include <lemon/core.h> … … 33 32 namespace concepts { 34 33 35 /// \brief Skeleton class for graph Node and Arc types36 /// 37 /// This class describes the interface of Node and Arc (andEdge38 /// in undirected graphs) subtypes ofgraph types.34 /// \brief Concept class for \c Node, \c Arc and \c Edge types. 35 /// 36 /// This class describes the concept of \c Node, \c Arc and \c Edge 37 /// subtypes of digraph and graph types. 39 38 /// 40 39 /// \note This class is a template class so that we can use it to 41 /// create graph skeleton classes. The reason for this is than Node 42 /// and Arc types should \em not derive from the same base class. 43 /// For Node you should instantiate it with character 'n' and for Arc 44 /// with 'a'. 45 40 /// create graph skeleton classes. The reason for this is that \c Node 41 /// and \c Arc (or \c Edge) types should \e not derive from the same 42 /// base class. For \c Node you should instantiate it with character 43 /// \c 'n', for \c Arc with \c 'a' and for \c Edge with \c 'e'. 46 44 #ifndef DOXYGEN 47 template <char _selector= '0'>45 template <char sel = '0'> 48 46 #endif 49 47 class GraphItem { … … 51 49 /// \brief Default constructor. 52 50 /// 51 /// Default constructor. 53 52 /// \warning The default constructor is not required to set 54 53 /// the item to some well-defined value. So you should consider it 55 54 /// as uninitialized. 56 55 GraphItem() {} 56 57 57 /// \brief Copy constructor. 58 58 /// 59 59 /// Copy constructor. 60 ///61 60 GraphItem(const GraphItem &) {} 62 /// \brief Invalid constructor \& conversion. 63 /// 64 /// This constructor initializes the item to be invalid. 61 62 /// \brief Constructor for conversion from \c INVALID. 63 /// 64 /// Constructor for conversion from \c INVALID. 65 /// It initializes the item to be invalid. 65 66 /// \sa Invalid for more details. 66 67 GraphItem(Invalid) {} 67 /// \brief Assign operator for nodes. 68 /// 69 /// The nodes are assignable. 70 /// 71 GraphItem& operator=(GraphItem const&) { return *this; } 68 69 /// \brief Assignment operator. 70 /// 71 /// Assignment operator for the item. 72 GraphItem& operator=(const GraphItem&) { return *this; } 73 72 74 /// \brief Equality operator. 73 75 /// 74 /// Two iterators are equal if and only if they represents the75 /// same node in the graph or both are invalid.76 bool operator==(GraphItem) const { return false; } 76 /// Equality operator. 77 bool operator==(const GraphItem&) const { return false; } 78 77 79 /// \brief Inequality operator. 78 80 /// 79 /// \sa operator==(const Node& n)80 ///81 bool operator!=(GraphItem) const { return false; } 82 83 /// \brief Artificial ordering operator.84 /// 85 /// To allow the use of graph descriptors as key type in std::map or86 /// similar associative container we require this.81 /// Inequality operator. 82 bool operator!=(const GraphItem&) const { return false; } 83 84 /// \brief Ordering operator. 85 /// 86 /// This operator defines an ordering of the items. 87 /// It makes possible to use graph item types as key types in 88 /// associative containers (e.g. \c std::map). 87 89 /// 88 90 /// \note This operator only have to define some strict ordering of 89 91 /// the items; this order has nothing to do with the iteration 90 92 /// ordering of the items. 91 bool operator<( GraphItem) const { return false; }93 bool operator<(const GraphItem&) const { return false; } 92 94 93 95 template<typename _GraphItem> … … 101 103 102 104 bool b; 103 // b = (ia == ib) && (ia != ib) && (ia < ib);104 105 b = (ia == ib) && (ia != ib); 105 106 b = (ia == INVALID) && (ib != INVALID); … … 112 113 }; 113 114 114 /// \brief An empty base directed graph class. 115 /// 116 /// This class provides the minimal set of features needed for a 117 /// directed graph structure. All digraph concepts have to be 118 /// conform to this base directed graph. It just provides types 119 /// for nodes and arcs and functions to get the source and the 120 /// target of the arcs. 115 /// \brief Base skeleton class for directed graphs. 116 /// 117 /// This class describes the base interface of directed graph types. 118 /// All digraph %concepts have to conform to this class. 119 /// It just provides types for nodes and arcs and functions 120 /// to get the source and the target nodes of arcs. 121 121 class BaseDigraphComponent { 122 122 public: … … 126 126 /// \brief Node class of the digraph. 127 127 /// 128 /// This class represents the Nodes of the digraph. 129 /// 128 /// This class represents the nodes of the digraph. 130 129 typedef GraphItem<'n'> Node; 131 130 132 131 /// \brief Arc class of the digraph. 133 132 /// 134 /// This class represents the Arcs of the digraph. 135 /// 136 typedef GraphItem<'e'> Arc; 137 138 /// \brief Gives back the target node of an arc. 139 /// 140 /// Gives back the target node of an arc. 141 /// 142 Node target(const Arc&) const { return INVALID;} 143 144 /// \brief Gives back the source node of an arc. 145 /// 146 /// Gives back the source node of an arc. 147 /// 148 Node source(const Arc&) const { return INVALID;} 149 150 /// \brief Gives back the opposite node on the given arc. 151 /// 152 /// Gives back the opposite node on the given arc. 133 /// This class represents the arcs of the digraph. 134 typedef GraphItem<'a'> Arc; 135 136 /// \brief Return the source node of an arc. 137 /// 138 /// This function returns the source node of an arc. 139 Node source(const Arc&) const { return INVALID; } 140 141 /// \brief Return the target node of an arc. 142 /// 143 /// This function returns the target node of an arc. 144 Node target(const Arc&) const { return INVALID; } 145 146 /// \brief Return the opposite node on the given arc. 147 /// 148 /// This function returns the opposite node on the given arc. 153 149 Node oppositeNode(const Node&, const Arc&) const { 154 150 return INVALID; … … 176 172 }; 177 173 178 /// \brief An empty base undirected graph class. 179 /// 180 /// This class provides the minimal set of features needed for an 181 /// undirected graph structure. All undirected graph concepts have 182 /// to be conform to this base graph. It just provides types for 183 /// nodes, arcs and edges and functions to get the 184 /// source and the target of the arcs and edges, 185 /// conversion from arcs to edges and function to get 186 /// both direction of the edges. 174 /// \brief Base skeleton class for undirected graphs. 175 /// 176 /// This class describes the base interface of undirected graph types. 177 /// All graph %concepts have to conform to this class. 178 /// It extends the interface of \ref BaseDigraphComponent with an 179 /// \c Edge type and functions to get the end nodes of edges, 180 /// to convert from arcs to edges and to get both direction of edges. 187 181 class BaseGraphComponent : public BaseDigraphComponent { 188 182 public: 183 184 typedef BaseGraphComponent Graph; 185 189 186 typedef BaseDigraphComponent::Node Node; 190 187 typedef BaseDigraphComponent::Arc Arc; 191 /// \brief Undirected arc class of the graph. 192 /// 193 /// This class represents the edges of the graph. 194 /// The undirected graphs can be used as a directed graph which 195 /// for each arc contains the opposite arc too so the graph is 196 /// bidirected. The edge represents two opposite 197 /// directed arcs. 198 class Edge : public GraphItem<'u'> { 188 189 /// \brief Undirected edge class of the graph. 190 /// 191 /// This class represents the undirected edges of the graph. 192 /// Undirected graphs can be used as directed graphs, each edge is 193 /// represented by two opposite directed arcs. 194 class Edge : public GraphItem<'e'> { 195 typedef GraphItem<'e'> Parent; 196 199 197 public: 200 typedef GraphItem<'u'> Parent;201 198 /// \brief Default constructor. 202 199 /// 200 /// Default constructor. 203 201 /// \warning The default constructor is not required to set 204 202 /// the item to some well-defined value. So you should consider it 205 203 /// as uninitialized. 206 204 Edge() {} 205 207 206 /// \brief Copy constructor. 208 207 /// 209 208 /// Copy constructor. 210 ///211 209 Edge(const Edge &) : Parent() {} 212 /// \brief Invalid constructor \& conversion. 213 /// 214 /// This constructor initializes the item to be invalid. 210 211 /// \brief Constructor for conversion from \c INVALID. 212 /// 213 /// Constructor for conversion from \c INVALID. 214 /// It initializes the item to be invalid. 215 215 /// \sa Invalid for more details. 216 216 Edge(Invalid) {} 217 /// \brief Converter from arc to edge. 218 /// 217 218 /// \brief Constructor for conversion from an arc. 219 /// 220 /// Constructor for conversion from an arc. 219 221 /// Besides the core graph item functionality each arc should 220 222 /// be convertible to the represented edge. 221 223 Edge(const Arc&) {} 222 /// \brief Assign arc to edge. 223 /// 224 225 /// \brief Assign an arc to an edge. 226 /// 227 /// This function assigns an arc to an edge. 224 228 /// Besides the core graph item functionality each arc should 225 229 /// be convertible to the represented edge. … … 227 231 }; 228 232 229 /// \brief Returns the direction of the arc. 233 /// \brief Return one end node of an edge. 234 /// 235 /// This function returns one end node of an edge. 236 Node u(const Edge&) const { return INVALID; } 237 238 /// \brief Return the other end node of an edge. 239 /// 240 /// This function returns the other end node of an edge. 241 Node v(const Edge&) const { return INVALID; } 242 243 /// \brief Return a directed arc related to an edge. 244 /// 245 /// This function returns a directed arc from its direction and the 246 /// represented edge. 247 Arc direct(const Edge&, bool) const { return INVALID; } 248 249 /// \brief Return a directed arc related to an edge. 250 /// 251 /// This function returns a directed arc from its source node and the 252 /// represented edge. 253 Arc direct(const Edge&, const Node&) const { return INVALID; } 254 255 /// \brief Return the direction of the arc. 230 256 /// 231 257 /// Returns the direction of the arc. Each arc represents an … … 234 260 bool direction(const Arc&) const { return true; } 235 261 236 /// \brief Returns the directed arc. 237 /// 238 /// Returns the directed arc from its direction and the 239 /// represented edge. 240 Arc direct(const Edge&, bool) const { return INVALID;} 241 242 /// \brief Returns the directed arc. 243 /// 244 /// Returns the directed arc from its source and the 245 /// represented edge. 246 Arc direct(const Edge&, const Node&) const { return INVALID;} 247 248 /// \brief Returns the opposite arc. 249 /// 250 /// Returns the opposite arc. It is the arc representing the 251 /// same edge and has opposite direction. 252 Arc oppositeArc(const Arc&) const { return INVALID;} 253 254 /// \brief Gives back one ending of an edge. 255 /// 256 /// Gives back one ending of an edge. 257 Node u(const Edge&) const { return INVALID;} 258 259 /// \brief Gives back the other ending of an edge. 260 /// 261 /// Gives back the other ending of an edge. 262 Node v(const Edge&) const { return INVALID;} 262 /// \brief Return the opposite arc. 263 /// 264 /// This function returns the opposite arc, i.e. the arc representing 265 /// the same edge and has opposite direction. 266 Arc oppositeArc(const Arc&) const { return INVALID; } 263 267 264 268 template <typename _Graph> … … 270 274 void constraints() { 271 275 checkConcept<BaseDigraphComponent, _Graph>(); 272 checkConcept<GraphItem<' u'>, Edge>();276 checkConcept<GraphItem<'e'>, Edge>(); 273 277 { 274 278 Node n; … … 278 282 n = graph.v(ue); 279 283 e = graph.direct(ue, true); 284 e = graph.direct(ue, false); 280 285 e = graph.direct(ue, n); 281 286 e = graph.oppositeArc(e); … … 291 296 }; 292 297 293 /// \brief An empty idable base digraph class.294 /// 295 /// This class provides beside the core digraph features296 /// core id functions for the digraph structure.297 /// The most of the base digraphs should be conform to this concept.298 /// Th e id's are unique and immutable.299 template <typename _Base= BaseDigraphComponent>300 class IDableDigraphComponent : public _Base{301 public: 302 303 typedef _BaseBase;298 /// \brief Skeleton class for \e idable directed graphs. 299 /// 300 /// This class describes the interface of \e idable directed graphs. 301 /// It extends \ref BaseDigraphComponent with the core ID functions. 302 /// The ids of the items must be unique and immutable. 303 /// This concept is part of the Digraph concept. 304 template <typename BAS = BaseDigraphComponent> 305 class IDableDigraphComponent : public BAS { 306 public: 307 308 typedef BAS Base; 304 309 typedef typename Base::Node Node; 305 310 typedef typename Base::Arc Arc; 306 311 307 /// \brief Gives back an unique integer id for the Node. 308 /// 309 /// Gives back an unique integer id for the Node. 310 /// 311 int id(const Node&) const { return -1;} 312 313 /// \brief Gives back the node by the unique id. 314 /// 315 /// Gives back the node by the unique id. 316 /// If the digraph does not contain node with the given id 317 /// then the result of the function is undetermined. 318 Node nodeFromId(int) const { return INVALID;} 319 320 /// \brief Gives back an unique integer id for the Arc. 321 /// 322 /// Gives back an unique integer id for the Arc. 323 /// 324 int id(const Arc&) const { return -1;} 325 326 /// \brief Gives back the arc by the unique id. 327 /// 328 /// Gives back the arc by the unique id. 329 /// If the digraph does not contain arc with the given id 330 /// then the result of the function is undetermined. 331 Arc arcFromId(int) const { return INVALID;} 332 333 /// \brief Gives back an integer greater or equal to the maximum 334 /// Node id. 335 /// 336 /// Gives back an integer greater or equal to the maximum Node 337 /// id. 338 int maxNodeId() const { return -1;} 339 340 /// \brief Gives back an integer greater or equal to the maximum 341 /// Arc id. 342 /// 343 /// Gives back an integer greater or equal to the maximum Arc 344 /// id. 345 int maxArcId() const { return -1;} 312 /// \brief Return a unique integer id for the given node. 313 /// 314 /// This function returns a unique integer id for the given node. 315 int id(const Node&) const { return -1; } 316 317 /// \brief Return the node by its unique id. 318 /// 319 /// This function returns the node by its unique id. 320 /// If the digraph does not contain a node with the given id, 321 /// then the result of the function is undefined. 322 Node nodeFromId(int) const { return INVALID; } 323 324 /// \brief Return a unique integer id for the given arc. 325 /// 326 /// This function returns a unique integer id for the given arc. 327 int id(const Arc&) const { return -1; } 328 329 /// \brief Return the arc by its unique id. 330 /// 331 /// This function returns the arc by its unique id. 332 /// If the digraph does not contain an arc with the given id, 333 /// then the result of the function is undefined. 334 Arc arcFromId(int) const { return INVALID; } 335 336 /// \brief Return an integer greater or equal to the maximum 337 /// node id. 338 /// 339 /// This function returns an integer greater or equal to the 340 /// maximum node id. 341 int maxNodeId() const { return -1; } 342 343 /// \brief Return an integer greater or equal to the maximum 344 /// arc id. 345 /// 346 /// This function returns an integer greater or equal to the 347 /// maximum arc id. 348 int maxArcId() const { return -1; } 346 349 347 350 template <typename _Digraph> … … 369 372 }; 370 373 371 /// \brief An empty idable base undirected graph class. 372 /// 373 /// This class provides beside the core undirected graph features 374 /// core id functions for the undirected graph structure. The 375 /// most of the base undirected graphs should be conform to this 376 /// concept. The id's are unique and immutable. 377 template <typename _Base = BaseGraphComponent> 378 class IDableGraphComponent : public IDableDigraphComponent<_Base> { 379 public: 380 381 typedef _Base Base; 374 /// \brief Skeleton class for \e idable undirected graphs. 375 /// 376 /// This class describes the interface of \e idable undirected 377 /// graphs. It extends \ref IDableDigraphComponent with the core ID 378 /// functions of undirected graphs. 379 /// The ids of the items must be unique and immutable. 380 /// This concept is part of the Graph concept. 381 template <typename BAS = BaseGraphComponent> 382 class IDableGraphComponent : public IDableDigraphComponent<BAS> { 383 public: 384 385 typedef BAS Base; 382 386 typedef typename Base::Edge Edge; 383 387 384 using IDableDigraphComponent<_Base>::id; 385 386 /// \brief Gives back an unique integer id for the Edge. 387 /// 388 /// Gives back an unique integer id for the Edge. 389 /// 390 int id(const Edge&) const { return -1;} 391 392 /// \brief Gives back the edge by the unique id. 393 /// 394 /// Gives back the edge by the unique id. If the 395 /// graph does not contain arc with the given id then the 396 /// result of the function is undetermined. 397 Edge edgeFromId(int) const { return INVALID;} 398 399 /// \brief Gives back an integer greater or equal to the maximum 400 /// Edge id. 401 /// 402 /// Gives back an integer greater or equal to the maximum Edge 403 /// id. 404 int maxEdgeId() const { return -1;} 388 using IDableDigraphComponent<Base>::id; 389 390 /// \brief Return a unique integer id for the given edge. 391 /// 392 /// This function returns a unique integer id for the given edge. 393 int id(const Edge&) const { return -1; } 394 395 /// \brief Return the edge by its unique id. 396 /// 397 /// This function returns the edge by its unique id. 398 /// If the graph does not contain an edge with the given id, 399 /// then the result of the function is undefined. 400 Edge edgeFromId(int) const { return INVALID; } 401 402 /// \brief Return an integer greater or equal to the maximum 403 /// edge id. 404 /// 405 /// This function returns an integer greater or equal to the 406 /// maximum edge id. 407 int maxEdgeId() const { return -1; } 405 408 406 409 template <typename _Graph> … … 408 411 409 412 void constraints() { 410 checkConcept<Base, _Graph >();411 413 checkConcept<IDableDigraphComponent<Base>, _Graph >(); 412 414 typename _Graph::Edge edge; … … 422 424 }; 423 425 424 /// \brief Skeleton class for graph NodeIt and ArcIt425 /// 426 /// Skeleton class for graph NodeIt and ArcIt.427 /// 428 template <typename _Graph, typename _Item>429 class GraphItemIt : public _Item {426 /// \brief Concept class for \c NodeIt, \c ArcIt and \c EdgeIt types. 427 /// 428 /// This class describes the concept of \c NodeIt, \c ArcIt and 429 /// \c EdgeIt subtypes of digraph and graph types. 430 template <typename GR, typename Item> 431 class GraphItemIt : public Item { 430 432 public: 431 433 /// \brief Default constructor. 432 434 /// 433 /// @warning The default constructor sets the iterator 434 /// to an undefined value. 435 /// Default constructor. 436 /// \warning The default constructor is not required to set 437 /// the iterator to some well-defined value. So you should consider it 438 /// as uninitialized. 435 439 GraphItemIt() {} 440 436 441 /// \brief Copy constructor. 437 442 /// 438 443 /// Copy constructor. 439 /// 440 GraphItemIt(const GraphItemIt& ) {} 441 /// \brief Sets the iterator to the first item. 442 /// 443 /// Sets the iterator to the first item of \c the graph. 444 /// 445 explicit GraphItemIt(const _Graph&) {} 446 /// \brief Invalid constructor \& conversion. 447 /// 448 /// This constructor initializes the item to be invalid. 444 GraphItemIt(const GraphItemIt& it) : Item(it) {} 445 446 /// \brief Constructor that sets the iterator to the first item. 447 /// 448 /// Constructor that sets the iterator to the first item. 449 explicit GraphItemIt(const GR&) {} 450 451 /// \brief Constructor for conversion from \c INVALID. 452 /// 453 /// Constructor for conversion from \c INVALID. 454 /// It initializes the iterator to be invalid. 449 455 /// \sa Invalid for more details. 450 456 GraphItemIt(Invalid) {} 451 /// \brief Assign operator for items. 452 /// 453 /// The items are assignable.454 /// 457 458 /// \brief Assignment operator. 459 /// 460 /// Assignment operator for the iterator. 455 461 GraphItemIt& operator=(const GraphItemIt&) { return *this; } 456 /// \brief Next item. 457 /// 458 /// Assign the iterator to the next item. 459 /// 462 463 /// \brief Increment the iterator. 464 /// 465 /// This operator increments the iterator, i.e. assigns it to the 466 /// next item. 460 467 GraphItemIt& operator++() { return *this; } 468 461 469 /// \brief Equality operator 462 470 /// 471 /// Equality operator. 463 472 /// Two iterators are equal if and only if they point to the 464 473 /// same object or both are invalid. 465 474 bool operator==(const GraphItemIt&) const { return true;} 475 466 476 /// \brief Inequality operator 467 477 /// 468 /// \sa operator==(Node n) 469 /// 478 /// Inequality operator. 479 /// Two iterators are equal if and only if they point to the 480 /// same object or both are invalid. 470 481 bool operator!=(const GraphItemIt&) const { return true;} 471 482 … … 473 484 struct Constraints { 474 485 void constraints() { 486 checkConcept<GraphItem<>, _GraphItemIt>(); 475 487 _GraphItemIt it1(g); 476 488 _GraphItemIt it2; 489 _GraphItemIt it3 = it1; 490 _GraphItemIt it4 = INVALID; 477 491 478 492 it2 = ++it1; … … 480 494 ++(++it1); 481 495 482 _Item bi = it1;496 Item bi = it1; 483 497 bi = it2; 484 498 } 485 _Graph& g; 486 }; 487 }; 488 489 /// \brief Skeleton class for graph InArcIt and OutArcIt 490 /// 491 /// \note Because InArcIt and OutArcIt may not inherit from the same 492 /// base class, the _selector is a additional template parameter. For 493 /// InArcIt you should instantiate it with character 'i' and for 494 /// OutArcIt with 'o'. 495 template <typename _Graph, 496 typename _Item = typename _Graph::Arc, 497 typename _Base = typename _Graph::Node, 498 char _selector = '0'> 499 class GraphIncIt : public _Item { 499 const GR& g; 500 }; 501 }; 502 503 /// \brief Concept class for \c InArcIt, \c OutArcIt and 504 /// \c IncEdgeIt types. 505 /// 506 /// This class describes the concept of \c InArcIt, \c OutArcIt 507 /// and \c IncEdgeIt subtypes of digraph and graph types. 508 /// 509 /// \note Since these iterator classes do not inherit from the same 510 /// base class, there is an additional template parameter (selector) 511 /// \c sel. For \c InArcIt you should instantiate it with character 512 /// \c 'i', for \c OutArcIt with \c 'o' and for \c IncEdgeIt with \c 'e'. 513 template <typename GR, 514 typename Item = typename GR::Arc, 515 typename Base = typename GR::Node, 516 char sel = '0'> 517 class GraphIncIt : public Item { 500 518 public: 501 519 /// \brief Default constructor. 502 520 /// 503 /// @warning The default constructor sets the iterator 504 /// to an undefined value. 521 /// Default constructor. 522 /// \warning The default constructor is not required to set 523 /// the iterator to some well-defined value. So you should consider it 524 /// as uninitialized. 505 525 GraphIncIt() {} 526 506 527 /// \brief Copy constructor. 507 528 /// 508 529 /// Copy constructor. 509 /// 510 GraphIncIt(GraphIncIt const& gi) : _Item(gi) {} 511 /// \brief Sets the iterator to the first arc incoming into or outgoing 512 /// from the node. 513 /// 514 /// Sets the iterator to the first arc incoming into or outgoing 515 /// from the node. 516 /// 517 explicit GraphIncIt(const _Graph&, const _Base&) {} 518 /// \brief Invalid constructor \& conversion. 519 /// 520 /// This constructor initializes the item to be invalid. 530 GraphIncIt(const GraphIncIt& it) : Item(it) {} 531 532 /// \brief Constructor that sets the iterator to the first 533 /// incoming or outgoing arc. 534 /// 535 /// Constructor that sets the iterator to the first arc 536 /// incoming to or outgoing from the given node. 537 explicit GraphIncIt(const GR&, const Base&) {} 538 539 /// \brief Constructor for conversion from \c INVALID. 540 /// 541 /// Constructor for conversion from \c INVALID. 542 /// It initializes the iterator to be invalid. 521 543 /// \sa Invalid for more details. 522 544 GraphIncIt(Invalid) {} 523 /// \brief Assign operator for iterators. 524 /// 525 /// The iterators are assignable. 526 /// 527 GraphIncIt& operator=(GraphIncIt const&) { return *this; } 528 /// \brief Next item. 529 /// 530 /// Assign the iterator to the next item. 531 /// 545 546 /// \brief Assignment operator. 547 /// 548 /// Assignment operator for the iterator. 549 GraphIncIt& operator=(const GraphIncIt&) { return *this; } 550 551 /// \brief Increment the iterator. 552 /// 553 /// This operator increments the iterator, i.e. assigns it to the 554 /// next arc incoming to or outgoing from the given node. 532 555 GraphIncIt& operator++() { return *this; } 533 556 534 557 /// \brief Equality operator 535 558 /// 559 /// Equality operator. 536 560 /// Two iterators are equal if and only if they point to the 537 561 /// same object or both are invalid. … … 540 564 /// \brief Inequality operator 541 565 /// 542 /// \sa operator==(Node n) 543 /// 566 /// Inequality operator. 567 /// Two iterators are equal if and only if they point to the 568 /// same object or both are invalid. 544 569 bool operator!=(const GraphIncIt&) const { return true;} 545 570 … … 547 572 struct Constraints { 548 573 void constraints() { 549 checkConcept<GraphItem< _selector>, _GraphIncIt>();574 checkConcept<GraphItem<sel>, _GraphIncIt>(); 550 575 _GraphIncIt it1(graph, node); 551 576 _GraphIncIt it2; 577 _GraphIncIt it3 = it1; 578 _GraphIncIt it4 = INVALID; 552 579 553 580 it2 = ++it1; 554 581 ++it2 = it1; 555 582 ++(++it1); 556 _Item e = it1;583 Item e = it1; 557 584 e = it2; 558 559 } 560 561 _Item arc; 562 _Base node; 563 _Graph graph; 564 _GraphIncIt it; 565 }; 566 }; 567 568 569 /// \brief An empty iterable digraph class. 570 /// 571 /// This class provides beside the core digraph features 572 /// iterator based iterable interface for the digraph structure. 585 } 586 const Base& node; 587 const GR& graph; 588 }; 589 }; 590 591 /// \brief Skeleton class for iterable directed graphs. 592 /// 593 /// This class describes the interface of iterable directed 594 /// graphs. It extends \ref BaseDigraphComponent with the core 595 /// iterable interface. 573 596 /// This concept is part of the Digraph concept. 574 template <typename _Base= BaseDigraphComponent>575 class IterableDigraphComponent : public _Base{576 577 public: 578 579 typedef _BaseBase;597 template <typename BAS = BaseDigraphComponent> 598 class IterableDigraphComponent : public BAS { 599 600 public: 601 602 typedef BAS Base; 580 603 typedef typename Base::Node Node; 581 604 typedef typename Base::Arc Arc; … … 583 606 typedef IterableDigraphComponent Digraph; 584 607 585 /// \name Base iteration586 /// 587 /// This interface provides functions for iteration on digraph items 608 /// \name Base Iteration 609 /// 610 /// This interface provides functions for iteration on digraph items. 588 611 /// 589 612 /// @{ 590 613 591 /// \brief Gives back the first node in the iterating order. 592 /// 593 /// Gives back the first node in the iterating order. 594 /// 614 /// \brief Return the first node. 615 /// 616 /// This function gives back the first node in the iteration order. 595 617 void first(Node&) const {} 596 618 597 /// \brief Gives back the next node in the iterating order. 598 /// 599 /// Gives back the next node in the iterating order. 600 /// 619 /// \brief Return the next node. 620 /// 621 /// This function gives back the next node in the iteration order. 601 622 void next(Node&) const {} 602 623 603 /// \brief Gives back the first arc in the iterating order. 604 /// 605 /// Gives back the first arc in the iterating order. 606 /// 624 /// \brief Return the first arc. 625 /// 626 /// This function gives back the first arc in the iteration order. 607 627 void first(Arc&) const {} 608 628 609 /// \brief Gives back the next arc in the iterating order. 610 /// 611 /// Gives back the next arc in the iterating order. 612 /// 629 /// \brief Return the next arc. 630 /// 631 /// This function gives back the next arc in the iteration order. 613 632 void next(Arc&) const {} 614 633 615 616 /// \brief Gives back the first of the arcs point to the given 617 /// node. 618 /// 619 /// Gives back the first of the arcs point to the given node. 620 /// 634 /// \brief Return the first arc incomming to the given node. 635 /// 636 /// This function gives back the first arc incomming to the 637 /// given node. 621 638 void firstIn(Arc&, const Node&) const {} 622 639 623 /// \brief Gives back the next of the arcs points to the given 624 /// node. 625 /// 626 /// Gives back the next of the arcs points to the given node. 627 /// 640 /// \brief Return the next arc incomming to the given node. 641 /// 642 /// This function gives back the next arc incomming to the 643 /// given node. 628 644 void nextIn(Arc&) const {} 629 645 630 /// \brief Gives back the first of the arcs start from the 646 /// \brief Return the first arc outgoing form the given node. 647 /// 648 /// This function gives back the first arc outgoing form the 631 649 /// given node. 632 ///633 /// Gives back the first of the arcs start from the given node.634 ///635 650 void firstOut(Arc&, const Node&) const {} 636 651 637 /// \brief Gives back the next of the arcs start from the given 638 /// node. 639 /// 640 /// Gives back the next of the arcs start from the given node. 641 /// 652 /// \brief Return the next arc outgoing form the given node. 653 /// 654 /// This function gives back the next arc outgoing form the 655 /// given node. 642 656 void nextOut(Arc&) const {} 643 657 644 658 /// @} 645 659 646 /// \name Class based iteration647 /// 648 /// This interface provides functions for iteration on digraph items660 /// \name Class Based Iteration 661 /// 662 /// This interface provides iterator classes for digraph items. 649 663 /// 650 664 /// @{ … … 656 670 typedef GraphItemIt<Digraph, Node> NodeIt; 657 671 658 /// \brief This iterator goes through each node.659 /// 660 /// This iterator goes through each node.672 /// \brief This iterator goes through each arc. 673 /// 674 /// This iterator goes through each arc. 661 675 /// 662 676 typedef GraphItemIt<Digraph, Arc> ArcIt; … … 664 678 /// \brief This iterator goes trough the incoming arcs of a node. 665 679 /// 666 /// This iterator goes trough the \e inc coming arcs of a certain node680 /// This iterator goes trough the \e incoming arcs of a certain node 667 681 /// of a digraph. 668 682 typedef GraphIncIt<Digraph, Arc, Node, 'i'> InArcIt; … … 676 690 /// \brief The base node of the iterator. 677 691 /// 678 /// Gives back the base node of the iterator.679 /// It is always the target of the pointed arc.692 /// This function gives back the base node of the iterator. 693 /// It is always the target node of the pointed arc. 680 694 Node baseNode(const InArcIt&) const { return INVALID; } 681 695 682 696 /// \brief The running node of the iterator. 683 697 /// 684 /// Gives back the running node of the iterator.685 /// It is always the source of the pointed arc.698 /// This function gives back the running node of the iterator. 699 /// It is always the source node of the pointed arc. 686 700 Node runningNode(const InArcIt&) const { return INVALID; } 687 701 688 702 /// \brief The base node of the iterator. 689 703 /// 690 /// Gives back the base node of the iterator.691 /// It is always the source of the pointed arc.704 /// This function gives back the base node of the iterator. 705 /// It is always the source node of the pointed arc. 692 706 Node baseNode(const OutArcIt&) const { return INVALID; } 693 707 694 708 /// \brief The running node of the iterator. 695 709 /// 696 /// Gives back the running node of the iterator.697 /// It is always the target of the pointed arc.710 /// This function gives back the running node of the iterator. 711 /// It is always the target node of the pointed arc. 698 712 Node runningNode(const OutArcIt&) const { return INVALID; } 699 713 … … 737 751 738 752 typename _Digraph::Node n; 739 typename _Digraph::InArcIt ieit(INVALID);740 typename _Digraph::OutArcIt oeit(INVALID);741 n = digraph.baseNode(i eit);742 n = digraph.runningNode(i eit);743 n = digraph.baseNode(o eit);744 n = digraph.runningNode(o eit);753 const typename _Digraph::InArcIt iait(INVALID); 754 const typename _Digraph::OutArcIt oait(INVALID); 755 n = digraph.baseNode(iait); 756 n = digraph.runningNode(iait); 757 n = digraph.baseNode(oait); 758 n = digraph.runningNode(oait); 745 759 ignore_unused_variable_warning(n); 746 760 } … … 748 762 749 763 const _Digraph& digraph; 750 751 752 }; 753 754 /// \brief An empty iterable undirected graph class.755 /// 756 /// This class provides beside the core graph features iterator757 /// based iterable interface for the undirected graph structure.764 }; 765 }; 766 767 /// \brief Skeleton class for iterable undirected graphs. 768 /// 769 /// This class describes the interface of iterable undirected 770 /// graphs. It extends \ref IterableDigraphComponent with the core 771 /// iterable interface of undirected graphs. 758 772 /// This concept is part of the Graph concept. 759 template <typename _Base= BaseGraphComponent>760 class IterableGraphComponent : public IterableDigraphComponent< _Base> {761 public: 762 763 typedef _BaseBase;773 template <typename BAS = BaseGraphComponent> 774 class IterableGraphComponent : public IterableDigraphComponent<BAS> { 775 public: 776 777 typedef BAS Base; 764 778 typedef typename Base::Node Node; 765 779 typedef typename Base::Arc Arc; … … 769 783 typedef IterableGraphComponent Graph; 770 784 771 /// \name Base iteration 772 /// 773 /// This interface provides functions for iteration on graph items 785 /// \name Base Iteration 786 /// 787 /// This interface provides functions for iteration on edges. 788 /// 774 789 /// @{ 775 790 776 using IterableDigraphComponent<_Base>::first; 777 using IterableDigraphComponent<_Base>::next; 778 779 /// \brief Gives back the first edge in the iterating 780 /// order. 781 /// 782 /// Gives back the first edge in the iterating order. 783 /// 791 using IterableDigraphComponent<Base>::first; 792 using IterableDigraphComponent<Base>::next; 793 794 /// \brief Return the first edge. 795 /// 796 /// This function gives back the first edge in the iteration order. 784 797 void first(Edge&) const {} 785 798 786 /// \brief Gives back the next edge in the iterating 787 /// order. 788 /// 789 /// Gives back the next edge in the iterating order. 790 /// 799 /// \brief Return the next edge. 800 /// 801 /// This function gives back the next edge in the iteration order. 791 802 void next(Edge&) const {} 792 803 793 794 /// \brief Gives back the first of the edges from the 804 /// \brief Return the first edge incident to the given node. 805 /// 806 /// This function gives back the first edge incident to the given 807 /// node. The bool parameter gives back the direction for which the 808 /// source node of the directed arc representing the edge is the 795 809 /// given node. 796 ///797 /// Gives back the first of the edges from the given798 /// node. The bool parameter gives back that direction which799 /// gives a good direction of the edge so the source of the800 /// directed arc is the given node.801 810 void firstInc(Edge&, bool&, const Node&) const {} 802 811 … … 804 813 /// given node. 805 814 /// 806 /// Gives back the next of the edges from the given 807 /// node. The bool parameter should be used as the \c firstInc() 808 /// use it. 815 /// This function gives back the next edge incident to the given 816 /// node. The bool parameter should be used as \c firstInc() use it. 809 817 void nextInc(Edge&, bool&) const {} 810 818 811 using IterableDigraphComponent< _Base>::baseNode;812 using IterableDigraphComponent< _Base>::runningNode;819 using IterableDigraphComponent<Base>::baseNode; 820 using IterableDigraphComponent<Base>::runningNode; 813 821 814 822 /// @} 815 823 816 /// \name Class based iteration817 /// 818 /// This interface provides functions for iteration on graph items824 /// \name Class Based Iteration 825 /// 826 /// This interface provides iterator classes for edges. 819 827 /// 820 828 /// @{ 821 829 822 /// \brief This iterator goes through each node.823 /// 824 /// This iterator goes through each node.830 /// \brief This iterator goes through each edge. 831 /// 832 /// This iterator goes through each edge. 825 833 typedef GraphItemIt<Graph, Edge> EdgeIt; 826 /// \brief This iterator goes trough the incident arcs of a 834 835 /// \brief This iterator goes trough the incident edges of a 827 836 /// node. 828 837 /// 829 /// This iterator goes trough the incident arcs of a certain838 /// This iterator goes trough the incident edges of a certain 830 839 /// node of a graph. 831 typedef GraphIncIt<Graph, Edge, Node, 'u'> IncEdgeIt; 840 typedef GraphIncIt<Graph, Edge, Node, 'e'> IncEdgeIt; 841 832 842 /// \brief The base node of the iterator. 833 843 /// 834 /// Gives back the base node of the iterator.844 /// This function gives back the base node of the iterator. 835 845 Node baseNode(const IncEdgeIt&) const { return INVALID; } 836 846 837 847 /// \brief The running node of the iterator. 838 848 /// 839 /// Gives back the running node of the iterator.849 /// This function gives back the running node of the iterator. 840 850 Node runningNode(const IncEdgeIt&) const { return INVALID; } 841 851 … … 866 876 typename _Graph::EdgeIt >(); 867 877 checkConcept<GraphIncIt<_Graph, typename _Graph::Edge, 868 typename _Graph::Node, ' u'>, typename _Graph::IncEdgeIt>();878 typename _Graph::Node, 'e'>, typename _Graph::IncEdgeIt>(); 869 879 870 880 typename _Graph::Node n; 871 typename _Graph::IncEdgeIt ueit(INVALID);872 n = graph.baseNode( ueit);873 n = graph.runningNode( ueit);881 const typename _Graph::IncEdgeIt ieit(INVALID); 882 n = graph.baseNode(ieit); 883 n = graph.runningNode(ieit); 874 884 } 875 885 } 876 886 877 887 const _Graph& graph; 878 879 880 }; 881 882 /// \brief An empty alteration notifier digraph class.883 /// 884 /// This class provides beside the core digraph featuresalteration885 /// notifier interface for the digraph structure. Thisimplements888 }; 889 }; 890 891 /// \brief Skeleton class for alterable directed graphs. 892 /// 893 /// This class describes the interface of alterable directed 894 /// graphs. It extends \ref BaseDigraphComponent with the alteration 895 /// notifier interface. It implements 886 896 /// an observer-notifier pattern for each digraph item. More 887 897 /// obsevers can be registered into the notifier and whenever an 888 /// alteration occured in the digraph all the observers will 898 /// alteration occured in the digraph all the observers will be 889 899 /// notified about it. 890 template <typename _Base= BaseDigraphComponent>891 class AlterableDigraphComponent : public _Base{892 public: 893 894 typedef _BaseBase;900 template <typename BAS = BaseDigraphComponent> 901 class AlterableDigraphComponent : public BAS { 902 public: 903 904 typedef BAS Base; 895 905 typedef typename Base::Node Node; 896 906 typedef typename Base::Arc Arc; 897 907 898 908 899 /// The node observer registry.909 /// Node alteration notifier class. 900 910 typedef AlterationNotifier<AlterableDigraphComponent, Node> 901 911 NodeNotifier; 902 /// The arc observer registry.912 /// Arc alteration notifier class. 903 913 typedef AlterationNotifier<AlterableDigraphComponent, Arc> 904 914 ArcNotifier; 905 915 906 /// \brief Gives backthe node alteration notifier.907 /// 908 /// Gives back the node alteration notifier.916 /// \brief Return the node alteration notifier. 917 /// 918 /// This function gives back the node alteration notifier. 909 919 NodeNotifier& notifier(Node) const { 910 return NodeNotifier();920 return NodeNotifier(); 911 921 } 912 922 913 /// \brief Gives backthe arc alteration notifier.914 /// 915 /// Gives back the arc alteration notifier.923 /// \brief Return the arc alteration notifier. 924 /// 925 /// This function gives back the arc alteration notifier. 916 926 ArcNotifier& notifier(Arc) const { 917 927 return ArcNotifier(); … … 933 943 934 944 const _Digraph& digraph; 935 936 }; 937 938 }; 939 940 /// \brief An empty alteration notifier undirected graph class. 941 /// 942 /// This class provides beside the core graph features alteration 943 /// notifier interface for the graph structure. This implements 944 /// an observer-notifier pattern for each graph item. More 945 }; 946 }; 947 948 /// \brief Skeleton class for alterable undirected graphs. 949 /// 950 /// This class describes the interface of alterable undirected 951 /// graphs. It extends \ref AlterableDigraphComponent with the alteration 952 /// notifier interface of undirected graphs. It implements 953 /// an observer-notifier pattern for the edges. More 945 954 /// obsevers can be registered into the notifier and whenever an 946 /// alteration occured in the graph all the observers will 955 /// alteration occured in the graph all the observers will be 947 956 /// notified about it. 948 template <typename _Base= BaseGraphComponent>949 class AlterableGraphComponent : public AlterableDigraphComponent< _Base> {950 public: 951 952 typedef _BaseBase;957 template <typename BAS = BaseGraphComponent> 958 class AlterableGraphComponent : public AlterableDigraphComponent<BAS> { 959 public: 960 961 typedef BAS Base; 953 962 typedef typename Base::Edge Edge; 954 963 955 964 956 /// The arc observer registry.965 /// Edge alteration notifier class. 957 966 typedef AlterationNotifier<AlterableGraphComponent, Edge> 958 967 EdgeNotifier; 959 968 960 /// \brief Gives back the arcalteration notifier.961 /// 962 /// Gives back the arcalteration notifier.969 /// \brief Return the edge alteration notifier. 970 /// 971 /// This function gives back the edge alteration notifier. 963 972 EdgeNotifier& notifier(Edge) const { 964 973 return EdgeNotifier(); … … 968 977 struct Constraints { 969 978 void constraints() { 970 checkConcept<Alterable GraphComponent<Base>, _Graph>();979 checkConcept<AlterableDigraphComponent<Base>, _Graph>(); 971 980 typename _Graph::EdgeNotifier& uen 972 981 = graph.notifier(typename _Graph::Edge()); … … 975 984 976 985 const _Graph& graph; 977 978 }; 979 980 }; 981 982 /// \brief Class describing the concept of graph maps 983 /// 984 /// This class describes the common interface of the graph maps 985 /// (NodeMap, ArcMap), that is maps that can be used to 986 /// associate data to graph descriptors (nodes or arcs). 987 template <typename _Graph, typename _Item, typename _Value> 988 class GraphMap : public ReadWriteMap<_Item, _Value> { 989 public: 990 991 typedef ReadWriteMap<_Item, _Value> Parent; 992 993 /// The graph type of the map. 994 typedef _Graph Graph; 986 }; 987 }; 988 989 /// \brief Concept class for standard graph maps. 990 /// 991 /// This class describes the concept of standard graph maps, i.e. 992 /// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and 993