COIN-OR::LEMON - Graph Library

Ignore:
Files:
5 added
29 edited

Legend:

Unmodified
Added
Removed
  • Makefile.am

    r676 r799  
    1818        cmake/FindGLPK.cmake \
    1919        cmake/FindCOIN.cmake \
     20        cmake/LEMONConfig.cmake.in \
    2021        cmake/version.cmake.in \
    2122        cmake/version.cmake \
  • doc/Doxyfile.in

    r791 r803  
    1 # Doxyfile 1.5.7.1
     1# Doxyfile 1.5.9
    22
    33#---------------------------------------------------------------------------
     
    2222QT_AUTOBRIEF           = NO
    2323MULTILINE_CPP_IS_BRIEF = NO
    24 DETAILS_AT_TOP         = YES
    2524INHERIT_DOCS           = NO
    2625SEPARATE_MEMBER_PAGES  = NO
     
    225224SKIP_FUNCTION_MACROS   = YES
    226225#---------------------------------------------------------------------------
    227 # Configuration::additions related to external references   
     226# Options related to the search engine   
    228227#---------------------------------------------------------------------------
    229228TAGFILES               = "@abs_top_srcdir@/doc/libstdc++.tag = http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/  "
  • doc/groups.dox

    r789 r818  
    317317
    318318This group contains the common graph search algorithms, namely
    319 \e breadth-first \e search (BFS) and \e depth-first \e search (DFS).
     319\e breadth-first \e search (BFS) and \e depth-first \e search (DFS)
     320\ref clrs01algorithms.
    320321*/
    321322
     
    325326\brief Algorithms for finding shortest paths.
    326327
    327 This group contains the algorithms for finding shortest paths in digraphs.
     328This group contains the algorithms for finding shortest paths in digraphs
     329\ref clrs01algorithms.
    328330
    329331 - \ref Dijkstra algorithm for finding shortest paths from a source node
     
    347349
    348350This group contains the algorithms for finding minimum cost spanning
    349 trees and arborescences.
     351trees and arborescences \ref clrs01algorithms.
    350352*/
    351353
     
    356358
    357359This group contains the algorithms for finding maximum flows and
    358 feasible circulations.
     360feasible circulations \ref clrs01algorithms, \ref amo93networkflows.
    359361
    360362The \e maximum \e flow \e problem is to find a flow of maximum value between
     
    371373
    372374LEMON contains several algorithms for solving maximum flow problems:
    373 - \ref EdmondsKarp Edmonds-Karp algorithm.
    374 - \ref Preflow Goldberg-Tarjan's preflow push-relabel algorithm.
    375 - \ref DinitzSleatorTarjan Dinitz's blocking flow algorithm with dynamic trees.
    376 - \ref GoldbergTarjan Preflow push-relabel algorithm with dynamic trees.
    377 
    378 In most cases the \ref Preflow "Preflow" algorithm provides the
     375- \ref EdmondsKarp Edmonds-Karp algorithm
     376  \ref edmondskarp72theoretical.
     377- \ref Preflow Goldberg-Tarjan's preflow push-relabel algorithm
     378  \ref goldberg88newapproach.
     379- \ref DinitzSleatorTarjan Dinitz's blocking flow algorithm with dynamic trees
     380  \ref dinic70algorithm, \ref sleator83dynamic.
     381- \ref GoldbergTarjan !Preflow push-relabel algorithm with dynamic trees
     382  \ref goldberg88newapproach, \ref sleator83dynamic.
     383
     384In most cases the \ref Preflow algorithm provides the
    379385fastest method for computing a maximum flow. All implementations
    380386also provide functions to query the minimum cut, which is the dual
     
    394400
    395401This group contains the algorithms for finding minimum cost flows and
    396 circulations. For more information about this problem and its dual
    397 solution see \ref min_cost_flow "Minimum Cost Flow Problem".
     402circulations \ref amo93networkflows. For more information about this
     403problem and its dual solution, see \ref min_cost_flow
     404"Minimum Cost Flow Problem".
    398405
    399406LEMON contains several algorithms for this problem.
    400407 - \ref NetworkSimplex Primal Network Simplex algorithm with various
    401    pivot strategies.
     408   pivot strategies \ref dantzig63linearprog, \ref kellyoneill91netsimplex.
    402409 - \ref CostScaling Push-Relabel and Augment-Relabel algorithms based on
    403    cost scaling.
     410   cost scaling \ref goldberg90approximation, \ref goldberg97efficient,
     411   \ref bunnagel98efficient.
    404412 - \ref CapacityScaling Successive Shortest %Path algorithm with optional
    405    capacity scaling.
    406  - \ref CancelAndTighten The Cancel and Tighten algorithm.
    407  - \ref CycleCanceling Cycle-Canceling algorithms.
     413   capacity scaling \ref edmondskarp72theoretical.
     414 - \ref CancelAndTighten The Cancel and Tighten algorithm
     415   \ref goldberg89cyclecanceling.
     416 - \ref CycleCanceling Cycle-Canceling algorithms
     417   \ref klein67primal, \ref goldberg89cyclecanceling.
    408418
    409419In general NetworkSimplex is the most efficient implementation,
     
    441451If you want to find minimum cut just between two distinict nodes,
    442452see the \ref max_flow "maximum flow problem".
     453*/
     454
     455/**
     456@defgroup min_mean_cycle Minimum Mean Cycle Algorithms
     457@ingroup algs
     458\brief Algorithms for finding minimum mean cycles.
     459
     460This group contains the algorithms for finding minimum mean cycles
     461\ref clrs01algorithms, \ref amo93networkflows.
     462
     463The \e minimum \e mean \e cycle \e problem is to find a directed cycle
     464of minimum mean length (cost) in a digraph.
     465The mean length of a cycle is the average length of its arcs, i.e. the
     466ratio between the total length of the cycle and the number of arcs on it.
     467
     468This problem has an important connection to \e conservative \e length
     469\e functions, too. A length function on the arcs of a digraph is called
     470conservative if and only if there is no directed cycle of negative total
     471length. For an arbitrary length function, the negative of the minimum
     472cycle mean is the smallest \f$\epsilon\f$ value so that increasing the
     473arc lengths uniformly by \f$\epsilon\f$ results in a conservative length
     474function.
     475
     476LEMON contains three algorithms for solving the minimum mean cycle problem:
     477- \ref Karp "Karp"'s original algorithm \ref amo93networkflows,
     478  \ref dasdan98minmeancycle.
     479- \ref HartmannOrlin "Hartmann-Orlin"'s algorithm, which is an improved
     480  version of Karp's algorithm \ref dasdan98minmeancycle.
     481- \ref Howard "Howard"'s policy iteration algorithm
     482  \ref dasdan98minmeancycle.
     483
     484In practice, the Howard algorithm proved to be by far the most efficient
     485one, though the best known theoretical bound on its running time is
     486exponential.
     487Both Karp and HartmannOrlin algorithms run in time O(ne) and use space
     488O(n<sup>2</sup>+e), but the latter one is typically faster due to the
     489applied early termination scheme.
    443490*/
    444491
     
    535582
    536583/**
    537 @defgroup lp_group Lp and Mip Solvers
     584@defgroup lp_group LP and MIP Solvers
    538585@ingroup gen_opt_group
    539 \brief Lp and Mip solver interfaces for LEMON.
    540 
    541 This group contains Lp and Mip solver interfaces for LEMON. The
    542 various LP solvers could be used in the same manner with this
    543 interface.
     586\brief LP and MIP solver interfaces for LEMON.
     587
     588This group contains LP and MIP solver interfaces for LEMON.
     589Various LP solvers could be used in the same manner with this
     590high-level interface.
     591
     592The currently supported solvers are \ref glpk, \ref clp, \ref cbc,
     593\ref cplex, \ref soplex.
    544594*/
    545595
  • doc/mainpage.dox

    r705 r802  
    2222\section intro Introduction
    2323
    24 \subsection whatis What is LEMON
    25 
    26 LEMON stands for <b>L</b>ibrary for <b>E</b>fficient <b>M</b>odeling
    27 and <b>O</b>ptimization in <b>N</b>etworks.
    28 It is a C++ template
    29 library aimed at combinatorial optimization tasks which
    30 often involve in working
    31 with graphs.
     24<b>LEMON</b> stands for <i><b>L</b>ibrary for <b>E</b>fficient <b>M</b>odeling
     25and <b>O</b>ptimization in <b>N</b>etworks</i>.
     26It is a C++ template library providing efficient implementation of common
     27data structures and algorithms with focus on combinatorial optimization
     28problems in graphs and networks.
    3229
    3330<b>
     
    3936</b>
    4037
    41 \subsection howtoread How to read the documentation
     38The project is maintained by the
     39<a href="http://www.cs.elte.hu/egres/">Egerv&aacute;ry Research Group on
     40Combinatorial Optimization</a> \ref egres
     41at the Operations Research Department of the
     42<a href="http://www.elte.hu/">E&ouml;tv&ouml;s Lor&aacute;nd University,
     43Budapest</a>, Hungary.
     44LEMON is also a member of the <a href="http://www.coin-or.org/">COIN-OR</a>
     45initiative \ref coinor.
     46
     47\section howtoread How to Read the Documentation
    4248
    4349If you would like to get to know the library, see
  • doc/min_cost_flow.dox

    r833 r835  
    2727minimum total cost from a set of supply nodes to a set of demand nodes
    2828in a network with capacity constraints (lower and upper bounds)
    29 and arc costs.
     29and arc costs \ref amo93networkflows.
    3030
    3131Formally, let \f$G=(V,A)\f$ be a digraph, \f$lower: A\rightarrow\mathbf{R}\f$,
  • doc/references.bib

    r790 r802  
    1313  title =        {{EGRES} -- {E}gerv{\'a}ry {R}esearch {G}roup on
    1414                  {C}ombinatorial {O}ptimization},
    15   howpublished = {\url{http://www.cs.elte.hu/egres/}},
    16   year =         2009
     15  url =          {http://www.cs.elte.hu/egres/}
    1716}
    1817
     
    2120  title =        {{COIN-OR} -- {C}omputational {I}nfrastructure for
    2221                  {O}perations {R}esearch},
    23   howpublished = {\url{http://www.coin-or.org/}},
    24   year =         2009
     22  url =          {http://www.coin-or.org/}
    2523}
    2624
     
    3129  key =          {Boost},
    3230  title =        {{B}oost {C++} {L}ibraries},
    33   howpublished = {\url{http://www.boost.org/}},
    34   year =         2009
     31  url =          {http://www.boost.org/}
    3532}
    3633
     
    4845  title =        {{LEDA} -- {L}ibrary of {E}fficient {D}ata {T}ypes and
    4946                  {A}lgorithms},
    50   howpublished = {\url{http://www.algorithmic-solutions.com/}},
    51   year =         2009
     47  url =          {http://www.algorithmic-solutions.com/}
    5248}
    5349
     
    6864  key =          {CMake},
    6965  title =        {{CMake} -- {C}ross {P}latform {M}ake},
    70   howpublished = {\url{http://www.cmake.org/}},
    71   year =         2009
     66  url =          {http://www.cmake.org/}
    7267}
    7368
     
    7671  title =        {{Doxygen} -- {S}ource code documentation generator
    7772                  tool},
    78   howpublished = {\url{http://www.doxygen.org/}},
    79   year =         2009
     73  url =          {http://www.doxygen.org/}
    8074}
    8175
     
    8680  key =          {GLPK},
    8781  title =        {{GLPK} -- {GNU} {L}inear {P}rogramming {K}it},
    88   howpublished = {\url{http://www.gnu.org/software/glpk/}},
    89   year =         2009
     82  url =          {http://www.gnu.org/software/glpk/}
    9083}
    9184
     
    9386  key =          {Clp},
    9487  title =        {{Clp} -- {Coin-Or} {L}inear {P}rogramming},
    95   howpublished = {\url{http://projects.coin-or.org/Clp/}},
    96   year =         2009
     88  url =          {http://projects.coin-or.org/Clp/}
    9789}
    9890
     
    10092  key =          {Cbc},
    10193  title =        {{Cbc} -- {Coin-Or} {B}ranch and {C}ut},
    102   howpublished = {\url{http://projects.coin-or.org/Cbc/}},
    103   year =         2009
     94  url =          {http://projects.coin-or.org/Cbc/}
    10495}
    10596
     
    10798  key =          {CPLEX},
    10899  title =        {{ILOG} {CPLEX}},
    109   howpublished = {\url{http://www.ilog.com/}},
    110   year =         2009
     100  url =          {http://www.ilog.com/}
    111101}
    112102
     
    115105  title =        {{SoPlex} -- {T}he {S}equential {O}bject-{O}riented
    116106                  {S}implex},
    117   howpublished = {\url{http://soplex.zib.de/}},
    118   year =         2009
     107  url =          {http://soplex.zib.de/}
    119108}
    120109
     
    162151%%%%% Maximum flow algorithms %%%%%
    163152
    164 @inproceedings{goldberg86newapproach,
     153@article{edmondskarp72theoretical,
     154  author =       {Jack Edmonds and Richard M. Karp},
     155  title =        {Theoretical improvements in algorithmic efficiency
     156                  for network flow problems},
     157  journal =      {Journal of the ACM},
     158  year =         1972,
     159  volume =       19,
     160  number =       2,
     161  pages =        {248-264}
     162}
     163
     164@article{goldberg88newapproach,
    165165  author =       {Andrew V. Goldberg and Robert E. Tarjan},
    166166  title =        {A new approach to the maximum flow problem},
    167   booktitle =    {STOC '86: Proceedings of the Eighteenth Annual ACM
    168                   Symposium on Theory of Computing},
    169   year =         1986,
    170   publisher =    {ACM Press},
    171   address =      {New York, NY},
    172   pages =        {136-146}
     167  journal =      {Journal of the ACM},
     168  year =         1988,
     169  volume =       35,
     170  number =       4,
     171  pages =        {921-940}
    173172}
    174173
     
    241240}
    242241
    243 @inproceedings{goldberg88cyclecanceling,
     242@article{goldberg89cyclecanceling,
    244243  author =       {Andrew V. Goldberg and Robert E. Tarjan},
    245244  title =        {Finding minimum-cost circulations by canceling
    246245                  negative cycles},
    247   booktitle =    {STOC '88: Proceedings of the Twentieth Annual ACM
    248                   Symposium on Theory of Computing},
    249   year =         1988,
    250   publisher =    {ACM Press},
    251   address =      {New York, NY},
    252   pages =        {388-397}
    253 }
    254 
    255 @article{edmondskarp72theoretical,
    256   author =       {Jack Edmonds and Richard M. Karp},
    257   title =        {Theoretical improvements in algorithmic efficiency
    258                   for network flow problems},
    259246  journal =      {Journal of the ACM},
    260   year =         1972,
    261   volume =       19,
    262   number =       2,
    263   pages =        {248-264}
    264 }
    265 
    266 @inproceedings{goldberg87approximation,
    267   author =       {Andrew V. Goldberg and Robert E. Tarjan},
    268   title =        {Solving minimum-cost flow problems by successive
    269                   approximation},
    270   booktitle =    {STOC '87: Proceedings of the Nineteenth Annual ACM
    271                   Symposium on Theory of Computing},
    272   year =         1987,
    273   publisher =    {ACM Press},
    274   address =      {New York, NY},
    275   pages =        {7-18}
    276 }
    277 
    278 @article{goldberg90finding,
     247  year =         1989,
     248  volume =       36,
     249  number =       4,
     250  pages =        {873-886}
     251}
     252
     253@article{goldberg90approximation,
    279254  author =       {Andrew V. Goldberg and Robert E. Tarjan},
    280255  title =        {Finding Minimum-Cost Circulations by Successive
     
    309284}
    310285
     286@book{dantzig63linearprog,
     287  author =       {George B. Dantzig},
     288  title =        {Linear Programming and Extensions},
     289  publisher =    {Princeton University Press},
     290  year =         1963
     291}
     292
    311293@mastersthesis{kellyoneill91netsimplex,
    312294  author =       {Damian J. Kelly and Garrett M. O'Neill},
     
    318300  month =        sep,
    319301}
    320 
    321 @techreport{lobel96networksimplex,
    322   author =       {Andreas L{\"o}bel},
    323   title =        {Solving large-scale real-world minimum-cost flow
    324                   problems by a network simplex method},
    325   institution =  {Konrad-Zuse-Zentrum fur Informationstechnik Berlin
    326                   ({ZIB})},
    327   address =      {Berlin, Germany},
    328   year =         1996,
    329   number =       {SC 96-7}
    330 }
    331 
    332 @article{frangioni06computational,
    333   author =       {Antonio Frangioni and Antonio Manca},
    334   title =        {A Computational Study of Cost Reoptimization for
    335                   Min-Cost Flow Problems},
    336   journal =      {INFORMS Journal On Computing},
    337   year =         2006,
    338   volume =       18,
    339   number =       1,
    340   pages =        {61-70}
    341 }
  • lemon/Makefile.am

    r755 r827  
    8787        lemon/graph_to_eps.h \
    8888        lemon/grid_graph.h \
     89        lemon/hartmann_orlin.h \
     90        lemon/howard.h \
    8991        lemon/hypercube_graph.h \
     92        lemon/karp.h \
    9093        lemon/kary_heap.h \
    9194        lemon/kruskal.h \
     
    111114        lemon/smart_graph.h \
    112115        lemon/soplex.h \
     116        lemon/static_graph.h \
    113117        lemon/suurballe.h \
    114118        lemon/time_measure.h \
  • lemon/adaptors.h

    r703 r834  
    361361  /// parameter is set to be \c const.
    362362  ///
     363  /// This class provides item counting in the same time as the adapted
     364  /// digraph structure.
     365  ///
    363366  /// \tparam DGR The type of the adapted digraph.
    364367  /// It must conform to the \ref concepts::Digraph "Digraph" concept.
     
    719722  /// by adding or removing nodes or arcs, unless the \c GR template
    720723  /// parameter is set to be \c const.
     724  ///
     725  /// This class provides only linear time counting for nodes and arcs.
    721726  ///
    722727  /// \tparam DGR The type of the adapted digraph.
     
    13151320  /// parameter is set to be \c const.
    13161321  ///
     1322  /// This class provides only linear time counting for nodes, edges and arcs.
     1323  ///
    13171324  /// \tparam GR The type of the adapted graph.
    13181325  /// It must conform to the \ref concepts::Graph "Graph" concept.
     
    14711478  /// by adding or removing nodes or arcs/edges, unless the \c GR template
    14721479  /// parameter is set to be \c const.
     1480  ///
     1481  /// This class provides only linear time item counting.
    14731482  ///
    14741483  /// \tparam GR The type of the adapted digraph or graph.
     
    16201629  /// parameter is set to be \c const.
    16211630  ///
     1631  /// This class provides only linear time counting for nodes and arcs.
     1632  ///
    16221633  /// \tparam DGR The type of the adapted digraph.
    16231634  /// It must conform to the \ref concepts::Digraph "Digraph" concept.
     
    17291740  /// by adding or removing nodes or edges, unless the \c GR template
    17301741  /// parameter is set to be \c const.
     1742  ///
     1743  /// This class provides only linear time counting for nodes, edges and arcs.
    17311744  ///
    17321745  /// \tparam GR The type of the adapted graph.
     
    22332246  /// parameter is set to be \c const.
    22342247  ///
     2248  /// This class provides item counting in the same time as the adapted
     2249  /// digraph structure.
     2250  ///
    22352251  /// \tparam DGR The type of the adapted digraph.
    22362252  /// It must conform to the \ref concepts::Digraph "Digraph" concept.
     
    25352551  /// by adding or removing nodes or arcs, unless the \c GR template
    25362552  /// parameter is set to be \c const.
     2553  ///
     2554  /// This class provides item counting in the same time as the adapted
     2555  /// graph structure.
    25372556  ///
    25382557  /// \tparam GR The type of the adapted graph.
     
    26782697  /// arcs).
    26792698  /// This class conforms to the \ref concepts::Digraph "Digraph" concept.
     2699  ///
     2700  /// This class provides only linear time counting for nodes and arcs.
    26802701  ///
    26812702  /// \tparam DGR The type of the adapted digraph.
     
    33263347  /// in the adaptor.
    33273348  ///
     3349  /// This class provides item counting in the same time as the adapted
     3350  /// digraph structure.
     3351  ///
    33283352  /// \tparam DGR The type of the adapted digraph.
    33293353  /// It must conform to the \ref concepts::Digraph "Digraph" concept.
  • lemon/bellman_ford.h

    r833 r835  
    2424/// \brief Bellman-Ford algorithm.
    2525
     26#include <lemon/list_graph.h>
    2627#include <lemon/bits/path_dump.h>
    2728#include <lemon/core.h>
     
    776777    /// length if the algorithm has already found one.
    777778    /// Otherwise it gives back an empty path.
    778     lemon::Path<Digraph> negativeCycle() {
     779    lemon::Path<Digraph> negativeCycle() const {
    779780      typename Digraph::template NodeMap<int> state(*_gr, -1);
    780781      lemon::Path<Digraph> cycle;
  • lemon/bfs.h

    r833 r835  
    702702    ///Runs the algorithm to visit all nodes in the digraph.
    703703
    704     ///This method runs the %BFS algorithm in order to
    705     ///compute the shortest path to each node.
    706     ///
    707     ///The algorithm computes
    708     ///- the shortest path tree (forest),
    709     ///- the distance of each node from the root(s).
     704    ///This method runs the %BFS algorithm in order to visit all nodes
     705    ///in the digraph.
    710706    ///
    711707    ///\note <tt>b.run(s)</tt> is just a shortcut of the following code.
     
    10471043    ///Runs BFS algorithm to visit all nodes in the digraph.
    10481044
    1049     ///This method runs BFS algorithm in order to compute
    1050     ///the shortest path to each node.
     1045    ///This method runs BFS algorithm in order to visit all nodes
     1046    ///in the digraph.
    10511047    void run()
    10521048    {
     
    16961692    /// \brief Runs the algorithm to visit all nodes in the digraph.
    16971693    ///
    1698     /// This method runs the %BFS algorithm in order to
    1699     /// compute the shortest path to each node.
    1700     ///
    1701     /// The algorithm computes
    1702     /// - the shortest path tree (forest),
    1703     /// - the distance of each node from the root(s).
     1694    /// This method runs the %BFS algorithm in order to visit all nodes
     1695    /// in the digraph.
    17041696    ///
    17051697    /// \note <tt>b.run(s)</tt> is just a shortcut of the following code.
  • lemon/bits/graph_extender.h

    r732 r825  
    5757    }
    5858
    59     Node fromId(int id, Node) const {
     59    static Node fromId(int id, Node) {
    6060      return Parent::nodeFromId(id);
    6161    }
    6262
    63     Arc fromId(int id, Arc) const {
     63    static Arc fromId(int id, Arc) {
    6464      return Parent::arcFromId(id);
    6565    }
     
    356356    }
    357357
    358     Node fromId(int id, Node) const {
     358    static Node fromId(int id, Node) {
    359359      return Parent::nodeFromId(id);
    360360    }
    361361
    362     Arc fromId(int id, Arc) const {
     362    static Arc fromId(int id, Arc) {
    363363      return Parent::arcFromId(id);
    364364    }
    365365
    366     Edge fromId(int id, Edge) const {
     366    static Edge fromId(int id, Edge) {
    367367      return Parent::edgeFromId(id);
    368368    }
  • lemon/dfs.h

    r833 r835  
    634634    ///Runs the algorithm to visit all nodes in the digraph.
    635635
    636     ///This method runs the %DFS algorithm in order to compute the
    637     ///%DFS path to each node.
    638     ///
    639     ///The algorithm computes
    640     ///- the %DFS tree (forest),
    641     ///- the distance of each node from the root(s) in the %DFS tree.
     636    ///This method runs the %DFS algorithm in order to visit all nodes
     637    ///in the digraph.
    642638    ///
    643639    ///\note <tt>d.run()</tt> is just a shortcut of the following code.
     
    977973    ///Runs DFS algorithm to visit all nodes in the digraph.
    978974
    979     ///This method runs DFS algorithm in order to compute
    980     ///the DFS path to each node.
     975    ///This method runs DFS algorithm in order to visit all nodes
     976    ///in the digraph.
    981977    void run()
    982978    {
     
    15791575    /// \brief Runs the algorithm to visit all nodes in the digraph.
    15801576
    1581     /// This method runs the %DFS algorithm in order to
    1582     /// compute the %DFS path to each node.
    1583     ///
    1584     /// The algorithm computes
    1585     /// - the %DFS tree (forest),
    1586     /// - the distance of each node from the root(s) in the %DFS tree.
     1577    /// This method runs the %DFS algorithm in order to visit all nodes
     1578    /// in the digraph.
    15871579    ///
    15881580    /// \note <tt>d.run()</tt> is just a shortcut of the following code.
  • lemon/dijkstra.h

    r833 r835  
    207207
    208208    ///The type of the arc lengths.
    209     typedef typename TR::LengthMap::Value Value;
     209    typedef typename TR::Value Value;
    210210    ///The type of the map that stores the arc lengths.
    211211    typedef typename TR::LengthMap LengthMap;
  • lemon/edge_set.h

    r717 r834  
    256256  /// all arcs incident to the given node is erased from the arc set.
    257257  ///
     258  /// This class fully conforms to the \ref concepts::Digraph
     259  /// "Digraph" concept.
     260  /// It provides only linear time counting for nodes and arcs.
     261  ///
    258262  /// \param GR The type of the graph which shares its node set with
    259263  /// this class. Its interface must conform to the
    260264  /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph"
    261265  /// concept.
    262   ///
    263   /// This class fully conforms to the \ref concepts::Digraph
    264   /// "Digraph" concept.
    265266  template <typename GR>
    266267  class ListArcSet : public ArcSetExtender<ListArcSetBase<GR> > {
     
    686687  /// incident to the given node is erased from the arc set.
    687688  ///
     689  /// This class fully conforms to the \ref concepts::Graph "Graph"
     690  /// concept.
     691  /// It provides only linear time counting for nodes, edges and arcs.
     692  ///
    688693  /// \param GR The type of the graph which shares its node set
    689694  /// with this class. Its interface must conform to the
    690695  /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph"
    691   /// concept.
    692   ///
    693   /// This class fully conforms to the \ref concepts::Graph "Graph"
    694696  /// concept.
    695697  template <typename GR>
     
    868870    }
    869871
    870     void next(Arc& arc) const {
     872    static void next(Arc& arc) {
    871873      --arc.id;
    872874    }
     
    955957  /// arcs. Therefore the arcs cannot be erased from the arc sets.
    956958  ///
     959  /// This class fully conforms to the \ref concepts::Digraph "Digraph"
     960  /// concept.
     961  /// It provides only linear time counting for nodes and arcs.
     962  ///
    957963  /// \warning If a node is erased from the underlying graph and this
    958964  /// node is the source or target of one arc in the arc set, then
    959965  /// the arc set is invalidated, and it cannot be used anymore. The
    960966  /// validity can be checked with the \c valid() member function.
    961   ///
    962   /// This class fully conforms to the \ref concepts::Digraph
    963   /// "Digraph" concept.
    964967  template <typename GR>
    965968  class SmartArcSet : public ArcSetExtender<SmartArcSetBase<GR> > {
     
    11741177    }
    11751178
    1176     void next(Arc& arc) const {
     1179    static void next(Arc& arc) {
    11771180      --arc.id;
    11781181    }
     
    11821185    }
    11831186
    1184     void next(Edge& arc) const {
     1187    static void next(Edge& arc) {
    11851188      --arc.id;
    11861189    }
     
    13051308  /// edges cannot be erased from the edge sets.
    13061309  ///
     1310  /// This class fully conforms to the \ref concepts::Graph "Graph"
     1311  /// concept.
     1312  /// It provides only linear time counting for nodes, edges and arcs.
     1313  ///
    13071314  /// \warning If a node is erased from the underlying graph and this
    13081315  /// node is incident to one edge in the edge set, then the edge set
    13091316  /// is invalidated, and it cannot be used anymore. The validity can
    13101317  /// be checked with the \c valid() member function.
    1311   ///
    1312   /// This class fully conforms to the \ref concepts::Graph
    1313   /// "Graph" concept.
    13141318  template <typename GR>
    13151319  class SmartEdgeSet : public EdgeSetExtender<SmartEdgeSetBase<GR> > {
  • lemon/full_graph.h

    r782 r834  
    5252
    5353    Node operator()(int ix) const { return Node(ix); }
    54     int index(const Node& node) const { return node._id; }
     54    static int index(const Node& node) { return node._id; }
    5555
    5656    Arc arc(const Node& s, const Node& t) const {
     
    163163  /// only in the concept class.
    164164  ///
     165  /// This class provides constant time counting for nodes and arcs.
     166  ///
    165167  /// \note FullDigraph and FullGraph classes are very similar,
    166168  /// but there are two differences. While this class conforms only
     
    205207    /// completely static, the nodes can be indexed with integers from
    206208    /// the range <tt>[0..nodeNum()-1]</tt>.
     209    /// The index of a node is the same as its ID.
    207210    /// \sa index()
    208211    Node operator()(int ix) const { return Parent::operator()(ix); }
     
    213216    /// completely static, the nodes can be indexed with integers from
    214217    /// the range <tt>[0..nodeNum()-1]</tt>.
     218    /// The index of a node is the same as its ID.
    215219    /// \sa operator()()
    216     int index(Node node) const { return Parent::index(node); }
     220    static int index(const Node& node) { return Parent::index(node); }
    217221
    218222    /// \brief Returns the arc connecting the given nodes.
     
    288292
    289293    Node operator()(int ix) const { return Node(ix); }
    290     int index(const Node& node) const { return node._id; }
     294    static int index(const Node& node) { return node._id; }
    291295
    292296    Edge edge(const Node& u, const Node& v) const {
     
    536540  /// only in the concept class.
    537541  ///
     542  /// This class provides constant time counting for nodes, edges and arcs.
     543  ///
    538544  /// \note FullDigraph and FullGraph classes are very similar,
    539545  /// but there are two differences. While FullDigraph
     
    580586    /// completely static, the nodes can be indexed with integers from
    581587    /// the range <tt>[0..nodeNum()-1]</tt>.
     588    /// The index of a node is the same as its ID.
    582589    /// \sa index()
    583590    Node operator()(int ix) const { return Parent::operator()(ix); }
     
    588595    /// completely static, the nodes can be indexed with integers from
    589596    /// the range <tt>[0..nodeNum()-1]</tt>.
     597    /// The index of a node is the same as its ID.
    590598    /// \sa operator()()
    591     int index(Node node) const { return Parent::index(node); }
     599    static int index(const Node& node) { return Parent::index(node); }
    592600
    593601    /// \brief Returns the arc connecting the given nodes.
  • lemon/grid_graph.h

    r782 r834  
    504504  /// Most of its member functions and nested classes are documented
    505505  /// only in the concept class.
     506  ///
     507  /// This class provides constant time counting for nodes, edges and arcs.
    506508  class GridGraph : public ExtendedGridGraphBase {
    507509    typedef ExtendedGridGraphBase Parent;
  • lemon/hypercube_graph.h

    r833 r835  
    263263    }
    264264
    265     int index(Node node) const {
     265    static int index(Node node) {
    266266      return node._id;
    267267    }
     
    295295  /// only in the concept class.
    296296  ///
     297  /// This class provides constant time counting for nodes, edges and arcs.
     298  ///
    297299  /// \note The type of the indices is chosen to \c int for efficiency
    298300  /// reasons. Thus the maximum dimension of this implementation is 26
     
    357359    /// Gives back the index of the given node.
    358360    /// The lower bits of the integer describes the node.
    359     int index(Node node) const {
     361    static int index(Node node) {
    360362      return Parent::index(node);
    361363    }
  • lemon/list_graph.h

    r833 r835  
    325325  ///only in the concept class.
    326326  ///
     327  ///This class provides only linear time counting for nodes and arcs.
     328  ///
    327329  ///\sa concepts::Digraph
    328330  ///\sa ListGraph
     
    361363    ///\brief Erase a node from the digraph.
    362364    ///
    363     ///This function erases the given node from the digraph.
     365    ///This function erases the given node along with its outgoing and
     366    ///incoming arcs from the digraph.
     367    ///
     368    ///\note All iterators referencing the removed node or the connected
     369    ///arcs are invalidated, of course.
    364370    void erase(Node n) { Parent::erase(n); }
    365371
     
    367373    ///
    368374    ///This function erases the given arc from the digraph.
     375    ///
     376    ///\note All iterators referencing the removed arc are invalidated,
     377    ///of course.
    369378    void erase(Arc a) { Parent::erase(a); }
    370379
     
    511520    ///This function erases all nodes and arcs from the digraph.
    512521    ///
     522    ///\note All iterators of the digraph are invalidated, of course.
    513523    void clear() {
    514524      Parent::clear();
     
    11801190  ///only in the concept class.
    11811191  ///
     1192  ///This class provides only linear time counting for nodes, edges and arcs.
     1193  ///
    11821194  ///\sa concepts::Graph
    11831195  ///\sa ListDigraph
     
    12181230    ///\brief Erase a node from the graph.
    12191231    ///
    1220     /// This function erases the given node from the graph.
     1232    /// This function erases the given node along with its incident arcs
     1233    /// from the graph.
     1234    ///
     1235    /// \note All iterators referencing the removed node or the incident
     1236    /// edges are invalidated, of course.
    12211237    void erase(Node n) { Parent::erase(n); }
    12221238
     
    12241240    ///
    12251241    /// This function erases the given edge from the graph.
     1242    ///
     1243    /// \note All iterators referencing the removed edge are invalidated,
     1244    /// of course.
    12261245    void erase(Edge e) { Parent::erase(e); }
    12271246    /// Node validity check
     
    13131332    ///This function erases all nodes and arcs from the graph.
    13141333    ///
     1334    ///\note All iterators of the graph are invalidated, of course.
    13151335    void clear() {
    13161336      Parent::clear();
  • lemon/network_simplex.h

    r833 r835  
    4141  ///
    4242  /// \ref NetworkSimplex implements the primal Network Simplex algorithm
    43   /// for finding a \ref min_cost_flow "minimum cost flow".
     43  /// for finding a \ref min_cost_flow "minimum cost flow"
     44  /// \ref amo93networkflows, \ref dantzig63linearprog,
     45  /// \ref kellyoneill91netsimplex.
    4446  /// This algorithm is a specialized version of the linear programming
    4547  /// simplex method directly for the minimum cost flow problem.
  • lemon/path.h

    r606 r831  
    7171    template <typename CPath>
    7272    Path(const CPath& cpath) {
    73       copyPath(*this, cpath);
     73      pathCopy(cpath, *this);
    7474    }
    7575
     
    7979    template <typename CPath>
    8080    Path& operator=(const CPath& cpath) {
    81       copyPath(*this, cpath);
     81      pathCopy(cpath, *this);
    8282      return *this;
    8383    }
     
    259259    template <typename CPath>
    260260    SimplePath(const CPath& cpath) {
    261       copyPath(*this, cpath);
     261      pathCopy(cpath, *this);
    262262    }
    263263
     
    268268    template <typename CPath>
    269269    SimplePath& operator=(const CPath& cpath) {
    270       copyPath(*this, cpath);
     270      pathCopy(cpath, *this);
    271271      return *this;
    272272    }
     
    438438    template <typename CPath>
    439439    ListPath(const CPath& cpath) : first(0), last(0) {
    440       copyPath(*this, cpath);
     440      pathCopy(cpath, *this);
    441441    }
    442442
     
    454454    template <typename CPath>
    455455    ListPath& operator=(const CPath& cpath) {
    456       copyPath(*this, cpath);
     456      pathCopy(cpath, *this);
    457457      return *this;
    458458    }
     
    764764    template <typename CPath>
    765765    StaticPath(const CPath& cpath) : arcs(0) {
    766       copyPath(*this, cpath);
     766      pathCopy(cpath, *this);
    767767    }
    768768
     
    780780    template <typename CPath>
    781781    StaticPath& operator=(const CPath& cpath) {
    782       copyPath(*this, cpath);
     782      pathCopy(cpath, *this);
    783783      return *this;
    784784    }
     
    929929    };
    930930
    931     template <typename Target, typename Source,
    932               bool buildEnable = BuildTagIndicator<Target>::value>
     931    template <typename From, typename To,
     932              bool buildEnable = BuildTagIndicator<To>::value>
    933933    struct PathCopySelectorForward {
    934       static void copy(Target& target, const Source& source) {
    935         target.clear();
    936         for (typename Source::ArcIt it(source); it != INVALID; ++it) {
    937           target.addBack(it);
     934      static void copy(const From& from, To& to) {
     935        to.clear();
     936        for (typename From::ArcIt it(from); it != INVALID; ++it) {
     937          to.addBack(it);
    938938        }
    939939      }
    940940    };
    941941
    942     template <typename Target, typename Source>
    943     struct PathCopySelectorForward<Target, Source, true> {
    944       static void copy(Target& target, const Source& source) {
    945         target.clear();
    946         target.build(source);
    947       }
    948     };
    949 
    950     template <typename Target, typename Source,
    951               bool buildEnable = BuildTagIndicator<Target>::value>
     942    template <typename From, typename To>
     943    struct PathCopySelectorForward<From, To, true> {
     944      static void copy(const From& from, To& to) {
     945        to.clear();
     946        to.build(from);
     947      }
     948    };
     949
     950    template <typename From, typename To,
     951              bool buildEnable = BuildTagIndicator<To>::value>
    952952    struct PathCopySelectorBackward {
    953       static void copy(Target& target, const Source& source) {
    954         target.clear();
    955         for (typename Source::RevArcIt it(source); it != INVALID; ++it) {
    956           target.addFront(it);
     953      static void copy(const From& from, To& to) {
     954        to.clear();
     955        for (typename From::RevArcIt it(from); it != INVALID; ++it) {
     956          to.addFront(it);
    957957        }
    958958      }
    959959    };
    960960
    961     template <typename Target, typename Source>
    962     struct PathCopySelectorBackward<Target, Source, true> {
    963       static void copy(Target& target, const Source& source) {
    964         target.clear();
    965         target.buildRev(source);
     961    template <typename From, typename To>
     962    struct PathCopySelectorBackward<From, To, true> {
     963      static void copy(const From& from, To& to) {
     964        to.clear();
     965        to.buildRev(from);
    966966      }
    967967    };
    968968
    969969   
    970     template <typename Target, typename Source,
    971               bool revEnable = RevPathTagIndicator<Source>::value>
     970    template <typename From, typename To,
     971              bool revEnable = RevPathTagIndicator<From>::value>
    972972    struct PathCopySelector {
    973       static void copy(Target& target, const Source& source) {
    974         PathCopySelectorForward<Target, Source>::copy(target, source);
     973      static void copy(const From& from, To& to) {
     974        PathCopySelectorForward<From, To>::copy(from, to);
    975975      }     
    976976    };
    977977
    978     template <typename Target, typename Source>
    979     struct PathCopySelector<Target, Source, true> {
    980       static void copy(Target& target, const Source& source) {
    981         PathCopySelectorBackward<Target, Source>::copy(target, source);
     978    template <typename From, typename To>
     979    struct PathCopySelector<From, To, true> {
     980      static void copy(const From& from, To& to) {
     981        PathCopySelectorBackward<From, To>::copy(from, to);
    982982      }     
    983983    };
     
    988988  /// \brief Make a copy of a path.
    989989  ///
    990   ///  This function makes a copy of a path.
    991   template <typename Target, typename Source>
    992   void copyPath(Target& target, const Source& source) {
    993     checkConcept<concepts::PathDumper<typename Source::Digraph>, Source>();
    994     _path_bits::PathCopySelector<Target, Source>::copy(target, source);
     990  /// This function makes a copy of a path.
     991  template <typename From, typename To>
     992  void pathCopy(const From& from, To& to) {
     993    checkConcept<concepts::PathDumper<typename From::Digraph>, From>();
     994    _path_bits::PathCopySelector<From, To>::copy(from, to);
     995  }
     996
     997  /// \brief Deprecated version of \ref pathCopy().
     998  ///
     999  /// Deprecated version of \ref pathCopy() (only for reverse compatibility).
     1000  template <typename To, typename From>
     1001  void copyPath(To& to, const From& from) {
     1002    pathCopy(from, to);
    9951003  }
    9961004
     
    10161024  /// \brief The source of a path
    10171025  ///
    1018   /// This function returns the source of the given path.
     1026  /// This function returns the source node of the given path.
     1027  /// If the path is empty, then it returns \c INVALID.
    10191028  template <typename Digraph, typename Path>
    10201029  typename Digraph::Node pathSource(const Digraph& digraph, const Path& path) {
    1021     return digraph.source(path.front());
     1030    return path.empty() ? INVALID : digraph.source(path.front());
    10221031  }
    10231032
    10241033  /// \brief The target of a path
    10251034  ///
    1026   /// This function returns the target of the given path.
     1035  /// This function returns the target node of the given path.
     1036  /// If the path is empty, then it returns \c INVALID.
    10271037  template <typename Digraph, typename Path>
    10281038  typename Digraph::Node pathTarget(const Digraph& digraph, const Path& path) {
    1029     return digraph.target(path.back());
     1039    return path.empty() ? INVALID : digraph.target(path.back());
    10301040  }
    10311041
  • lemon/preflow.h

    r833 r835  
    103103  /// This class provides an implementation of Goldberg-Tarjan's \e preflow
    104104  /// \e push-relabel algorithm producing a \ref max_flow
    105   /// "flow of maximum value" in a digraph.
     105  /// "flow of maximum value" in a digraph \ref clrs01algorithms,
     106  /// \ref amo93networkflows, \ref goldberg88newapproach.
    106107  /// The preflow algorithms are the fastest known maximum
    107108  /// flow algorithms. The current implementation uses a mixture of the
  • lemon/smart_graph.h

    r783 r834  
    195195  ///only in the concept class.
    196196  ///
     197  ///This class provides constant time counting for nodes and arcs.
     198  ///
    197199  ///\sa concepts::Digraph
    198200  ///\sa SmartGraph
     
    498500    }
    499501
    500     void next(Node& node) const {
     502    static void next(Node& node) {
    501503      --node._id;
    502504    }
     
    506508    }
    507509
    508     void next(Arc& arc) const {
     510    static void next(Arc& arc) {
    509511      --arc._id;
    510512    }
     
    514516    }
    515517
    516     void next(Edge& arc) const {
     518    static void next(Edge& arc) {
    517519      --arc._id;
    518520    }
     
    620622  /// Most of its member functions and nested classes are documented
    621623  /// only in the concept class.
     624  ///
     625  /// This class provides constant time counting for nodes, edges and arcs.
    622626  ///
    623627  /// \sa concepts::Graph
  • scripts/bib2dox.py

    r792 r801  
    7171author_rex = re.compile('\s+and\s+')
    7272rembraces_rex = re.compile('[{}]')
    73 capitalize_rex = re.compile('({\w*})')
     73capitalize_rex = re.compile('({[^}]*})')
    7474
    7575# used by bibtexkeywords(data)
     
    364364            if entrycont.has_key('note') and (entrycont['note'] != ''):
    365365                entry.append(entrycont['note'] + '.')
     366            if entrycont.has_key('url') and (entrycont['url'] != ''):
     367                entry.append(entrycont['url'] + '.')
    366368
    367369            # generate keys for sorting and for the output
     
    411413                field = string.lower(field)
    412414                data =  data_rex.sub('\g<2>', line)
     415
     416            if field == 'url':
     417                data = '\\url{' + data.strip() + '}'
    413418           
    414419            if field in ('author', 'editor'):
  • test/CMakeLists.txt

    r745 r817  
    3333  min_cost_arborescence_test
    3434  min_cost_flow_test
     35  min_mean_cycle_test
    3536  path_test
    3637  preflow_test
  • test/Makefile.am

    r745 r817  
    3131        test/min_cost_arborescence_test \
    3232        test/min_cost_flow_test \
     33        test/min_mean_cycle_test \
    3334        test/path_test \
    3435        test/preflow_test \
     
    7980test_min_cost_arborescence_test_SOURCES = test/min_cost_arborescence_test.cc
    8081test_min_cost_flow_test_SOURCES = test/min_cost_flow_test.cc
     82test_min_mean_cycle_test_SOURCES = test/min_mean_cycle_test.cc
    8183test_path_test_SOURCES = test/path_test.cc
    8284test_preflow_test_SOURCES = test/preflow_test.cc
  • test/adaptors_test.cc

    r488 r550  
    13721372
    13731373  GridGraph::EdgeMap<bool> dir_map(graph);
    1374   dir_map[graph.right(n1)] = graph.u(graph.right(n1)) == n1;
    1375   dir_map[graph.up(n1)] = graph.u(graph.up(n1)) != n1;
    1376   dir_map[graph.left(n4)] = graph.u(graph.left(n4)) != n4;
    1377   dir_map[graph.down(n4)] = graph.u(graph.down(n4)) != n4;
     1374  dir_map[graph.right(n1)] = graph.u(graph.right(n1)) != n1;
     1375  dir_map[graph.up(n1)] = graph.u(graph.up(n1)) == n1;
     1376  dir_map[graph.left(n4)] = graph.u(graph.left(n4)) == n4;
     1377  dir_map[graph.down(n4)] = graph.u(graph.down(n4)) == n4;
    13781378
    13791379  // Apply several adaptors on the grid graph
    1380   typedef SplitNodes< ReverseDigraph< const Orienter<
    1381             const GridGraph, GridGraph::EdgeMap<bool> > > >
    1382     RevSplitGridGraph;
    1383   typedef ReverseDigraph<const RevSplitGridGraph> SplitGridGraph;
     1380  typedef SplitNodes<Orienter< const GridGraph, GridGraph::EdgeMap<bool> > >
     1381    SplitGridGraph;
    13841382  typedef Undirector<const SplitGridGraph> USplitGridGraph;
    1385   typedef Undirector<const USplitGridGraph> UUSplitGridGraph;
    1386   checkConcept<concepts::Digraph, RevSplitGridGraph>();
    13871383  checkConcept<concepts::Digraph, SplitGridGraph>();
    13881384  checkConcept<concepts::Graph, USplitGridGraph>();
    1389   checkConcept<concepts::Graph, UUSplitGridGraph>();
    1390 
    1391   RevSplitGridGraph rev_adaptor =
    1392     splitNodes(reverseDigraph(orienter(graph, dir_map)));
    1393   SplitGridGraph adaptor = reverseDigraph(rev_adaptor);
     1385
     1386  SplitGridGraph adaptor = splitNodes(orienter(graph, dir_map));
    13941387  USplitGridGraph uadaptor = undirector(adaptor);
    1395   UUSplitGridGraph uuadaptor = undirector(uadaptor);
    13961388
    13971389  // Check adaptor
     
    14001392  checkGraphConArcList(adaptor, 8);
    14011393
    1402   checkGraphOutArcList(adaptor, rev_adaptor.inNode(n1), 1);
    1403   checkGraphOutArcList(adaptor, rev_adaptor.outNode(n1), 1);
    1404   checkGraphOutArcList(adaptor, rev_adaptor.inNode(n2), 2);
    1405   checkGraphOutArcList(adaptor, rev_adaptor.outNode(n2), 1);
    1406   checkGraphOutArcList(adaptor, rev_adaptor.inNode(n3), 1);
    1407   checkGraphOutArcList(adaptor, rev_adaptor.outNode(n3), 1);
    1408   checkGraphOutArcList(adaptor, rev_adaptor.inNode(n4), 0);
    1409   checkGraphOutArcList(adaptor, rev_adaptor.outNode(n4), 1);
    1410 
    1411   checkGraphInArcList(adaptor, rev_adaptor.inNode(n1), 1);
    1412   checkGraphInArcList(adaptor, rev_adaptor.outNode(n1), 1);
    1413   checkGraphInArcList(adaptor, rev_adaptor.inNode(n2), 1);
    1414   checkGraphInArcList(adaptor, rev_adaptor.outNode(n2), 0);
    1415   checkGraphInArcList(adaptor, rev_adaptor.inNode(n3), 1);
    1416   checkGraphInArcList(adaptor, rev_adaptor.outNode(n3), 1);
    1417   checkGraphInArcList(adaptor, rev_adaptor.inNode(n4), 1);
    1418   checkGraphInArcList(adaptor, rev_adaptor.outNode(n4), 2);
     1394  checkGraphOutArcList(adaptor, adaptor.inNode(n1), 1);
     1395  checkGraphOutArcList(adaptor, adaptor.outNode(n1), 1);
     1396  checkGraphOutArcList(adaptor, adaptor.inNode(n2), 1);
     1397  checkGraphOutArcList(adaptor, adaptor.outNode(n2), 0);
     1398  checkGraphOutArcList(adaptor, adaptor.inNode(n3), 1);
     1399  checkGraphOutArcList(adaptor, adaptor.outNode(n3), 1);
     1400  checkGraphOutArcList(adaptor, adaptor.inNode(n4), 1);
     1401  checkGraphOutArcList(adaptor, adaptor.outNode(n4), 2);
     1402
     1403  checkGraphInArcList(adaptor, adaptor.inNode(n1), 1);
     1404  checkGraphInArcList(adaptor, adaptor.outNode(n1), 1);
     1405  checkGraphInArcList(adaptor, adaptor.inNode(n2), 2);
     1406  checkGraphInArcList(adaptor, adaptor.outNode(n2), 1);
     1407  checkGraphInArcList(adaptor, adaptor.inNode(n3), 1);
     1408  checkGraphInArcList(adaptor, adaptor.outNode(n3), 1);
     1409  checkGraphInArcList(adaptor, adaptor.inNode(n4), 0);
     1410  checkGraphInArcList(adaptor, adaptor.outNode(n4), 1);
    14191411
    14201412  checkNodeIds(adaptor);
     
    14391431  checkGraphArcMap(uadaptor);
    14401432
    1441   checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n1), 2);
    1442   checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n1), 2);
    1443   checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n2), 3);
    1444   checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n2), 1);
    1445   checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n3), 2);
    1446   checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n3), 2);
    1447   checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n4), 1);
    1448   checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n4), 3);
    1449 
    1450   // Check uuadaptor
    1451   checkGraphNodeList(uuadaptor, 8);
    1452   checkGraphEdgeList(uuadaptor, 16);
    1453   checkGraphArcList(uuadaptor, 32);
    1454   checkGraphConEdgeList(uuadaptor, 16);
    1455   checkGraphConArcList(uuadaptor, 32);
    1456 
    1457   checkNodeIds(uuadaptor);
    1458   checkEdgeIds(uuadaptor);
    1459   checkArcIds(uuadaptor);
    1460 
    1461   checkGraphNodeMap(uuadaptor);
    1462   checkGraphEdgeMap(uuadaptor);
    1463   checkGraphArcMap(uuadaptor);
     1433  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n1), 2);
     1434  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n1), 2);
     1435  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n2), 3);
     1436  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n2), 1);
     1437  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n3), 2);
     1438  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n3), 2);
     1439  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n4), 1);
     1440  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n4), 3);
    14641441}
    14651442
  • test/bellman_ford_test.cc

    r746 r828  
    9797    p  = const_bf_test.predMap();
    9898    pp = const_bf_test.path(t);
     99    pp = const_bf_test.negativeCycle();
    99100   
    100101    for (BF::ActiveIt it(const_bf_test); it != INVALID; ++it) {}
     
    133134    b  = bf_test.reached(t);
    134135    pp = bf_test.path(t);
     136    pp = bf_test.negativeCycle();
    135137  }
    136138}
  • test/digraph_test.cc

    r787 r827  
    2020#include <lemon/list_graph.h>
    2121#include <lemon/smart_graph.h>
     22#include <lemon/static_graph.h>
    2223#include <lemon/full_graph.h>
    2324
     
    329330    checkConcept<ClearableDigraphComponent<>, SmartDigraph>();
    330331  }
     332  { // Checking StaticDigraph
     333    checkConcept<Digraph, StaticDigraph>();
     334    checkConcept<ClearableDigraphComponent<>, StaticDigraph>();
     335  }
    331336  { // Checking FullDigraph
    332337    checkConcept<Digraph, FullDigraph>();
     
    382387  check(!g.valid(g.nodeFromId(-1)), "Wrong validity check");
    383388  check(!g.valid(g.arcFromId(-1)), "Wrong validity check");
     389}
     390
     391void checkStaticDigraph() {
     392  SmartDigraph g;
     393  SmartDigraph::NodeMap<StaticDigraph::Node> nref(g);
     394  SmartDigraph::ArcMap<StaticDigraph::Arc> aref(g);
     395 
     396  StaticDigraph G;
     397 
     398  checkGraphNodeList(G, 0);
     399  checkGraphArcList(G, 0);
     400
     401  G.build(g, nref, aref);
     402
     403  checkGraphNodeList(G, 0);
     404  checkGraphArcList(G, 0);
     405
     406  SmartDigraph::Node
     407    n1 = g.addNode(),
     408    n2 = g.addNode(),
     409    n3 = g.addNode();
     410
     411  G.build(g, nref, aref);
     412
     413  checkGraphNodeList(G, 3);
     414  checkGraphArcList(G, 0);
     415
     416  SmartDigraph::Arc a1 = g.addArc(n1, n2);
     417
     418  G.build(g, nref, aref);
     419
     420  check(G.source(aref[a1]) == nref[n1] && G.target(aref[a1]) == nref[n2],
     421        "Wrong arc or wrong references");
     422  checkGraphNodeList(G, 3);
     423  checkGraphArcList(G, 1);
     424
     425  checkGraphOutArcList(G, nref[n1], 1);
     426  checkGraphOutArcList(G, nref[n2], 0);
     427  checkGraphOutArcList(G, nref[n3], 0);
     428
     429  checkGraphInArcList(G, nref[n1], 0);
     430  checkGraphInArcList(G, nref[n2], 1);
     431  checkGraphInArcList(G, nref[n3], 0);
     432
     433  checkGraphConArcList(G, 1);
     434
     435  SmartDigraph::Arc
     436    a2 = g.addArc(n2, n1),
     437    a3 = g.addArc(n2, n3),
     438    a4 = g.addArc(n2, n3);
     439
     440  digraphCopy(g, G).nodeRef(nref).run();
     441
     442  checkGraphNodeList(G, 3);
     443  checkGraphArcList(G, 4);
     444
     445  checkGraphOutArcList(G, nref[n1], 1);
     446  checkGraphOutArcList(G, nref[n2], 3);
     447  checkGraphOutArcList(G, nref[n3], 0);
     448
     449  checkGraphInArcList(G, nref[n1], 1);
     450  checkGraphInArcList(G, nref[n2], 1);
     451  checkGraphInArcList(G, nref[n3], 2);
     452
     453  checkGraphConArcList(G, 4);
     454
     455  std::vector<std::pair<int,int> > arcs;
     456  arcs.push_back(std::make_pair(0,1));
     457  arcs.push_back(std::make_pair(0,2));
     458  arcs.push_back(std::make_pair(1,3));
     459  arcs.push_back(std::make_pair(1,2));
     460  arcs.push_back(std::make_pair(3,0));
     461  arcs.push_back(std::make_pair(3,3));
     462  arcs.push_back(std::make_pair(4,2));
     463  arcs.push_back(std::make_pair(4,3));
     464  arcs.push_back(std::make_pair(4,1));
     465
     466  G.build(6, arcs.begin(), arcs.end());
     467 
     468  checkGraphNodeList(G, 6);
     469  checkGraphArcList(G, 9);
     470
     471  checkGraphOutArcList(G, G.node(0), 2);
     472  checkGraphOutArcList(G, G.node(1), 2);
     473  checkGraphOutArcList(G, G.node(2), 0);
     474  checkGraphOutArcList(G, G.node(3), 2);
     475  checkGraphOutArcList(G, G.node(4), 3);
     476  checkGraphOutArcList(G, G.node(5), 0);
     477
     478  checkGraphInArcList(G, G.node(0), 1);
     479  checkGraphInArcList(G, G.node(1), 2);
     480  checkGraphInArcList(G, G.node(2), 3);
     481  checkGraphInArcList(G, G.node(3), 3);
     482  checkGraphInArcList(G, G.node(4), 0);
     483  checkGraphInArcList(G, G.node(5), 0);
     484
     485  checkGraphConArcList(G, 9);
     486
     487  checkNodeIds(G);
     488  checkArcIds(G);
     489  checkGraphNodeMap(G);
     490  checkGraphArcMap(G);
     491 
     492  int n = G.nodeNum();
     493  int m = G.arcNum();
     494  check(G.index(G.node(n-1)) == n-1, "Wrong index.");
     495  check(G.index(G.arc(m-1)) == m-1, "Wrong index.");
    384496}
    385497
     
    436548    checkDigraphValidity<SmartDigraph>();
    437549  }
     550  { // Checking StaticDigraph
     551    checkStaticDigraph();
     552  }
    438553  { // Checking FullDigraph
    439554    checkFullDigraph(8);
  • test/test_tools.h

    r463 r810  
    3838///print something like this (and then exits).
    3939///\verbatim file_name.cc:123: error: This is obviously false. \endverbatim
    40 #define check(rc, msg) \
    41   if(!(rc)) { \
    42     std::cerr << __FILE__ ":" << __LINE__ << ": error: " << msg << std::endl; \
    43     abort(); \
    44   } else { } \
     40#define check(rc, msg)                                                  \
     41  {                                                                     \
     42    if(!(rc)) {                                                         \
     43      std::cerr << __FILE__ ":" << __LINE__ << ": error: "              \
     44                << msg << std::endl;                                    \
     45      abort();                                                          \
     46    } else { }                                                          \
     47  }                                                                     \
     48   
    4549
    4650#endif
Note: See TracChangeset for help on using the changeset viewer.