COIN-OR::LEMON - Graph Library

Changes in / [932:773dd96ecdd8:931:f112c18bc304] in lemon-main


Ignore:
Files:
1 added
9 deleted
36 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r930 r744  
    33SET(PROJECT_NAME "LEMON")
    44PROJECT(${PROJECT_NAME})
    5 
    6 INCLUDE(FindPythonInterp)
    7 INCLUDE(FindWget)
    85
    96IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake)
     
    129  SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.")
    1310ELSE()
    14   EXECUTE_PROCESS(
    15     COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py
    16     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    17     OUTPUT_VARIABLE HG_REVISION_PATH
    18     ERROR_QUIET
    19     OUTPUT_STRIP_TRAILING_WHITESPACE
    20   )
    2111  EXECUTE_PROCESS(
    2212    COMMAND hg id -i
     
    2717  )
    2818  IF(HG_REVISION STREQUAL "")
    29     SET(HG_REVISION_ID "hg-tip")
    30   ELSE()
    31     IF(HG_REVISION_PATH STREQUAL "")
    32       SET(HG_REVISION_ID ${HG_REVISION})
    33     ELSE()
    34       SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION})
    35     ENDIF()
     19    SET(HG_REVISION "hg-tip")
    3620  ENDIF()
    37   SET(LEMON_VERSION ${HG_REVISION_ID} CACHE STRING "LEMON version string.")
     21  SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.")
    3822ENDIF()
    3923
     
    4832FIND_PACKAGE(COIN)
    4933
    50 IF(DEFINED ENV{LEMON_CXX_WARNING})
    51   SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
    52 ELSE()
    53   IF(CMAKE_COMPILER_IS_GNUCXX)
    54     SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas")
    55     SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
    56     SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
    57   ELSEIF(MSVC)
    58     # This part is unnecessary 'casue the same is set by the lemon/core.h.
    59     # Still keep it as an example.
    60     SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
    61     # Suppressed warnings:
    62     # C4250: 'class1' : inherits 'class2::member' via dominance
    63     # C4355: 'this' : used in base member initializer list
    64     # C4503: 'function' : decorated name length exceeded, name was truncated
    65     # C4800: 'type' : forcing value to bool 'true' or 'false'
    66     #        (performance warning)
    67     # C4996: 'function': was declared deprecated
    68   ELSE()
    69     SET(CXX_WARNING "-Wall -W")
    70   ENDIF()
    71 ENDIF()
    72 SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
    73 
    74 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
    75 
    76 SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb" CACHE STRING
    77     "Flags used by the C++ compiler during maintainer builds."
    78     FORCE )
    79 SET( CMAKE_C_FLAGS_MAINTAINER "-Werror" CACHE STRING
    80     "Flags used by the C compiler during maintainer builds."
    81     FORCE )
    82 SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    83     "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
    84     "Flags used for linking binaries during maintainer builds."
    85     FORCE )
    86 SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
    87     "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
    88     "Flags used by the shared libraries linker during maintainer builds."
    89     FORCE )
    90 MARK_AS_ADVANCED(
    91     CMAKE_CXX_FLAGS_MAINTAINER
    92     CMAKE_C_FLAGS_MAINTAINER
    93     CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    94     CMAKE_SHARED_LINKER_FLAGS_MAINTAINER )
    95 
    96 IF(CMAKE_CONFIGURATION_TYPES)
    97   LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer)
    98   LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
    99   SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
    100       "Add the configurations that we need"
    101       FORCE)
    102  endif()
    103 
    104 IF(NOT CMAKE_BUILD_TYPE)
    105   SET(CMAKE_BUILD_TYPE "Release")
    106 ENDIF()
    107 
    108 SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
    109     "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer."
    110     FORCE )
    111 
    112 
    11334INCLUDE(CheckTypeSize)
    11435CHECK_TYPE_SIZE("long long" LONG_LONG)
    11536SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
    11637
     38INCLUDE(FindPythonInterp)
     39
    11740ENABLE_TESTING()
    118 
    119 IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    120   ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND})
    121 ELSE()
    122   ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})
    123 ENDIF()
    12441
    12542ADD_SUBDIRECTORY(lemon)
    12643IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
    127   ADD_SUBDIRECTORY(contrib)
    12844  ADD_SUBDIRECTORY(demo)
    12945  ADD_SUBDIRECTORY(tools)
     
    14965ENDIF()
    15066
    151 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
     67IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} AND WIN32)
    15268  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
    15369  SET(CPACK_PACKAGE_VENDOR "EGRES")
  • LICENSE

    r879 r553  
    22copyright/license.
    33
    4 Copyright (C) 2003-2010 Egervary Jeno Kombinatorikus Optimalizalasi
     4Copyright (C) 2003-2009 Egervary Jeno Kombinatorikus Optimalizalasi
    55Kutatocsoport (Egervary Combinatorial Optimization Research Group,
    66EGRES).
  • NEWS

    r881 r665  
    1 2010-03-19 Version 1.2 released
    2 
    3         This is major feature release
    4 
    5         * New algorithms
    6           * Bellman-Ford algorithm (#51)
    7           * Minimum mean cycle algorithms (#179)
    8             * Karp, Hartman-Orlin and Howard algorithms
    9           * New minimum cost flow algorithms (#180)
    10             * Cost Scaling algorithms
    11             * Capacity Scaling algorithm
    12             * Cycle-Canceling algorithms
    13           * Planarity related algorithms (#62)
    14             * Planarity checking algorithm
    15             * Planar embedding algorithm
    16             * Schnyder's planar drawing algorithm
    17             * Coloring planar graphs with five or six colors
    18           * Fractional matching algorithms (#314)
    19         * New data structures
    20           * StaticDigraph structure (#68)
    21           * Several new priority queue structures (#50, #301)
    22             * Fibonacci, Radix, Bucket, Pairing, Binomial
    23               D-ary and fourary heaps (#301)
    24           * Iterable map structures (#73)
    25         * Other new tools and functionality
    26           * Map utility functions (#320)
    27           * Reserve functions are added to ListGraph and SmartGraph (#311)
    28           * A resize() function is added to HypercubeGraph (#311)
    29           * A count() function is added to CrossRefMap (#302)
    30           * Support for multiple targets in Suurballe using fullInit() (#181)
    31           * Traits class and named parameters for Suurballe (#323)
    32           * Separate reset() and resetParams() functions in NetworkSimplex
    33             to handle graph changes (#327)
    34           * tolerance() functions are added to HaoOrlin (#306)
    35         * Implementation improvements
    36           * Improvements in weighted matching algorithms (#314)
    37             * Jumpstart initialization
    38           * ArcIt iteration is based on out-arc lists instead of in-arc lists
    39             in ListDigraph (#311)
    40           * Faster add row operation in CbcMip (#203)
    41           * Better implementation for split() in ListDigraph (#311)
    42           * ArgParser can also throw exception instead of exit(1) (#332)
    43         * Miscellaneous
    44           * A simple interactive bootstrap script
    45           * Doc improvements (#62,#180,#299,#302,#303,#304,#307,#311,#331,#315,
    46                 #316,#319)
    47             * BibTeX references in the doc (#184)
    48           * Optionally use valgrind when running tests
    49           * Also check ReferenceMapTag in concept checks (#312)
    50           * dimacs-solver uses long long type by default.
    51         * Several bugfixes (compared to release 1.1):
    52           #295: Suppress MSVC warnings using pragmas
    53           ----: Various CMAKE related improvements
    54                 * Remove duplications from doc/CMakeLists.txt
    55                 * Rename documentation install folder from 'docs' to 'html'
    56                 * Add tools/CMakeLists.txt to the tarball
    57                 * Generate and install LEMONConfig.cmake
    58                 * Change the label of the html project in Visual Studio
    59                 * Fix the check for the 'long long' type
    60                 * Put the version string into config.h
    61                 * Minor CMake improvements
    62                 * Set the version to 'hg-tip' if everything fails
    63           #311: Add missing 'explicit' keywords
    64           #302: Fix the implementation and doc of CrossRefMap
    65           #308: Remove duplicate list_graph.h entry from source list
    66           #307: Bugfix in Preflow and Circulation
    67           #305: Bugfix and extension in the rename script
    68           #312: Also check ReferenceMapTag in concept checks
    69           #250: Bugfix in pathSource() and pathTarget()
    70           #321: Use pathCopy(from,to) instead of copyPath(to,from)
    71           #322: Distribure LEMONConfig.cmake.in
    72           #330: Bug fix in map_extender.h
    73           #336: Fix the date field comment of graphToEps() output
    74           #323: Bug fix in Suurballe
    75           #335: Fix clear() function in ExtendFindEnum
    76           #337: Use void* as the LPX object pointer
    77           #317: Fix (and improve) error message in mip_test.cc
    78                 Remove unnecessary OsiCbc dependency
    79           #356: Allow multiple executions of weighted matching algorithms (#356)
    80 
    8112009-05-13 Version 1.1 released
    822
     
    15373          ----: Add missing unistd.h include to time_measure.h
    15474          #204: Compilation bug fixed in graph_to_eps.h with VS2005
    155           #214,#215: windows.h should never be included by LEMON headers
     75          #214,#215: windows.h should never be included by lemon headers
    15676          #230: Build systems check the availability of 'long long' type
    15777          #229: Default implementation of Tolerance<> is used for integer types
     
    175952008-10-13 Version 1.0 released
    17696
    177         This is the first stable release of LEMON. Compared to the 0.x
    178         release series, it features a considerably smaller but more
    179         matured set of tools. The API has also completely revised and
    180         changed in several places.
     97        This is the first stable release of LEMON. Compared to the 0.x
     98        release series, it features a considerably smaller but more
     99        matured set of tools. The API has also completely revised and
     100        changed in several places.
    181101
    182         * The major name changes compared to the 0.x series (see the
     102        * The major name changes compared to the 0.x series (see the
    183103          Migration Guide in the doc for more details)
    184104          * Graph -> Digraph, UGraph -> Graph
    185105          * Edge -> Arc, UEdge -> Edge
    186           * source(UEdge)/target(UEdge) -> u(Edge)/v(Edge)
    187         * Other improvements
    188           * Better documentation
    189           * Reviewed and cleaned up codebase
    190           * CMake based build system (along with the autotools based one)
    191         * Contents of the library (ported from 0.x)
    192           * Algorithms
    193             * breadth-first search (bfs.h)
    194             * depth-first search (dfs.h)
    195             * Dijkstra's algorithm (dijkstra.h)
    196             * Kruskal's algorithm (kruskal.h)
    197           * Data structures
    198             * graph data structures (list_graph.h, smart_graph.h)
    199             * path data structures (path.h)
    200             * binary heap data structure (bin_heap.h)
    201             * union-find data structures (unionfind.h)
    202             * miscellaneous property maps (maps.h)
    203             * two dimensional vector and bounding box (dim2.h)
     106          * source(UEdge)/target(UEdge) -> u(Edge)/v(Edge)
     107        * Other improvements
     108          * Better documentation
     109          * Reviewed and cleaned up codebase
     110          * CMake based build system (along with the autotools based one)
     111        * Contents of the library (ported from 0.x)
     112          * Algorithms
     113            * breadth-first search (bfs.h)
     114            * depth-first search (dfs.h)
     115            * Dijkstra's algorithm (dijkstra.h)
     116            * Kruskal's algorithm (kruskal.h)
     117          * Data structures
     118            * graph data structures (list_graph.h, smart_graph.h)
     119            * path data structures (path.h)
     120            * binary heap data structure (bin_heap.h)
     121            * union-find data structures (unionfind.h)
     122            * miscellaneous property maps (maps.h)
     123            * two dimensional vector and bounding box (dim2.h)
    204124          * Concepts
    205             * graph structure concepts (concepts/digraph.h, concepts/graph.h,
     125            * graph structure concepts (concepts/digraph.h, concepts/graph.h,
    206126              concepts/graph_components.h)
    207             * concepts for other structures (concepts/heap.h, concepts/maps.h,
    208               concepts/path.h)
    209           * Tools
    210             * Mersenne twister random number generator (random.h)
    211             * tools for measuring cpu and wall clock time (time_measure.h)
    212             * tools for counting steps and events (counter.h)
    213             * tool for parsing command line arguments (arg_parser.h)
    214             * tool for visualizing graphs (graph_to_eps.h)
    215             * tools for reading and writing data in LEMON Graph Format
     127            * concepts for other structures (concepts/heap.h, concepts/maps.h,
     128              concepts/path.h)
     129          * Tools
     130            * Mersenne twister random number generator (random.h)
     131            * tools for measuring cpu and wall clock time (time_measure.h)
     132            * tools for counting steps and events (counter.h)
     133            * tool for parsing command line arguments (arg_parser.h)
     134            * tool for visualizing graphs (graph_to_eps.h)
     135            * tools for reading and writing data in LEMON Graph Format
    216136              (lgf_reader.h, lgf_writer.h)
    217137            * tools to handle the anomalies of calculations with
    218               floating point numbers (tolerance.h)
     138              floating point numbers (tolerance.h)
    219139            * tools to manage RGB colors (color.h)
    220           * Infrastructure
    221             * extended assertion handling (assert.h)
    222             * exception classes and error handling (error.h)
    223             * concept checking (concept_check.h)
    224             * commonly used mathematical constants (math.h)
     140          * Infrastructure
     141            * extended assertion handling (assert.h)
     142            * exception classes and error handling (error.h)
     143            * concept checking (concept_check.h)
     144            * commonly used mathematical constants (math.h)
  • configure.ac

    r930 r793  
    115115dnl Add dependencies on files generated by configure.
    116116AC_SUBST([CONFIG_STATUS_DEPENDENCIES],
    117   ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/doc/mainpage.dox.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in'])
     117  ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in'])
    118118
    119119AC_CONFIG_FILES([
     
    122122cmake/version.cmake
    123123doc/Doxyfile
    124 doc/mainpage.dox
    125124lemon/lemon.pc
    126125])
  • doc/CMakeLists.txt

    r930 r865  
    44SET(abs_top_builddir ${PROJECT_BINARY_DIR})
    55
    6 SET(LEMON_DOC_SOURCE_BROWSER "NO" CACHE STRING "Include source into the doc (YES/NO).")
    7 
    86CONFIGURE_FILE(
    97  ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in
    108  ${PROJECT_BINARY_DIR}/doc/Doxyfile
    11   @ONLY
    12 )
    13 
    14 CONFIGURE_FILE(
    15   ${PROJECT_SOURCE_DIR}/doc/mainpage.dox.in
    16   ${PROJECT_BINARY_DIR}/doc/mainpage.dox
    179  @ONLY
    1810)
     
    6153
    6254ENDIF()
    63 
    64 IF(WGET_FOUND)
    65 ADD_CUSTOM_TARGET(update-external-tags
    66   COMMAND ${CMAKE_COMMAND} -E make_directory dl
    67   # COMMAND ${CMAKE_COMMAND} -E copy libstdc++.tag dl
    68   COMMAND ${WGET_EXECUTABLE} wget -P dl -N libstdc++.tag.tmp http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/libstdc++.tag
    69   COMMAND ${CMAKE_COMMAND} -E rename dl/libstdc++.tag libstdc++.tag
    70   COMMAND ${CMAKE_COMMAND} -E remove dl/libstdc++.tag
    71   COMMAND ${CMAKE_COMMAND} -E remove_directory dl
    72   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    73   )
    74 ENDIF()
  • doc/Doxyfile.in

    r930 r756  
    1 # Doxyfile 1.7.3
     1# Doxyfile 1.5.9
    22
    33#---------------------------------------------------------------------------
     
    55#---------------------------------------------------------------------------
    66DOXYFILE_ENCODING      = UTF-8
    7 PROJECT_NAME           =
    8 PROJECT_NUMBER         =
    9 PROJECT_BRIEF          =
    10 PROJECT_LOGO           =
     7PROJECT_NAME           = @PACKAGE_NAME@
     8PROJECT_NUMBER         = @PACKAGE_VERSION@
    119OUTPUT_DIRECTORY       =
    1210CREATE_SUBDIRS         = NO
     
    3230OPTIMIZE_FOR_FORTRAN   = NO
    3331OPTIMIZE_OUTPUT_VHDL   = NO
    34 EXTENSION_MAPPING      =
    3532BUILTIN_STL_SUPPORT    = YES
    3633CPP_CLI_SUPPORT        = NO
     
    5855HIDE_SCOPE_NAMES       = YES
    5956SHOW_INCLUDE_FILES     = YES
    60 FORCE_LOCAL_INCLUDES   = NO
    6157INLINE_INFO            = YES
    6258SORT_MEMBER_DOCS       = NO
    6359SORT_BRIEF_DOCS        = NO
    64 SORT_MEMBERS_CTORS_1ST = NO
    6560SORT_GROUP_NAMES       = NO
    6661SORT_BY_SCOPE_NAME     = NO
    67 STRICT_PROTO_MATCHING  = NO
    6862GENERATE_TODOLIST      = YES
    6963GENERATE_TESTLIST      = YES
     
    7771SHOW_NAMESPACES        = YES
    7872FILE_VERSION_FILTER    =
    79 LAYOUT_FILE            = "@abs_top_srcdir@/doc/DoxygenLayout.xml"
     73LAYOUT_FILE            = DoxygenLayout.xml
    8074#---------------------------------------------------------------------------
    8175# configuration options related to warning and progress messages
     
    9690                         "@abs_top_srcdir@/lemon/concepts" \
    9791                         "@abs_top_srcdir@/demo" \
    98                          "@abs_top_srcdir@/contrib" \
    9992                         "@abs_top_srcdir@/tools" \
    10093                         "@abs_top_srcdir@/test/test_tools.h" \
    101                          "@abs_top_builddir@/doc/mainpage.dox" \
    10294                         "@abs_top_builddir@/doc/references.dox"
    10395INPUT_ENCODING         = UTF-8
     
    120112FILTER_PATTERNS        =
    121113FILTER_SOURCE_FILES    = NO
    122 FILTER_SOURCE_PATTERNS =
    123114#---------------------------------------------------------------------------
    124115# configuration options related to source browsing
    125116#---------------------------------------------------------------------------
    126 SOURCE_BROWSER         = @LEMON_DOC_SOURCE_BROWSER@
     117SOURCE_BROWSER         = NO
    127118INLINE_SOURCES         = NO
    128119STRIP_CODE_COMMENTS    = YES
     
    147138HTML_FOOTER            =
    148139HTML_STYLESHEET        =
    149 HTML_COLORSTYLE_HUE    = 220
    150 HTML_COLORSTYLE_SAT    = 100
    151 HTML_COLORSTYLE_GAMMA  = 80
    152 HTML_TIMESTAMP         = YES
    153140HTML_ALIGN_MEMBERS     = YES
    154 HTML_DYNAMIC_SECTIONS  = YES
     141HTML_DYNAMIC_SECTIONS  = NO
    155142GENERATE_DOCSET        = NO
    156143DOCSET_FEEDNAME        = "Doxygen generated docs"
    157144DOCSET_BUNDLE_ID       = org.doxygen.Project
    158 DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
    159 DOCSET_PUBLISHER_NAME  = Publisher
    160145GENERATE_HTMLHELP      = NO
    161146CHM_FILE               =
     
    169154QHP_NAMESPACE          = org.doxygen.Project
    170155QHP_VIRTUAL_FOLDER     = doc
    171 QHP_CUST_FILTER_NAME   =
    172 QHP_CUST_FILTER_ATTRS  =
    173 QHP_SECT_FILTER_ATTRS  =
    174156QHG_LOCATION           =
    175 GENERATE_ECLIPSEHELP   = NO
    176 ECLIPSE_DOC_ID         = org.doxygen.Project
    177157DISABLE_INDEX          = NO
    178158ENUM_VALUES_PER_LINE   = 4
    179159GENERATE_TREEVIEW      = NO
    180 USE_INLINE_TREES       = NO
    181160TREEVIEW_WIDTH         = 250
    182 EXT_LINKS_IN_WINDOW    = NO
    183161FORMULA_FONTSIZE       = 10
    184 FORMULA_TRANSPARENT    = YES
    185 USE_MATHJAX            = NO
    186 MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
    187 SEARCHENGINE           = YES
    188 SERVER_BASED_SEARCH    = NO
    189162#---------------------------------------------------------------------------
    190163# configuration options related to the LaTeX output
     
    203176LATEX_BATCHMODE        = NO
    204177LATEX_HIDE_INDICES     = NO
    205 LATEX_SOURCE_CODE      = NO
    206178#---------------------------------------------------------------------------
    207179# configuration options related to the RTF output
     
    252224SKIP_FUNCTION_MACROS   = YES
    253225#---------------------------------------------------------------------------
    254 # Configuration::additions related to external references
    255 #---------------------------------------------------------------------------
    256 TAGFILES               = "@abs_top_builddir@/doc/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/  "
     226# Options related to the search engine   
     227#---------------------------------------------------------------------------
     228TAGFILES               = "@abs_top_srcdir@/doc/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/  "
    257229GENERATE_TAGFILE       = html/lemon.tag
    258230ALLEXTERNALS           = NO
     
    266238HIDE_UNDOC_RELATIONS   = YES
    267239HAVE_DOT               = YES
    268 DOT_NUM_THREADS        = 0
    269240DOT_FONTNAME           = FreeSans
    270241DOT_FONTSIZE           = 10
     
    284255DOT_PATH               =
    285256DOTFILE_DIRS           =
    286 MSCFILE_DIRS           =
    287257DOT_GRAPH_MAX_NODES    = 50
    288258MAX_DOT_GRAPH_DEPTH    = 0
     
    291261GENERATE_LEGEND        = YES
    292262DOT_CLEANUP            = YES
     263#---------------------------------------------------------------------------
     264# Configuration::additions related to the search engine   
     265#---------------------------------------------------------------------------
     266SEARCHENGINE           = NO
  • doc/DoxygenLayout.xml

    r928 r316  
    33  <navindex>
    44    <tab type="mainpage" visible="yes" title=""/>
    5     <tab type="modules" visible="yes" title="" intro=""/>
     5    <tab type="modules" visible="yes" title=""/>
    66    <tab type="classes" visible="yes" title="">
    7       <tab type="classes" visible="yes" title="" intro=""/>
    8       <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
    9       <tab type="hierarchy" visible="yes" title="" intro=""/>
    10       <tab type="classmembers" visible="yes" title="" intro=""/>
     7      <tab type="classes" visible="yes" title=""/>
     8      <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/> 
     9      <tab type="hierarchy" visible="yes" title=""/>
     10      <tab type="classmembers" visible="yes" title=""/>
    1111    </tab>
    1212    <tab type="namespaces" visible="yes" title="">
    13       <tab type="namespaces" visible="yes" title="" intro=""/>
    14       <tab type="namespacemembers" visible="yes" title="" intro=""/>
     13      <tab type="namespaces" visible="yes" title=""/>
     14      <tab type="namespacemembers" visible="yes" title=""/>
    1515    </tab>
    1616    <tab type="files" visible="yes" title="">
    17       <tab type="files" visible="yes" title="" intro=""/>
    18       <tab type="globals" visible="yes" title="" intro=""/>
     17      <tab type="files" visible="yes" title=""/>
     18      <tab type="globals" visible="yes" title=""/>
    1919    </tab>
    20     <tab type="dirs" visible="yes" title="" intro=""/>
    21     <tab type="examples" visible="yes" title="" intro=""/>
    22     <tab type="pages" visible="yes" title="" intro=""/>
     20    <tab type="dirs" visible="yes" title=""/>
     21    <tab type="examples" visible="yes" title=""/> 
     22    <tab type="pages" visible="yes" title=""/>
    2323  </navindex>
    2424
  • doc/coding_style.dox

    r919 r440  
    9999\subsection pri-loc-var Private member variables
    100100
    101 Private member variables should start with underscore.
     101Private member variables should start with underscore
    102102
    103103\code
    104 _start_with_underscore
     104_start_with_underscores
    105105\endcode
    106106
  • doc/dirs.dox

    r925 r440  
    3232documentation.
    3333*/
    34 
    35 /**
    36 \dir contrib
    37 \brief Directory for user contributed source codes.
    38 
    39 You can place your own C++ code using LEMON into this directory, which
    40 will compile to an executable along with LEMON when you build the
    41 library. This is probably the easiest way of compiling short to medium
    42 codes, for this does require neither a LEMON installed system-wide nor
    43 adding several paths to the compiler.
    44 
    45 Please have a look at <tt>contrib/CMakeLists.txt</tt> for
    46 instruction on how to add your own files into the build process.  */
    4734
    4835/**
  • doc/groups.dox

    r919 r877  
    264264
    265265/**
     266@defgroup matrices Matrices
     267@ingroup datas
     268\brief Two dimensional data storages implemented in LEMON.
     269
     270This group contains two dimensional data storages implemented in LEMON.
     271*/
     272
     273/**
    266274@defgroup auxdat Auxiliary Data Structures
    267275@ingroup datas
     
    407415   strongly polynomial \ref klein67primal, \ref goldberg89cyclecanceling.
    408416
    409 In general, \ref NetworkSimplex and \ref CostScaling are the most efficient
    410 implementations, but the other two algorithms could be faster in special cases.
     417In general NetworkSimplex is the most efficient implementation,
     418but in special cases other algorithms could be faster.
    411419For example, if the total supply and/or capacities are rather small,
    412 \ref CapacityScaling is usually the fastest algorithm (without effective scaling).
     420CapacityScaling is usually the fastest algorithm (without effective scaling).
    413421*/
    414422
     
    465473
    466474LEMON contains three algorithms for solving the minimum mean cycle problem:
    467 - \ref KarpMmc Karp's original algorithm \ref amo93networkflows,
     475- \ref Karp "Karp"'s original algorithm \ref amo93networkflows,
    468476  \ref dasdan98minmeancycle.
    469 - \ref HartmannOrlinMmc Hartmann-Orlin's algorithm, which is an improved
     477- \ref HartmannOrlin "Hartmann-Orlin"'s algorithm, which is an improved
    470478  version of Karp's algorithm \ref dasdan98minmeancycle.
    471 - \ref HowardMmc Howard's policy iteration algorithm
     479- \ref Howard "Howard"'s policy iteration algorithm
    472480  \ref dasdan98minmeancycle.
    473481
    474 In practice, the \ref HowardMmc "Howard" algorithm turned out to be by far the
    475 most efficient one, though the best known theoretical bound on its running
    476 time is exponential.
    477 Both \ref KarpMmc "Karp" and \ref HartmannOrlinMmc "Hartmann-Orlin" algorithms
    478 run in time O(ne) and use space O(n<sup>2</sup>+e), but the latter one is
    479 typically faster due to the applied early termination scheme.
     482In practice, the Howard algorithm proved to be by far the most efficient
     483one, though the best known theoretical bound on its running time is
     484exponential.
     485Both Karp and HartmannOrlin algorithms run in time O(ne) and use space
     486O(n<sup>2</sup>+e), but the latter one is typically faster due to the
     487applied early termination scheme.
    480488*/
    481489
     
    540548
    541549/**
    542 @defgroup planar Planar Embedding and Drawing
     550@defgroup planar Planarity Embedding and Drawing
    543551@ingroup algs
    544552\brief Algorithms for planarity checking, embedding and drawing
     
    552560
    553561/**
    554 @defgroup approx_algs Approximation Algorithms
     562@defgroup approx Approximation Algorithms
    555563@ingroup algs
    556564\brief Approximation algorithms.
     
    558566This group contains the approximation and heuristic algorithms
    559567implemented in LEMON.
    560 
    561 <b>Maximum Clique Problem</b>
    562   - \ref GrossoLocatelliPullanMc An efficient heuristic algorithm of
    563     Grosso, Locatelli, and Pullan.
    564568*/
    565569
  • doc/references.bib

    r904 r755  
    298298  address =      {Dublin, Ireland},
    299299  year =         1991,
    300   month =        sep
    301 }
    302 
    303 %%%%% Other algorithms %%%%%
    304 
    305 @article{grosso08maxclique,
    306   author =       {Andrea Grosso and Marco Locatelli and Wayne Pullan},
    307   title =        {Simple ingredients leading to very efficient
    308                   heuristics for the maximum clique problem},
    309   journal =      {Journal of Heuristics},
    310   year =         2008,
    311   volume =       14,
    312   number =       6,
    313   pages =        {587--612}
    314 }
     300  month =        sep,
     301}
  • lemon/CMakeLists.txt

    r908 r679  
    77  ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
    88  ${CMAKE_CURRENT_BINARY_DIR}/config.h
    9 )
    10 
    11 CONFIGURE_FILE(
    12   ${CMAKE_CURRENT_SOURCE_DIR}/lemon.pc.cmake
    13   ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc
    14   @ONLY
    159)
    1610
     
    7367  COMPONENT headers
    7468)
    75 
    76 INSTALL(
    77   FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc
    78   DESTINATION lib/pkgconfig
    79 )
    80 
  • lemon/Makefile.am

    r917 r874  
    9191        lemon/graph_to_eps.h \
    9292        lemon/grid_graph.h \
    93         lemon/grosso_locatelli_pullan_mc.h \
    9493        lemon/hartmann_orlin_mmc.h \
    9594        lemon/howard_mmc.h \
     
    108107        lemon/math.h \
    109108        lemon/min_cost_arborescence.h \
    110         lemon/max_cardinality_search.h \
    111         lemon/nagamochi_ibaraki.h \
    112109        lemon/nauty_reader.h \
    113110        lemon/network_simplex.h \
  • lemon/arg_parser.h

    r879 r877  
    3636
    3737  ///Exception used by ArgParser
    38 
    39   ///Exception used by ArgParser.
    40   ///
    4138  class ArgParserException : public Exception {
    4239  public:
    43     /// Reasons for failure
    44 
    45     /// Reasons for failure.
    46     ///
    4740    enum Reason {
    48       HELP,         ///< <tt>--help</tt> option was given.
    49       UNKNOWN_OPT,  ///< Unknown option was given.
    50       INVALID_OPT   ///< Invalid combination of options.
     41      HELP,         /// <tt>--help</tt> option was given
     42      UNKNOWN_OPT,  /// Unknown option was given
     43      INVALID_OPT   /// Invalid combination of options
    5144    };
    5245
  • lemon/bellman_ford.h

    r880 r877  
    2929#include <lemon/error.h>
    3030#include <lemon/maps.h>
     31#include <lemon/tolerance.h>
    3132#include <lemon/path.h>
    3233
     
    3536namespace lemon {
    3637
    37   /// \brief Default OperationTraits for the BellmanFord algorithm class.
     38  /// \brief Default operation traits for the BellmanFord algorithm class.
    3839  ///
    3940  /// This operation traits class defines all computational operations
     
    4243  /// If the numeric type does not have infinity value, then the maximum
    4344  /// value is used as extremal infinity value.
     45  ///
     46  /// \see BellmanFordToleranceOperationTraits
    4447  template <
    4548    typename V,
    4649    bool has_inf = std::numeric_limits<V>::has_infinity>
    4750  struct BellmanFordDefaultOperationTraits {
    48     /// \e
     51    /// \brief Value type for the algorithm.
    4952    typedef V Value;
    5053    /// \brief Gives back the zero value of the type.
     
    8285    static bool less(const Value& left, const Value& right) {
    8386      return left < right;
     87    }
     88  };
     89
     90  /// \brief Operation traits for the BellmanFord algorithm class
     91  /// using tolerance.
     92  ///
     93  /// This operation traits class defines all computational operations
     94  /// and constants that are used in the Bellman-Ford algorithm.
     95  /// The only difference between this implementation and
     96  /// \ref BellmanFordDefaultOperationTraits is that this class uses
     97  /// the \ref Tolerance "tolerance technique" in its \ref less()
     98  /// function.
     99  ///
     100  /// \tparam V The value type.
     101  /// \tparam eps The epsilon value for the \ref less() function.
     102  /// By default, it is the epsilon value used by \ref Tolerance
     103  /// "Tolerance<V>".
     104  ///
     105  /// \see BellmanFordDefaultOperationTraits
     106#ifdef DOXYGEN
     107  template <typename V, V eps>
     108#else
     109  template <
     110    typename V,
     111    V eps = Tolerance<V>::def_epsilon>
     112#endif
     113  struct BellmanFordToleranceOperationTraits {
     114    /// \brief Value type for the algorithm.
     115    typedef V Value;
     116    /// \brief Gives back the zero value of the type.
     117    static Value zero() {
     118      return static_cast<Value>(0);
     119    }
     120    /// \brief Gives back the positive infinity value of the type.
     121    static Value infinity() {
     122      return std::numeric_limits<Value>::infinity();
     123    }
     124    /// \brief Gives back the sum of the given two elements.
     125    static Value plus(const Value& left, const Value& right) {
     126      return left + right;
     127    }
     128    /// \brief Gives back \c true only if the first value is less than
     129    /// the second.
     130    static bool less(const Value& left, const Value& right) {
     131      return left + eps < right;
    84132    }
    85133  };
     
    108156    /// It defines the used operations and the infinity value for the
    109157    /// given \c Value type.
    110     /// \see BellmanFordDefaultOperationTraits
     158    /// \see BellmanFordDefaultOperationTraits,
     159    /// BellmanFordToleranceOperationTraits
    111160    typedef BellmanFordDefaultOperationTraits<Value> OperationTraits;
    112161
     
    838887    /// It defines the used operations and the infinity value for the
    839888    /// given \c Value type.
    840     /// \see BellmanFordDefaultOperationTraits
     889    /// \see BellmanFordDefaultOperationTraits,
     890    /// BellmanFordToleranceOperationTraits
    841891    typedef BellmanFordDefaultOperationTraits<Value> OperationTraits;
    842892
  • lemon/bits/edge_set_extender.h

    r884 r877  
    281281    typedef EdgeSetExtender Graph;
    282282
    283     typedef True UndirectedTag;
    284 
    285283    typedef typename Parent::Node Node;
    286284    typedef typename Parent::Arc Arc;
  • lemon/bits/graph_adaptor_extender.h

    r882 r617  
    182182    typedef GraphAdaptorExtender Adaptor;
    183183
    184     typedef True UndirectedTag;
    185 
    186184    typedef typename Parent::Node Node;
    187185    typedef typename Parent::Arc Arc;
  • lemon/bits/path_dump.h

    r887 r529  
    5050
    5151    bool empty() const {
    52       return predMap[target] == INVALID;
     52      return predMap[target] != INVALID;
    5353    }
    5454
     
    124124
    125125    bool empty() const {
    126       return predMatrixMap(source, target) == INVALID;
     126      return source != target;
    127127    }
    128128
  • lemon/capacity_scaling.h

    r922 r877  
    8787  /// consider to use the named template parameters instead.
    8888  ///
    89   /// \warning Both \c V and \c C must be signed number types.
    90   /// \warning All input data (capacities, supply values, and costs) must
     89  /// \warning Both number types must be signed and all input data must
    9190  /// be integer.
    92   /// \warning This algorithm does not support negative costs for
    93   /// arcs having infinite upper bound.
     91  /// \warning This algorithm does not support negative costs for such
     92  /// arcs that have infinite upper bound.
    9493#ifdef DOXYGEN
    9594  template <typename GR, typename V, typename C, typename TR>
     
    424423    ///
    425424    /// Using this function has the same effect as using \ref supplyMap()
    426     /// with a map in which \c k is assigned to \c s, \c -k is
     425    /// with such a map in which \c k is assigned to \c s, \c -k is
    427426    /// assigned to \c t and all other nodes have zero supply value.
    428427    ///
  • lemon/core.h

    r919 r877  
    395395      static void copy(const From& from, Digraph &to,
    396396                       NodeRefMap& nodeRefMap, ArcRefMap& arcRefMap) {
    397         to.clear();
    398397        for (typename From::NodeIt it(from); it != INVALID; ++it) {
    399398          nodeRefMap[it] = to.addNode();
     
    423422      static void copy(const From& from, Graph &to,
    424423                       NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
    425         to.clear();
    426424        for (typename From::NodeIt it(from); it != INVALID; ++it) {
    427425          nodeRefMap[it] = to.addNode();
     
    447445
    448446  }
    449 
    450   /// \brief Check whether a graph is undirected.
    451   ///
    452   /// This function returns \c true if the given graph is undirected.
    453 #ifdef DOXYGEN
    454   template <typename GR>
    455   bool undirected(const GR& g) { return false; }
    456 #else
    457   template <typename GR>
    458   typename enable_if<UndirectedTagIndicator<GR>, bool>::type
    459   undirected(const GR&) {
    460     return true;
    461   }
    462   template <typename GR>
    463   typename disable_if<UndirectedTagIndicator<GR>, bool>::type
    464   undirected(const GR&) {
    465     return false;
    466   }
    467 #endif
    468447
    469448  /// \brief Class to copy a digraph.
  • lemon/cost_scaling.h

    r932 r931  
    9898  /// "preflow push-relabel" algorithm for the maximum flow problem.
    9999  ///
    100   /// In general, \ref NetworkSimplex and \ref CostScaling are the fastest
    101   /// implementations available in LEMON for this problem.
    102   ///
    103100  /// Most of the parameters of the problem (except for the digraph)
    104101  /// can be given using separate functions, and the algorithm can be
     
    117114  /// consider to use the named template parameters instead.
    118115  ///
    119   /// \warning Both \c V and \c C must be signed number types.
    120   /// \warning All input data (capacities, supply values, and costs) must
     116  /// \warning Both number types must be signed and all input data must
    121117  /// be integer.
    122   /// \warning This algorithm does not support negative costs for
    123   /// arcs having infinite upper bound.
     118  /// \warning This algorithm does not support negative costs for such
     119  /// arcs that have infinite upper bound.
    124120  ///
    125121  /// \note %CostScaling provides three different internal methods,
     
    183179    /// relabel operation.
    184180    /// By default, the so called \ref PARTIAL_AUGMENT
    185     /// "Partial Augment-Relabel" method is used, which turned out to be
     181    /// "Partial Augment-Relabel" method is used, which proved to be
    186182    /// the most efficient and the most robust on various test inputs.
    187183    /// However, the other methods can be selected using the \ref run()
     
    452448    ///
    453449    /// Using this function has the same effect as using \ref supplyMap()
    454     /// with a map in which \c k is assigned to \c s, \c -k is
     450    /// with such a map in which \c k is assigned to \c s, \c -k is
    455451    /// assigned to \c t and all other nodes have zero supply value.
    456452    ///
  • lemon/cycle_canceling.h

    r922 r877  
    6666  /// algorithm. By default, it is the same as \c V.
    6767  ///
    68   /// \warning Both \c V and \c C must be signed number types.
    69   /// \warning All input data (capacities, supply values, and costs) must
     68  /// \warning Both number types must be signed and all input data must
    7069  /// be integer.
    71   /// \warning This algorithm does not support negative costs for
    72   /// arcs having infinite upper bound.
     70  /// \warning This algorithm does not support negative costs for such
     71  /// arcs that have infinite upper bound.
    7372  ///
    7473  /// \note For more information about the three available methods,
     
    118117    /// \ref CycleCanceling provides three different cycle-canceling
    119118    /// methods. By default, \ref CANCEL_AND_TIGHTEN "Cancel and Tighten"
    120     /// is used, which is by far the most efficient and the most robust.
     119    /// is used, which proved to be the most efficient and the most robust
     120    /// on various test inputs.
    121121    /// However, the other methods can be selected using the \ref run()
    122122    /// function with the proper parameter.
     
    350350    ///
    351351    /// Using this function has the same effect as using \ref supplyMap()
    352     /// with a map in which \c k is assigned to \c s, \c -k is
     352    /// with such a map in which \c k is assigned to \c s, \c -k is
    353353    /// assigned to \c t and all other nodes have zero supply value.
    354354    ///
  • lemon/dfs.h

    r907 r877  
    566566    void start(Node t)
    567567    {
    568       while ( !emptyQueue() && !(*_reached)[t] )
     568      while ( !emptyQueue() && G->target(_stack[_stack_head])!=t )
    569569        processNextArc();
    570570    }
     
    15131513    /// with addSource() before using this function.
    15141514    void start(Node t) {
    1515       while ( !emptyQueue() && !(*_reached)[t] )
     1515      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t )
    15161516        processNextArc();
    15171517    }
  • lemon/euler.h

    r919 r877  
    3737  ///Euler tour iterator for digraphs.
    3838
    39   /// \ingroup graph_properties
     39  /// \ingroup graph_prop
    4040  ///This iterator provides an Euler tour (Eulerian circuit) of a \e directed
    4141  ///graph (if there exists) and it converts to the \c Arc type of the digraph.
  • lemon/hao_orlin.h

    r915 r877  
    5454  /// preflow push-relabel algorithm. Our implementation calculates
    5555  /// the minimum cut in \f$ O(n^2\sqrt{m}) \f$ time (we use the
    56   /// highest-label rule), or in \f$O(nm)\f$ for unit capacities. A notable
    57   /// use of this algorithm is testing network reliability.
     56  /// highest-label rule), or in \f$O(nm)\f$ for unit capacities. The
     57  /// purpose of such algorithm is e.g. testing network reliability.
    5858  ///
    5959  /// For an undirected graph you can run just the first phase of the
     
    913913    /// source-side (i.e. a set \f$ X\subsetneq V \f$ with
    914914    /// \f$ source \in X \f$ and minimal outgoing capacity).
    915     /// It updates the stored cut if (and only if) the newly found one
    916     /// is better.
    917915    ///
    918916    /// \pre \ref init() must be called before using this function.
     
    927925    /// sink-side (i.e. a set \f$ X\subsetneq V \f$ with
    928926    /// \f$ source \notin X \f$ and minimal outgoing capacity).
    929     /// It updates the stored cut if (and only if) the newly found one
    930     /// is better.
    931927    ///
    932928    /// \pre \ref init() must be called before using this function.
     
    938934    /// \brief Run the algorithm.
    939935    ///
    940     /// This function runs the algorithm. It chooses source node,
    941     /// then calls \ref init(), \ref calculateOut()
     936    /// This function runs the algorithm. It finds nodes \c source and
     937    /// \c target arbitrarily and then calls \ref init(), \ref calculateOut()
    942938    /// and \ref calculateIn().
    943939    void run() {
     
    949945    /// \brief Run the algorithm.
    950946    ///
    951     /// This function runs the algorithm. It calls \ref init(),
    952     /// \ref calculateOut() and \ref calculateIn() with the given
    953     /// source node.
     947    /// This function runs the algorithm. It uses the given \c source node,
     948    /// finds a proper \c target node and then calls the \ref init(),
     949    /// \ref calculateOut() and \ref calculateIn().
    954950    void run(const Node& s) {
    955951      init(s);
     
    970966    /// \brief Return the value of the minimum cut.
    971967    ///
    972     /// This function returns the value of the best cut found by the
    973     /// previously called \ref run(), \ref calculateOut() or \ref
    974     /// calculateIn().
     968    /// This function returns the value of the minimum cut.
    975969    ///
    976970    /// \pre \ref run(), \ref calculateOut() or \ref calculateIn()
     
    983977    /// \brief Return a minimum cut.
    984978    ///
    985     /// This function gives the best cut found by the
    986     /// previously called \ref run(), \ref calculateOut() or \ref
    987     /// calculateIn().
    988     ///
    989     /// It sets \c cutMap to the characteristic vector of the found
    990     /// minimum value cut - a non-empty set \f$ X\subsetneq V \f$
    991     /// of minimum outgoing capacity (i.e. \c cutMap will be \c true exactly
     979    /// This function sets \c cutMap to the characteristic vector of a
     980    /// minimum value cut: it will give a non-empty set \f$ X\subsetneq V \f$
     981    /// with minimal outgoing capacity (i.e. \c cutMap will be \c true exactly
    992982    /// for the nodes of \f$ X \f$).
    993983    ///
  • lemon/hartmann_orlin_mmc.h

    r879 r877  
    3939  /// \tparam GR The type of the digraph.
    4040  /// \tparam CM The type of the cost map.
    41   /// It must conform to the \ref concepts::ReadMap "ReadMap" concept.
     41  /// It must conform to the \ref concepts::Rea_data "Rea_data" concept.
    4242#ifdef DOXYGEN
    4343  template <typename GR, typename CM>
     
    100100  /// a directed cycle of minimum mean cost in a digraph
    101101  /// \ref amo93networkflows, \ref dasdan98minmeancycle.
    102   /// It is an improved version of \ref KarpMmc "Karp"'s original algorithm,
     102  /// It is an improved version of \ref Karp "Karp"'s original algorithm,
    103103  /// it applies an efficient early termination scheme.
    104104  /// It runs in time O(ne) and uses space O(n<sup>2</sup>+e).
  • lemon/kruskal.h

    r921 r584  
    3131///\file
    3232///\brief Kruskal's algorithm to compute a minimum cost spanning tree
     33///
     34///Kruskal's algorithm to compute a minimum cost spanning tree.
     35///
    3336
    3437namespace lemon {
  • lemon/network_simplex.h

    r922 r877  
    4848  /// flow problem.
    4949  ///
    50   /// In general, \ref NetworkSimplex and \ref CostScaling are the fastest
    51   /// implementations available in LEMON for this problem.
    52   /// Furthermore, this class supports both directions of the supply/demand
    53   /// inequality constraints. For more information, see \ref SupplyType.
     50  /// In general, %NetworkSimplex is the fastest implementation available
     51  /// in LEMON for this problem.
     52  /// Moreover, it supports both directions of the supply/demand inequality
     53  /// constraints. For more information, see \ref SupplyType.
    5454  ///
    5555  /// Most of the parameters of the problem (except for the digraph)
     
    6464  /// algorithm. By default, it is the same as \c V.
    6565  ///
    66   /// \warning Both \c V and \c C must be signed number types.
    67   /// \warning All input data (capacities, supply values, and costs) must
     66  /// \warning Both number types must be signed and all input data must
    6867  /// be integer.
    6968  ///
     
    127126    /// of the algorithm.
    128127    /// By default, \ref BLOCK_SEARCH "Block Search" is used, which
    129     /// turend out to be the most efficient and the most robust on various
     128    /// proved to be the most efficient and the most robust on various
    130129    /// test inputs.
    131130    /// However, another pivot rule can be selected using the \ref run()
     
    168167    typedef std::vector<Value> ValueVector;
    169168    typedef std::vector<Cost> CostVector;
    170     typedef std::vector<signed char> CharVector;
    171     // Note: vector<signed char> is used instead of vector<ArcState> and
    172     // vector<ArcDirection> for efficiency reasons
     169    typedef std::vector<char> BoolVector;
     170    // Note: vector<char> is used instead of vector<bool> for efficiency reasons
    173171
    174172    // State constants for arcs
     
    179177    };
    180178
    181     // Direction constants for tree arcs
    182     enum ArcDirection {
    183       DIR_DOWN = -1,
    184       DIR_UP   =  1
    185     };
     179    typedef std::vector<signed char> StateVector;
     180    // Note: vector<signed char> is used instead of vector<ArcState> for
     181    // efficiency reasons
    186182
    187183  private:
     
    222218    IntVector _succ_num;
    223219    IntVector _last_succ;
    224     CharVector _pred_dir;
    225     CharVector _state;
    226220    IntVector _dirty_revs;
     221    BoolVector _forward;
     222    StateVector _state;
    227223    int _root;
    228224
    229225    // Temporary data used in the current pivot iteration
    230226    int in_arc, join, u_in, v_in, u_out, v_out;
     227    int first, second, right, last;
     228    int stem, par_stem, new_stem;
    231229    Value delta;
    232230
     
    253251      const IntVector  &_target;
    254252      const CostVector &_cost;
    255       const CharVector &_state;
     253      const StateVector &_state;
    256254      const CostVector &_pi;
    257255      int &_in_arc;
     
    305303      const IntVector  &_target;
    306304      const CostVector &_cost;
    307       const CharVector &_state;
     305      const StateVector &_state;
    308306      const CostVector &_pi;
    309307      int &_in_arc;
     
    344342      const IntVector  &_target;
    345343      const CostVector &_cost;
    346       const CharVector &_state;
     344      const StateVector &_state;
    347345      const CostVector &_pi;
    348346      int &_in_arc;
     
    417415      const IntVector  &_target;
    418416      const CostVector &_cost;
    419       const CharVector &_state;
     417      const StateVector &_state;
    420418      const CostVector &_pi;
    421419      int &_in_arc;
     
    520518      const IntVector  &_target;
    521519      const CostVector &_cost;
    522       const CharVector &_state;
     520      const StateVector &_state;
    523521      const CostVector &_pi;
    524522      int &_in_arc;
     
    573571        // Check the current candidate list
    574572        int e;
    575         Cost c;
    576573        for (int i = 0; i != _curr_length; ++i) {
    577574          e = _candidates[i];
    578           c = _state[e] * (_cost[e] + _pi[_source[e]] - _pi[_target[e]]);
    579           if (c < 0) {
    580             _cand_cost[e] = c;
    581           } else {
     575          _cand_cost[e] = _state[e] *
     576            (_cost[e] + _pi[_source[e]] - _pi[_target[e]]);
     577          if (_cand_cost[e] >= 0) {
    582578            _candidates[i--] = _candidates[--_curr_length];
    583579          }
     
    589585
    590586        for (e = _next_arc; e != _search_arc_num; ++e) {
    591           c = _state[e] * (_cost[e] + _pi[_source[e]] - _pi[_target[e]]);
    592           if (c < 0) {
    593             _cand_cost[e] = c;
     587          _cand_cost[e] = _state[e] *
     588            (_cost[e] + _pi[_source[e]] - _pi[_target[e]]);
     589          if (_cand_cost[e] < 0) {
    594590            _candidates[_curr_length++] = e;
    595591          }
     
    638634    ///
    639635    /// \param graph The digraph the algorithm runs on.
    640     /// \param arc_mixing Indicate if the arcs will be stored in a
     636    /// \param arc_mixing Indicate if the arcs have to be stored in a
    641637    /// mixed order in the internal data structure.
    642     /// In general, it leads to similar performance as using the original
    643     /// arc order, but it makes the algorithm more robust and in special
    644     /// cases, even significantly faster. Therefore, it is enabled by default.
    645     NetworkSimplex(const GR& graph, bool arc_mixing = true) :
     638    /// In special cases, it could lead to better overall performance,
     639    /// but it is usually slower. Therefore it is disabled by default.
     640    NetworkSimplex(const GR& graph, bool arc_mixing = false) :
    646641      _graph(graph), _node_id(graph), _arc_id(graph),
    647642      _arc_mixing(arc_mixing),
     
    736731    ///
    737732    /// \return <tt>(*this)</tt>
    738     ///
    739     /// \sa supplyType()
    740733    template<typename SupplyMap>
    741734    NetworkSimplex& supplyMap(const SupplyMap& map) {
     
    754747    ///
    755748    /// Using this function has the same effect as using \ref supplyMap()
    756     /// with a map in which \c k is assigned to \c s, \c -k is
     749    /// with such a map in which \c k is assigned to \c s, \c -k is
    757750    /// assigned to \c t and all other nodes have zero supply value.
    758751    ///
     
    921914      _parent.resize(all_node_num);
    922915      _pred.resize(all_node_num);
    923       _pred_dir.resize(all_node_num);
     916      _forward.resize(all_node_num);
    924917      _thread.resize(all_node_num);
    925918      _rev_thread.resize(all_node_num);
     
    935928      if (_arc_mixing) {
    936929        // Store the arcs in a mixed order
    937         const int skip = std::max(_arc_num / _node_num, 3);
     930        int k = std::max(int(std::sqrt(double(_arc_num))), 10);
    938931        int i = 0, j = 0;
    939932        for (ArcIt a(_graph); a != INVALID; ++a) {
     
    941934          _source[i] = _node_id[_graph.source(a)];
    942935          _target[i] = _node_id[_graph.target(a)];
    943           if ((i += skip) >= _arc_num) i = ++j;
     936          if ((i += k) >= _arc_num) i = ++j;
    944937        }
    945938      } else {
     
    10851078        ART_COST = std::numeric_limits<Cost>::max() / 2 + 1;
    10861079      } else {
    1087         ART_COST = 0;
     1080        ART_COST = std::numeric_limits<Cost>::min();
    10881081        for (int i = 0; i != _arc_num; ++i) {
    10891082          if (_cost[i] > ART_COST) ART_COST = _cost[i];
     
    11241117          _state[e] = STATE_TREE;
    11251118          if (_supply[u] >= 0) {
    1126             _pred_dir[u] = DIR_UP;
     1119            _forward[u] = true;
    11271120            _pi[u] = 0;
    11281121            _source[e] = u;
     
    11311124            _cost[e] = 0;
    11321125          } else {
    1133             _pred_dir[u] = DIR_DOWN;
     1126            _forward[u] = false;
    11341127            _pi[u] = ART_COST;
    11351128            _source[e] = _root;
     
    11511144          _last_succ[u] = u;
    11521145          if (_supply[u] >= 0) {
    1153             _pred_dir[u] = DIR_UP;
     1146            _forward[u] = true;
    11541147            _pi[u] = 0;
    11551148            _pred[u] = e;
     
    11611154            _state[e] = STATE_TREE;
    11621155          } else {
    1163             _pred_dir[u] = DIR_DOWN;
     1156            _forward[u] = false;
    11641157            _pi[u] = ART_COST;
    11651158            _pred[u] = f;
     
    11921185          _last_succ[u] = u;
    11931186          if (_supply[u] <= 0) {
    1194             _pred_dir[u] = DIR_DOWN;
     1187            _forward[u] = false;
    11951188            _pi[u] = 0;
    11961189            _pred[u] = e;
     
    12021195            _state[e] = STATE_TREE;
    12031196          } else {
    1204             _pred_dir[u] = DIR_UP;
     1197            _forward[u] = true;
    12051198            _pi[u] = -ART_COST;
    12061199            _pred[u] = f;
     
    12451238      // Initialize first and second nodes according to the direction
    12461239      // of the cycle
    1247       int first, second;
    12481240      if (_state[in_arc] == STATE_LOWER) {
    12491241        first  = _source[in_arc];
     
    12551247      delta = _cap[in_arc];
    12561248      int result = 0;
    1257       Value c, d;
     1249      Value d;
    12581250      int e;
    12591251
    1260       // Search the cycle form the first node to the join node
     1252      // Search the cycle along the path form the first node to the root
    12611253      for (int u = first; u != join; u = _parent[u]) {
    12621254        e = _pred[u];
    1263         d = _flow[e];
    1264         if (_pred_dir[u] == DIR_DOWN) {
    1265           c = _cap[e];
    1266           d = c >= MAX ? INF : c - d;
    1267         }
     1255        d = _forward[u] ?
     1256          _flow[e] : (_cap[e] >= MAX ? INF : _cap[e] - _flow[e]);
    12681257        if (d < delta) {
    12691258          delta = d;
     
    12721261        }
    12731262      }
    1274 
    1275       // Search the cycle form the second node to the join node
     1263      // Search the cycle along the path form the second node to the root
    12761264      for (int u = second; u != join; u = _parent[u]) {
    12771265        e = _pred[u];
    1278         d = _flow[e];
    1279         if (_pred_dir[u] == DIR_UP) {
    1280           c = _cap[e];
    1281           d = c >= MAX ? INF : c - d;
    1282         }
     1266        d = _forward[u] ?
     1267          (_cap[e] >= MAX ? INF : _cap[e] - _flow[e]) : _flow[e];
    12831268        if (d <= delta) {
    12841269          delta = d;
     
    13051290        _flow[in_arc] += val;
    13061291        for (int u = _source[in_arc]; u != join; u = _parent[u]) {
    1307           _flow[_pred[u]] -= _pred_dir[u] * val;
     1292          _flow[_pred[u]] += _forward[u] ? -val : val;
    13081293        }
    13091294        for (int u = _target[in_arc]; u != join; u = _parent[u]) {
    1310           _flow[_pred[u]] += _pred_dir[u] * val;
     1295          _flow[_pred[u]] += _forward[u] ? val : -val;
    13111296        }
    13121297      }
     
    13231308    // Update the tree structure
    13241309    void updateTreeStructure() {
     1310      int u, w;
    13251311      int old_rev_thread = _rev_thread[u_out];
    13261312      int old_succ_num = _succ_num[u_out];
     
    13281314      v_out = _parent[u_out];
    13291315
    1330       // Check if u_in and u_out coincide
    1331       if (u_in == u_out) {
    1332         // Update _parent, _pred, _pred_dir
    1333         _parent[u_in] = v_in;
    1334         _pred[u_in] = in_arc;
    1335         _pred_dir[u_in] = u_in == _source[in_arc] ? DIR_UP : DIR_DOWN;
    1336 
    1337         // Update _thread and _rev_thread
    1338         if (_thread[v_in] != u_out) {
    1339           int after = _thread[old_last_succ];
    1340           _thread[old_rev_thread] = after;
    1341           _rev_thread[after] = old_rev_thread;
    1342           after = _thread[v_in];
    1343           _thread[v_in] = u_out;
    1344           _rev_thread[u_out] = v_in;
    1345           _thread[old_last_succ] = after;
    1346           _rev_thread[after] = old_last_succ;
    1347         }
     1316      u = _last_succ[u_in];  // the last successor of u_in
     1317      right = _thread[u];    // the node after it
     1318
     1319      // Handle the case when old_rev_thread equals to v_in
     1320      // (it also means that join and v_out coincide)
     1321      if (old_rev_thread == v_in) {
     1322        last = _thread[_last_succ[u_out]];
    13481323      } else {
    1349         // Handle the case when old_rev_thread equals to v_in
    1350         // (it also means that join and v_out coincide)
    1351         int thread_continue = old_rev_thread == v_in ?
    1352           _thread[old_last_succ] : _thread[v_in];
    1353 
    1354         // Update _thread and _parent along the stem nodes (i.e. the nodes
    1355         // between u_in and u_out, whose parent have to be changed)
    1356         int stem = u_in;              // the current stem node
    1357         int par_stem = v_in;          // the new parent of stem
    1358         int next_stem;                // the next stem node
    1359         int last = _last_succ[u_in];  // the last successor of stem
    1360         int before, after = _thread[last];
    1361         _thread[v_in] = u_in;
    1362         _dirty_revs.clear();
    1363         _dirty_revs.push_back(v_in);
    1364         while (stem != u_out) {
    1365           // Insert the next stem node into the thread list
    1366           next_stem = _parent[stem];
    1367           _thread[last] = next_stem;
    1368           _dirty_revs.push_back(last);
    1369 
    1370           // Remove the subtree of stem from the thread list
    1371           before = _rev_thread[stem];
    1372           _thread[before] = after;
    1373           _rev_thread[after] = before;
    1374 
    1375           // Change the parent node and shift stem nodes
    1376           _parent[stem] = par_stem;
    1377           par_stem = stem;
    1378           stem = next_stem;
    1379 
    1380           // Update last and after
    1381           last = _last_succ[stem] == _last_succ[par_stem] ?
    1382             _rev_thread[par_stem] : _last_succ[stem];
    1383           after = _thread[last];
    1384         }
    1385         _parent[u_out] = par_stem;
    1386         _thread[last] = thread_continue;
    1387         _rev_thread[thread_continue] = last;
    1388         _last_succ[u_out] = last;
    1389 
    1390         // Remove the subtree of u_out from the thread list except for
    1391         // the case when old_rev_thread equals to v_in
    1392         if (old_rev_thread != v_in) {
    1393           _thread[old_rev_thread] = after;
    1394           _rev_thread[after] = old_rev_thread;
    1395         }
    1396 
    1397         // Update _rev_thread using the new _thread values
    1398         for (int i = 0; i != int(_dirty_revs.size()); ++i) {
    1399           int u = _dirty_revs[i];
    1400           _rev_thread[_thread[u]] = u;
    1401         }
    1402 
    1403         // Update _pred, _pred_dir, _last_succ and _succ_num for the
    1404         // stem nodes from u_out to u_in
    1405         int tmp_sc = 0, tmp_ls = _last_succ[u_out];
    1406         for (int u = u_out, p = _parent[u]; u != u_in; u = p, p = _parent[u]) {
    1407           _pred[u] = _pred[p];
    1408           _pred_dir[u] = -_pred_dir[p];
    1409           tmp_sc += _succ_num[u] - _succ_num[p];
    1410           _succ_num[u] = tmp_sc;
    1411           _last_succ[p] = tmp_ls;
    1412         }
    1413         _pred[u_in] = in_arc;
    1414         _pred_dir[u_in] = u_in == _source[in_arc] ? DIR_UP : DIR_DOWN;
    1415         _succ_num[u_in] = old_succ_num;
     1324        last = _thread[v_in];
     1325      }
     1326
     1327      // Update _thread and _parent along the stem nodes (i.e. the nodes
     1328      // between u_in and u_out, whose parent have to be changed)
     1329      _thread[v_in] = stem = u_in;
     1330      _dirty_revs.clear();
     1331      _dirty_revs.push_back(v_in);
     1332      par_stem = v_in;
     1333      while (stem != u_out) {
     1334        // Insert the next stem node into the thread list
     1335        new_stem = _parent[stem];
     1336        _thread[u] = new_stem;
     1337        _dirty_revs.push_back(u);
     1338
     1339        // Remove the subtree of stem from the thread list
     1340        w = _rev_thread[stem];
     1341        _thread[w] = right;
     1342        _rev_thread[right] = w;
     1343
     1344        // Change the parent node and shift stem nodes
     1345        _parent[stem] = par_stem;
     1346        par_stem = stem;
     1347        stem = new_stem;
     1348
     1349        // Update u and right
     1350        u = _last_succ[stem] == _last_succ[par_stem] ?
     1351          _rev_thread[par_stem] : _last_succ[stem];
     1352        right = _thread[u];
     1353      }
     1354      _parent[u_out] = par_stem;
     1355      _thread[u] = last;
     1356      _rev_thread[last] = u;
     1357      _last_succ[u_out] = u;
     1358
     1359      // Remove the subtree of u_out from the thread list except for
     1360      // the case when old_rev_thread equals to v_in
     1361      // (it also means that join and v_out coincide)
     1362      if (old_rev_thread != v_in) {
     1363        _thread[old_rev_thread] = right;
     1364        _rev_thread[right] = old_rev_thread;
     1365      }
     1366
     1367      // Update _rev_thread using the new _thread values
     1368      for (int i = 0; i != int(_dirty_revs.size()); ++i) {
     1369        u = _dirty_revs[i];
     1370        _rev_thread[_thread[u]] = u;
     1371      }
     1372
     1373      // Update _pred, _forward, _last_succ and _succ_num for the
     1374      // stem nodes from u_out to u_in
     1375      int tmp_sc = 0, tmp_ls = _last_succ[u_out];
     1376      u = u_out;
     1377      while (u != u_in) {
     1378        w = _parent[u];
     1379        _pred[u] = _pred[w];
     1380        _forward[u] = !_forward[w];
     1381        tmp_sc += _succ_num[u] - _succ_num[w];
     1382        _succ_num[u] = tmp_sc;
     1383        _last_succ[w] = tmp_ls;
     1384        u = w;
     1385      }
     1386      _pred[u_in] = in_arc;
     1387      _forward[u_in] = (u_in == _source[in_arc]);
     1388      _succ_num[u_in] = old_succ_num;
     1389
     1390      // Set limits for updating _last_succ form v_in and v_out
     1391      // towards the root
     1392      int up_limit_in = -1;
     1393      int up_limit_out = -1;
     1394      if (_last_succ[join] == v_in) {
     1395        up_limit_out = join;
     1396      } else {
     1397        up_limit_in = join;
    14161398      }
    14171399
    14181400      // Update _last_succ from v_in towards the root
    1419       int up_limit_out = _last_succ[join] == v_in ? join : -1;
    1420       int last_succ_out = _last_succ[u_out];
    1421       for (int u = v_in; u != -1 && _last_succ[u] == v_in; u = _parent[u]) {
    1422         _last_succ[u] = last_succ_out;
    1423       }
    1424 
     1401      for (u = v_in; u != up_limit_in && _last_succ[u] == v_in;
     1402           u = _parent[u]) {
     1403        _last_succ[u] = _last_succ[u_out];
     1404      }
    14251405      // Update _last_succ from v_out towards the root
    14261406      if (join != old_rev_thread && v_in != old_rev_thread) {
    1427         for (int u = v_out; u != up_limit_out && _last_succ[u] == old_last_succ;
     1407        for (u = v_out; u != up_limit_out && _last_succ[u] == old_last_succ;
    14281408             u = _parent[u]) {
    14291409          _last_succ[u] = old_rev_thread;
    14301410        }
    1431       }
    1432       else if (last_succ_out != old_last_succ) {
    1433         for (int u = v_out; u != up_limit_out && _last_succ[u] == old_last_succ;
     1411      } else {
     1412        for (u = v_out; u != up_limit_out && _last_succ[u] == old_last_succ;
    14341413             u = _parent[u]) {
    1435           _last_succ[u] = last_succ_out;
     1414          _last_succ[u] = _last_succ[u_out];
    14361415        }
    14371416      }
    14381417
    14391418      // Update _succ_num from v_in to join
    1440       for (int u = v_in; u != join; u = _parent[u]) {
     1419      for (u = v_in; u != join; u = _parent[u]) {
    14411420        _succ_num[u] += old_succ_num;
    14421421      }
    14431422      // Update _succ_num from v_out to join
    1444       for (int u = v_out; u != join; u = _parent[u]) {
     1423      for (u = v_out; u != join; u = _parent[u]) {
    14451424        _succ_num[u] -= old_succ_num;
    14461425      }
    14471426    }
    14481427
    1449     // Update potentials in the subtree that has been moved
     1428    // Update potentials
    14501429    void updatePotential() {
    1451       Cost sigma = _pi[v_in] - _pi[u_in] -
    1452                    _pred_dir[u_in] * _cost[in_arc];
     1430      Cost sigma = _forward[u_in] ?
     1431        _pi[v_in] - _pi[u_in] - _cost[_pred[u_in]] :
     1432        _pi[v_in] - _pi[u_in] + _cost[_pred[u_in]];
     1433      // Update potentials in the subtree, which has been moved
    14531434      int end = _thread[_last_succ[u_in]];
    14541435      for (int u = u_in; u != end; u = _thread[u]) {
     
    16091590      if (_sum_supply == 0) {
    16101591        if (_stype == GEQ) {
    1611           Cost max_pot = -std::numeric_limits<Cost>::max();
     1592          Cost max_pot = std::numeric_limits<Cost>::min();
    16121593          for (int i = 0; i != _node_num; ++i) {
    16131594            if (_pi[i] > max_pot) max_pot = _pi[i];
  • lemon/path.h

    r920 r877  
    4444  ///
    4545  /// In a sense, the path can be treated as a list of arcs. The
    46   /// LEMON path type stores just this list. As a consequence, it
     46  /// lemon path type stores just this list. As a consequence, it
    4747  /// cannot enumerate the nodes of the path and the source node of
    4848  /// a zero length path is undefined.
     
    136136    void clear() { head.clear(); tail.clear(); }
    137137
    138     /// \brief The n-th arc.
     138    /// \brief The nth arc.
    139139    ///
    140140    /// \pre \c n is in the <tt>[0..length() - 1]</tt> range.
     
    144144    }
    145145
    146     /// \brief Initialize arc iterator to point to the n-th arc
     146    /// \brief Initialize arc iterator to point to the nth arc
    147147    ///
    148148    /// \pre \c n is in the <tt>[0..length() - 1]</tt> range.
     
    232232  ///
    233233  /// In a sense, the path can be treated as a list of arcs. The
    234   /// LEMON path type stores just this list. As a consequence it
     234  /// lemon path type stores just this list. As a consequence it
    235235  /// cannot enumerate the nodes in the path and the zero length paths
    236236  /// cannot store the source.
     
    328328    void clear() { data.clear(); }
    329329
    330     /// \brief The n-th arc.
     330    /// \brief The nth arc.
    331331    ///
    332332    /// \pre \c n is in the <tt>[0..length() - 1]</tt> range.
     
    335335    }
    336336
    337     /// \brief  Initializes arc iterator to point to the n-th arc.
     337    /// \brief  Initializes arc iterator to point to the nth arc.
    338338    ArcIt nthIt(int n) const {
    339339      return ArcIt(*this, n);
     
    396396  ///
    397397  /// In a sense, the path can be treated as a list of arcs. The
    398   /// LEMON path type stores just this list. As a consequence it
     398  /// lemon path type stores just this list. As a consequence it
    399399  /// cannot enumerate the nodes in the path and the zero length paths
    400400  /// cannot store the source.
     
    505505    };
    506506
    507     /// \brief The n-th arc.
    508     ///
    509     /// This function looks for the n-th arc in O(n) time.
     507    /// \brief The nth arc.
     508    ///
     509    /// This function looks for the nth arc in O(n) time.
    510510    /// \pre \c n is in the <tt>[0..length() - 1]</tt> range.
    511511    const Arc& nth(int n) const {
     
    517517    }
    518518
    519     /// \brief Initializes arc iterator to point to the n-th arc.
     519    /// \brief Initializes arc iterator to point to the nth arc.
    520520    ArcIt nthIt(int n) const {
    521521      Node *node = first;
     
    736736  ///
    737737  /// In a sense, the path can be treated as a list of arcs. The
    738   /// LEMON path type stores just this list. As a consequence it
     738  /// lemon path type stores just this list. As a consequence it
    739739  /// cannot enumerate the nodes in the path and the source node of
    740740  /// a zero length path is undefined.
     
    832832    };
    833833
    834     /// \brief The n-th arc.
     834    /// \brief The nth arc.
    835835    ///
    836836    /// \pre \c n is in the <tt>[0..length() - 1]</tt> range.
     
    839839    }
    840840
    841     /// \brief The arc iterator pointing to the n-th arc.
     841    /// \brief The arc iterator pointing to the nth arc.
    842842    ArcIt nthIt(int n) const {
    843843      return ArcIt(*this, n);
     
    10431043  ///
    10441044  /// In a sense, the path can be treated as a list of arcs. The
    1045   /// LEMON path type stores only this list. As a consequence, it
     1045  /// lemon path type stores only this list. As a consequence, it
    10461046  /// cannot enumerate the nodes in the path and the zero length paths
    10471047  /// cannot have a source node.
  • lemon/preflow.h

    r924 r877  
    544544          _flow->set(e, (*_capacity)[e]);
    545545          (*_excess)[u] += rem;
     546          if (u != _target && !_level->active(u)) {
     547            _level->activate(u);
     548          }
    546549        }
    547550      }
     
    553556          _flow->set(e, 0);
    554557          (*_excess)[v] += rem;
    555         }
    556       }
    557       for (NodeIt n(_graph); n != INVALID; ++n)
    558         if(n!=_source && n!=_target && _tolerance.positive((*_excess)[n]))
    559           _level->activate(n);
    560          
     558          if (v != _target && !_level->active(v)) {
     559            _level->activate(v);
     560          }
     561        }
     562      }
    561563      return true;
    562564    }
     
    575577      _phase = true;
    576578
    577       while (true) {
     579      Node n = _level->highestActive();
     580      int level = _level->highestActiveLevel();
     581      while (n != INVALID) {
    578582        int num = _node_num;
    579583
    580         Node n = INVALID;
    581         int level = -1;
    582 
    583         while (num > 0) {
    584           n = _level->highestActive();
    585           if (n == INVALID) goto first_phase_done;
    586           level = _level->highestActiveLevel();
    587           --num;
    588          
     584        while (num > 0 && n != INVALID) {
    589585          Value excess = (*_excess)[n];
    590586          int new_level = _level->maxLevel();
     
    652648            _level->deactivate(n);
    653649          }
     650
     651          n = _level->highestActive();
     652          level = _level->highestActiveLevel();
     653          --num;
    654654        }
    655655
    656656        num = _node_num * 20;
    657         while (num > 0) {
    658           while (level >= 0 && _level->activeFree(level)) {
    659             --level;
    660           }
    661           if (level == -1) {
    662             n = _level->highestActive();
    663             level = _level->highestActiveLevel();
    664             if (n == INVALID) goto first_phase_done;
    665           } else {
    666             n = _level->activeOn(level);
    667           }
    668           --num;
    669 
     657        while (num > 0 && n != INVALID) {
    670658          Value excess = (*_excess)[n];
    671659          int new_level = _level->maxLevel();
     
    733721            _level->deactivate(n);
    734722          }
    735         }
    736       }
    737     first_phase_done:;
     723
     724          while (level >= 0 && _level->activeFree(level)) {
     725            --level;
     726          }
     727          if (level == -1) {
     728            n = _level->highestActive();
     729            level = _level->highestActiveLevel();
     730          } else {
     731            n = _level->activeOn(level);
     732          }
     733          --num;
     734        }
     735      }
    738736    }
    739737
  • test/CMakeLists.txt

    r930 r874  
    3232  maps_test
    3333  matching_test
    34   max_cardinality_search_test
    35   max_clique_test
    3634  min_cost_arborescence_test
    3735  min_cost_flow_test
    3836  min_mean_cycle_test
    39   nagamochi_ibaraki_test
    4037  path_test
    4138  planarity_test
     
    4946
    5047IF(LEMON_HAVE_LP)
    51   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    52     ADD_EXECUTABLE(lp_test lp_test.cc)
    53   ELSE()
    54     ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
    55   ENDIF()
    56 
     48  ADD_EXECUTABLE(lp_test lp_test.cc)
    5749  SET(LP_TEST_LIBS lemon)
    5850
     
    9082
    9183IF(LEMON_HAVE_MIP)
    92   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    93     ADD_EXECUTABLE(mip_test mip_test.cc)
    94   ELSE()
    95     ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
    96   ENDIF()
    97 
     84  ADD_EXECUTABLE(mip_test mip_test.cc)
    9885  SET(MIP_TEST_LIBS lemon)
    9986
     
    131118
    132119FOREACH(TEST_NAME ${TESTS})
    133   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    134     ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
    135   ELSE()
    136     ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
    137   ENDIF()
     120  ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
    138121  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
    139122  ADD_TEST(${TEST_NAME} ${TEST_NAME})
    140   ADD_DEPENDENCIES(check ${TEST_NAME})
    141123ENDFOREACH()
  • test/Makefile.am

    r917 r874  
    3434        test/maps_test \
    3535        test/matching_test \
    36         test/max_cardinality_search_test \
    37         test/max_clique_test \
    3836        test/min_cost_arborescence_test \
    3937        test/min_cost_flow_test \
    4038        test/min_mean_cycle_test \
    41         test/nagamochi_ibaraki_test \
    4239        test/path_test \
    4340        test/planarity_test \
     
    8885test_mip_test_SOURCES = test/mip_test.cc
    8986test_matching_test_SOURCES = test/matching_test.cc
    90 test_max_cardinality_search_test_SOURCES = test/max_cardinality_search_test.cc
    91 test_max_clique_test_SOURCES = test/max_clique_test.cc
    9287test_min_cost_arborescence_test_SOURCES = test/min_cost_arborescence_test.cc
    9388test_min_cost_flow_test_SOURCES = test/min_cost_flow_test.cc
    9489test_min_mean_cycle_test_SOURCES = test/min_mean_cycle_test.cc
    95 test_nagamochi_ibaraki_test_SOURCES = test/nagamochi_ibaraki_test.cc
    9690test_path_test_SOURCES = test/path_test.cc
    9791test_planarity_test_SOURCES = test/planarity_test.cc
  • test/bellman_ford_test.cc

    r880 r877  
    105105      ::SetDistMap<concepts::ReadWriteMap<Node,Value> >
    106106      ::SetOperationTraits<BellmanFordDefaultOperationTraits<Value> >
     107      ::SetOperationTraits<BellmanFordToleranceOperationTraits<Value, 0> >
    107108      ::Create bf_test(gr,length);
    108109
  • test/dfs_test.cc

    r907 r877  
    5151  "@attributes\n"
    5252  "source 0\n"
    53   "target 5\n"
    54   "source1 6\n"
    55   "target1 3\n";
    56 
     53  "target 5\n";
    5754
    5855void checkDfsCompile()
     
    183180  Digraph G;
    184181  Node s, t;
    185   Node s1, t1;
    186182
    187183  std::istringstream input(test_lgf);
     
    189185    node("source", s).
    190186    node("target", t).
    191     node("source1", s1).
    192     node("target1", t1).
    193187    run();
    194188
     
    217211
    218212  {
    219   Dfs<Digraph> dfs(G);
    220   check(dfs.run(s1,t1) && dfs.reached(t1),"Node 3 is reachable from Node 6.");
    221   }
    222  
    223   {
    224213    NullMap<Node,Arc> myPredMap;
    225214    dfs(G).predMap(myPredMap).run(s);
  • test/graph_copy_test.cc

    r894 r440  
    1919#include <lemon/smart_graph.h>
    2020#include <lemon/list_graph.h>
    21 #include <lemon/static_graph.h>
    2221#include <lemon/lgf_reader.h>
    2322#include <lemon/error.h>
     
    2827using namespace lemon;
    2928
    30 template <typename GR>
    3129void digraph_copy_test() {
    3230  const int nn = 10;
    3331
    34   // Build a digraph
    3532  SmartDigraph from;
    3633  SmartDigraph::NodeMap<int> fnm(from);
     
    5451    }
    5552  }
    56  
    57   // Test digraph copy
    58   GR to;
    59   typename GR::template NodeMap<int> tnm(to);
    60   typename GR::template ArcMap<int> tam(to);
    61   typename GR::Node tn;
    62   typename GR::Arc ta;
    6353
    64   SmartDigraph::NodeMap<typename GR::Node> nr(from);
    65   SmartDigraph::ArcMap<typename GR::Arc> er(from);
     54  ListDigraph to;
     55  ListDigraph::NodeMap<int> tnm(to);
     56  ListDigraph::ArcMap<int> tam(to);
     57  ListDigraph::Node tn;
     58  ListDigraph::Arc ta;
    6659
    67   typename GR::template NodeMap<SmartDigraph::Node> ncr(to);
    68   typename GR::template ArcMap<SmartDigraph::Arc> ecr(to);
     60  SmartDigraph::NodeMap<ListDigraph::Node> nr(from);
     61  SmartDigraph::ArcMap<ListDigraph::Arc> er(from);
     62
     63  ListDigraph::NodeMap<SmartDigraph::Node> ncr(to);
     64  ListDigraph::ArcMap<SmartDigraph::Arc> ecr(to);
    6965
    7066  digraphCopy(from, to).
     
    7369    nodeCrossRef(ncr).arcCrossRef(ecr).
    7470    node(fn, tn).arc(fa, ta).run();
    75  
    76   check(countNodes(from) == countNodes(to), "Wrong copy.");
    77   check(countArcs(from) == countArcs(to), "Wrong copy.");
    7871
    7972  for (SmartDigraph::NodeIt it(from); it != INVALID; ++it) {
     
    8982  }
    9083
    91   for (typename GR::NodeIt it(to); it != INVALID; ++it) {
     84  for (ListDigraph::NodeIt it(to); it != INVALID; ++it) {
    9285    check(nr[ncr[it]] == it, "Wrong copy.");
    9386  }
    9487
    95   for (typename GR::ArcIt it(to); it != INVALID; ++it) {
     88  for (ListDigraph::ArcIt it(to); it != INVALID; ++it) {
    9689    check(er[ecr[it]] == it, "Wrong copy.");
    9790  }
    9891  check(tn == nr[fn], "Wrong copy.");
    9992  check(ta == er[fa], "Wrong copy.");
    100 
    101   // Test repeated copy
    102   digraphCopy(from, to).run();
    103  
    104   check(countNodes(from) == countNodes(to), "Wrong copy.");
    105   check(countArcs(from) == countArcs(to), "Wrong copy.");
    10693}
    10794
    108 template <typename GR>
    10995void graph_copy_test() {
    11096  const int nn = 10;
    11197
    112   // Build a graph
    11398  SmartGraph from;
    11499  SmartGraph::NodeMap<int> fnm(from);
     
    138123  }
    139124
    140   // Test graph copy
    141   GR to;
    142   typename GR::template NodeMap<int> tnm(to);
    143   typename GR::template ArcMap<int> tam(to);
    144   typename GR::template EdgeMap<int> tem(to);
    145   typename GR::Node tn;
    146   typename GR::Arc ta;
    147   typename GR::Edge te;
     125  ListGraph to;
     126  ListGraph::NodeMap<int> tnm(to);
     127  ListGraph::ArcMap<int> tam(to);
     128  ListGraph::EdgeMap<int> tem(to);
     129  ListGraph::Node tn;
     130  ListGraph::Arc ta;
     131  ListGraph::Edge te;
    148132
    149   SmartGraph::NodeMap<typename GR::Node> nr(from);
    150   SmartGraph::ArcMap<typename GR::Arc> ar(from);
    151   SmartGraph::EdgeMap<typename GR::Edge> er(from);
     133  SmartGraph::NodeMap<ListGraph::Node> nr(from);
     134  SmartGraph::ArcMap<ListGraph::Arc> ar(from);
     135  SmartGraph::EdgeMap<ListGraph::Edge> er(from);
    152136
    153   typename GR::template NodeMap<SmartGraph::Node> ncr(to);
    154   typename GR::template ArcMap<SmartGraph::Arc> acr(to);
    155   typename GR::template EdgeMap<SmartGraph::Edge> ecr(to);
     137  ListGraph::NodeMap<SmartGraph::Node> ncr(to);
     138  ListGraph::ArcMap<SmartGraph::Arc> acr(to);
     139  ListGraph::EdgeMap<SmartGraph::Edge> ecr(to);
    156140
    157141  graphCopy(from, to).
     
    160144    nodeCrossRef(ncr).arcCrossRef(acr).edgeCrossRef(ecr).
    161145    node(fn, tn).arc(fa, ta).edge(fe, te).run();
    162 
    163   check(countNodes(from) == countNodes(to), "Wrong copy.");
    164   check(countEdges(from) == countEdges(to), "Wrong copy.");
    165   check(countArcs(from) == countArcs(to), "Wrong copy.");
    166146
    167147  for (SmartGraph::NodeIt it(from); it != INVALID; ++it) {
     
    188168  }
    189169
    190   for (typename GR::NodeIt it(to); it != INVALID; ++it) {
     170  for (ListGraph::NodeIt it(to); it != INVALID; ++it) {
    191171    check(nr[ncr[it]] == it, "Wrong copy.");
    192172  }
    193173
    194   for (typename GR::ArcIt it(to); it != INVALID; ++it) {
     174  for (ListGraph::ArcIt it(to); it != INVALID; ++it) {
    195175    check(ar[acr[it]] == it, "Wrong copy.");
    196176  }
    197   for (typename GR::EdgeIt it(to); it != INVALID; ++it) {
     177  for (ListGraph::EdgeIt it(to); it != INVALID; ++it) {
    198178    check(er[ecr[it]] == it, "Wrong copy.");
    199179  }
     
    201181  check(ta == ar[fa], "Wrong copy.");
    202182  check(te == er[fe], "Wrong copy.");
    203 
    204   // Test repeated copy
    205   graphCopy(from, to).run();
    206  
    207   check(countNodes(from) == countNodes(to), "Wrong copy.");
    208   check(countEdges(from) == countEdges(to), "Wrong copy.");
    209   check(countArcs(from) == countArcs(to), "Wrong copy.");
    210183}
    211184
    212185
    213186int main() {
    214   digraph_copy_test<SmartDigraph>();
    215   digraph_copy_test<ListDigraph>();
    216   digraph_copy_test<StaticDigraph>();
    217   graph_copy_test<SmartGraph>();
    218   graph_copy_test<ListGraph>();
     187  digraph_copy_test();
     188  graph_copy_test();
    219189
    220190  return 0;
  • test/preflow_test.cc

    r924 r877  
    157157}
    158158
    159 void initFlowTest()
    160 {
    161   DIGRAPH_TYPEDEFS(SmartDigraph);
    162  
    163   SmartDigraph g;
    164   SmartDigraph::ArcMap<int> cap(g),iflow(g);
    165   Node s=g.addNode(); Node t=g.addNode();
    166   Node n1=g.addNode(); Node n2=g.addNode();
    167   Arc a;
    168   a=g.addArc(s,n1); cap[a]=20; iflow[a]=20;
    169   a=g.addArc(n1,n2); cap[a]=10; iflow[a]=0;
    170   a=g.addArc(n2,t); cap[a]=20; iflow[a]=0;
    171 
    172   Preflow<SmartDigraph> pre(g,cap,s,t);
    173   pre.init(iflow);
    174   pre.startFirstPhase();
    175   check(pre.flowValue() == 10, "The incorrect max flow value.");
    176   check(pre.minCut(s), "Wrong min cut (Node s).");
    177   check(pre.minCut(n1), "Wrong min cut (Node n1).");
    178   check(!pre.minCut(n2), "Wrong min cut (Node n2).");
    179   check(!pre.minCut(t), "Wrong min cut (Node t).");
    180 }
    181 
    182 
    183159int main() {
    184160
     
    271247        "The max flow value or the three min cut values are incorrect.");
    272248
    273   initFlowTest();
    274  
    275249  return 0;
    276250}
Note: See TracChangeset for help on using the changeset viewer.