COIN-OR::LEMON - Graph Library

Ignore:
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • doc/groups.dox

    r844 r710  
    227227
    228228/**
     229@defgroup matrices Matrices
     230@ingroup datas
     231\brief Two dimensional data storages implemented in LEMON.
     232
     233This group contains two dimensional data storages implemented in LEMON.
     234*/
     235
     236/**
    229237@defgroup paths Path Structures
    230238@ingroup datas
     
    276284This group contains the algorithms for finding shortest paths in digraphs.
    277285
    278  - \ref Dijkstra Dijkstra's algorithm for finding shortest paths from a
    279    source node when all arc lengths are non-negative.
     286 - \ref Dijkstra algorithm for finding shortest paths from a source node
     287   when all arc lengths are non-negative.
     288 - \ref BellmanFord "Bellman-Ford" algorithm for finding shortest paths
     289   from a source node when arc lenghts can be either positive or negative,
     290   but the digraph should not contain directed cycles with negative total
     291   length.
     292 - \ref FloydWarshall "Floyd-Warshall" and \ref Johnson "Johnson" algorithms
     293   for solving the \e all-pairs \e shortest \e paths \e problem when arc
     294   lenghts can be either positive or negative, but the digraph should
     295   not contain directed cycles with negative total length.
    280296 - \ref Suurballe A successive shortest path algorithm for finding
    281297   arc-disjoint paths between two nodes having minimum total length.
     
    302318\f[ 0 \leq f(uv) \leq cap(uv) \quad \forall uv\in A \f]
    303319
    304 \ref Preflow implements the preflow push-relabel algorithm of Goldberg and
    305 Tarjan for solving this problem. It also provides functions to query the
    306 minimum cut, which is the dual problem of maximum flow.
    307 
     320LEMON contains several algorithms for solving maximum flow problems:
     321- \ref EdmondsKarp Edmonds-Karp algorithm.
     322- \ref Preflow Goldberg-Tarjan's preflow push-relabel algorithm.
     323- \ref DinitzSleatorTarjan Dinitz's blocking flow algorithm with dynamic trees.
     324- \ref GoldbergTarjan Preflow push-relabel algorithm with dynamic trees.
     325
     326In most cases the \ref Preflow "Preflow" algorithm provides the
     327fastest method for computing a maximum flow. All implementations
     328also provide functions to query the minimum cut, which is the dual
     329problem of maximum flow.
    308330
    309331\ref Circulation is a preflow push-relabel algorithm implemented directly
     
    323345solution see \ref min_cost_flow "Minimum Cost Flow Problem".
    324346
    325 \ref NetworkSimplex is an efficient implementation of the primal Network
    326 Simplex algorithm for finding minimum cost flows. It also provides dual
    327 solution (node potentials), if an optimal flow is found.
     347LEMON contains several algorithms for this problem.
     348 - \ref NetworkSimplex Primal Network Simplex algorithm with various
     349   pivot strategies.
     350 - \ref CostScaling Push-Relabel and Augment-Relabel algorithms based on
     351   cost scaling.
     352 - \ref CapacityScaling Successive Shortest %Path algorithm with optional
     353   capacity scaling.
     354 - \ref CancelAndTighten The Cancel and Tighten algorithm.
     355 - \ref CycleCanceling Cycle-Canceling algorithms.
     356
     357In general NetworkSimplex is the most efficient implementation,
     358but in special cases other algorithms could be faster.
     359For example, if the total supply and/or capacities are rather small,
     360CapacityScaling is usually the fastest algorithm (without effective scaling).
    328361*/
    329362
     
    349382- \ref HaoOrlin "Hao-Orlin algorithm" for calculating minimum cut
    350383  in directed graphs.
     384- \ref NagamochiIbaraki "Nagamochi-Ibaraki algorithm" for
     385  calculating minimum cut in undirected graphs.
    351386- \ref GomoryHu "Gomory-Hu tree computation" for calculating
    352387  all-pairs minimum cut in undirected graphs.
     
    369404
    370405/**
     406@defgroup planar Planarity Embedding and Drawing
     407@ingroup algs
     408\brief Algorithms for planarity checking, embedding and drawing
     409
     410This group contains the algorithms for planarity checking,
     411embedding and drawing.
     412
     413\image html planar.png
     414\image latex planar.eps "Plane graph" width=\textwidth
     415*/
     416
     417/**
    371418@defgroup matching Matching Algorithms
    372419@ingroup algs
    373420\brief Algorithms for finding matchings in graphs and bipartite graphs.
    374421
    375 This group contains the algorithms for calculating matchings in graphs.
    376 The general matching problem is finding a subset of the edges for which
    377 each node has at most one incident edge.
     422This group contains the algorithms for calculating
     423matchings in graphs and bipartite graphs. The general matching problem is
     424finding a subset of the edges for which each node has at most one incident
     425edge.
    378426
    379427There are several different algorithms for calculate matchings in
    380 graphs. The goal of the matching optimization
     428graphs.  The matching problems in bipartite graphs are generally
     429easier than in general graphs. The goal of the matching optimization
    381430can be finding maximum cardinality, maximum weight or minimum cost
    382431matching. The search can be constrained to find perfect or
     
    384433
    385434The matching algorithms implemented in LEMON:
     435- \ref MaxBipartiteMatching Hopcroft-Karp augmenting path algorithm
     436  for calculating maximum cardinality matching in bipartite graphs.
     437- \ref PrBipartiteMatching Push-relabel algorithm
     438  for calculating maximum cardinality matching in bipartite graphs.
     439- \ref MaxWeightedBipartiteMatching
     440  Successive shortest path algorithm for calculating maximum weighted
     441  matching and maximum weighted bipartite matching in bipartite graphs.
     442- \ref MinCostMaxBipartiteMatching
     443  Successive shortest path algorithm for calculating minimum cost maximum
     444  matching in bipartite graphs.
    386445- \ref MaxMatching Edmond's blossom shrinking algorithm for calculating
    387446  maximum cardinality matching in general graphs.
     
    415474
    416475/**
     476@defgroup approx Approximation Algorithms
     477@ingroup algs
     478\brief Approximation algorithms.
     479
     480This group contains the approximation and heuristic algorithms
     481implemented in LEMON.
     482*/
     483
     484/**
    417485@defgroup gen_opt_group General Optimization Tools
    418486\brief This group contains some general optimization frameworks
     
    431499various LP solvers could be used in the same manner with this
    432500interface.
     501*/
     502
     503/**
     504@defgroup lp_utils Tools for Lp and Mip Solvers
     505@ingroup lp_group
     506\brief Helper tools to the Lp and Mip solvers.
     507
     508This group adds some helper tools to general optimization framework
     509implemented in LEMON.
     510*/
     511
     512/**
     513@defgroup metah Metaheuristics
     514@ingroup gen_opt_group
     515\brief Metaheuristics for LEMON library.
     516
     517This group contains some metaheuristic optimization tools.
    433518*/
    434519
  • lemon/Makefile.am

    r850 r714  
    9191        lemon/lp_base.h \
    9292        lemon/lp_skeleton.h \
     93        lemon/list_graph.h \
    9394        lemon/maps.h \
    9495        lemon/matching.h \
  • lemon/bits/edge_set_extender.h

    r732 r664  
    538538
    539539    public:
    540       explicit ArcMap(const Graph& _g)
     540      ArcMap(const Graph& _g)
    541541        : Parent(_g) {}
    542542      ArcMap(const Graph& _g, const _Value& _v)
     
    562562
    563563    public:
    564       explicit EdgeMap(const Graph& _g)
     564      EdgeMap(const Graph& _g)
    565565        : Parent(_g) {}
    566566
  • lemon/bits/graph_extender.h

    r732 r664  
    605605
    606606    public:
    607       explicit NodeMap(const Graph& graph)
     607      NodeMap(const Graph& graph)
    608608        : Parent(graph) {}
    609609      NodeMap(const Graph& graph, const _Value& value)
     
    629629
    630630    public:
    631       explicit ArcMap(const Graph& graph)
     631      ArcMap(const Graph& graph)
    632632        : Parent(graph) {}
    633633      ArcMap(const Graph& graph, const _Value& value)
     
    653653
    654654    public:
    655       explicit EdgeMap(const Graph& graph)
     655      EdgeMap(const Graph& graph)
    656656        : Parent(graph) {}
    657657
  • lemon/maps.h

    r731 r664  
    19031903
    19041904  /// This class provides simple invertable graph maps.
    1905   /// It wraps a standard graph map (\c NodeMap, \c ArcMap or \c EdgeMap)
    1906   /// and if a key is set to a new value, then stores it in the inverse map.
     1905  /// It wraps an arbitrary \ref concepts::ReadWriteMap "ReadWriteMap"
     1906  /// and if a key is set to a new value then store it
     1907  /// in the inverse map.
     1908  ///
    19071909  /// The values of the map can be accessed
    19081910  /// with stl compatible forward iterator.
    1909   ///
    1910   /// This type is not reference map, so it cannot be modified with
    1911   /// the subscript operator.
    19121911  ///
    19131912  /// \tparam GR The graph type.
     
    19251924      template Map<V>::Type Map;
    19261925
    1927     typedef std::multimap<V, K> Container;
     1926    typedef std::map<V, K> Container;
    19281927    Container _inv_map;
    19291928
     
    19501949    /// iterator on the values of the map. The values can
    19511950    /// be accessed in the <tt>[beginValue, endValue)</tt> range.
    1952     /// They are considered with multiplicity, so each value is
    1953     /// traversed for each item it is assigned to.
    19541951    class ValueIterator
    19551952      : public std::iterator<std::forward_iterator_tag, Value> {
     
    20042001    void set(const Key& key, const Value& val) {
    20052002      Value oldval = Map::operator[](key);
    2006       typename Container::iterator it;
    2007       for (it = _inv_map.equal_range(oldval).first;
    2008            it != _inv_map.equal_range(oldval).second; ++it) {
    2009         if (it->second == key) {
    2010           _inv_map.erase(it);
    2011           break;
    2012         }
     2003      typename Container::iterator it = _inv_map.find(oldval);
     2004      if (it != _inv_map.end() && it->second == key) {
     2005        _inv_map.erase(it);
    20132006      }
    2014       _inv_map.insert(std::make_pair(val, key));
     2007      _inv_map.insert(make_pair(val, key));
    20152008      Map::set(key, val);
    20162009    }
     
    20242017    }
    20252018
    2026     /// \brief Gives back an item by its value.
    2027     ///
    2028     /// This function gives back an item that is assigned to
    2029     /// the given value or \c INVALID if no such item exists.
    2030     /// If there are more items with the same associated value,
    2031     /// only one of them is returned.
    2032     Key operator()(const Value& val) const {
    2033       typename Container::const_iterator it = _inv_map.find(val);
     2019    /// \brief Gives back the item by its value.
     2020    ///
     2021    /// Gives back the item by its value.
     2022    Key operator()(const Value& key) const {
     2023      typename Container::const_iterator it = _inv_map.find(key);
    20342024      return it != _inv_map.end() ? it->second : INVALID;
    20352025    }
     
    20432033    virtual void erase(const Key& key) {
    20442034      Value val = Map::operator[](key);
    2045       typename Container::iterator it;
    2046       for (it = _inv_map.equal_range(val).first;
    2047            it != _inv_map.equal_range(val).second; ++it) {
    2048         if (it->second == key) {
    2049           _inv_map.erase(it);
    2050           break;
    2051         }
     2035      typename Container::iterator it = _inv_map.find(val);
     2036      if (it != _inv_map.end() && it->second == key) {
     2037        _inv_map.erase(it);
    20522038      }
    20532039      Map::erase(key);
     
    20612047      for (int i = 0; i < int(keys.size()); ++i) {
    20622048        Value val = Map::operator[](keys[i]);
    2063         typename Container::iterator it;
    2064         for (it = _inv_map.equal_range(val).first;
    2065              it != _inv_map.equal_range(val).second; ++it) {
    2066           if (it->second == keys[i]) {
    2067             _inv_map.erase(it);
    2068             break;
    2069           }
     2049        typename Container::iterator it = _inv_map.find(val);
     2050        if (it != _inv_map.end() && it->second == keys[i]) {
     2051          _inv_map.erase(it);
    20702052        }
    20712053      }
     
    21032085      /// \brief Subscript operator.
    21042086      ///
    2105       /// Subscript operator. It gives back an item
    2106       /// that is assigned to the given value or \c INVALID
    2107       /// if no such item exists.
     2087      /// Subscript operator. It gives back the item
     2088      /// that was last assigned to the given value.
    21082089      Value operator[](const Key& key) const {
    21092090        return _inverted(key);
  • lemon/suurballe.h

    r843 r670  
    4646  /// Note that this problem is a special case of the \ref min_cost_flow
    4747  /// "minimum cost flow problem". This implementation is actually an
    48   /// efficient specialized version of the Successive Shortest Path
    49   /// algorithm directly for this problem.
     48  /// efficient specialized version of the \ref CapacityScaling
     49  /// "Successive Shortest Path" algorithm directly for this problem.
    5050  /// Therefore this class provides query functions for flow values and
    5151  /// node potentials (the dual solution) just like the minimum cost flow
  • test/maps_test.cc

    r731 r554  
    2323#include <lemon/concepts/maps.h>
    2424#include <lemon/maps.h>
    25 #include <lemon/list_graph.h>
    2625
    2726#include "test_tools.h"
     
    350349      check(v1[i++] == *it, "Something is wrong with LoggerBoolMap");
    351350  }
    352  
    353   // CrossRefMap
    354   {
    355     typedef ListDigraph Graph;
    356     DIGRAPH_TYPEDEFS(Graph);
    357 
    358     checkConcept<ReadWriteMap<Node, int>,
    359                  CrossRefMap<Graph, Node, int> >();
    360    
    361     Graph gr;
    362     typedef CrossRefMap<Graph, Node, char> CRMap;
    363     typedef CRMap::ValueIterator ValueIt;
    364     CRMap map(gr);
    365    
    366     Node n0 = gr.addNode();
    367     Node n1 = gr.addNode();
    368     Node n2 = gr.addNode();
    369    
    370     map.set(n0, 'A');
    371     map.set(n1, 'B');
    372     map.set(n2, 'C');
    373     map.set(n2, 'A');
    374     map.set(n0, 'C');
    375 
    376     check(map[n0] == 'C' && map[n1] == 'B' && map[n2] == 'A',
    377           "Wrong CrossRefMap");
    378     check(map('A') == n2 && map.inverse()['A'] == n2, "Wrong CrossRefMap");
    379     check(map('B') == n1 && map.inverse()['B'] == n1, "Wrong CrossRefMap");
    380     check(map('C') == n0 && map.inverse()['C'] == n0, "Wrong CrossRefMap");
    381 
    382     ValueIt it = map.beginValue();
    383     check(*it++ == 'A' && *it++ == 'B' && *it++ == 'C' &&
    384           it == map.endValue(), "Wrong value iterator");
    385   }
    386351
    387352  return 0;
Note: See TracChangeset for help on using the changeset viewer.