COIN-OR::LEMON - Graph Library

Ignore:
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • lemon/Makefile.am

    r733 r728  
    9393        lemon/lp_base.h \
    9494        lemon/lp_skeleton.h \
     95        lemon/list_graph.h \
    9596        lemon/maps.h \
    9697        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/circulation.h

    r736 r688  
    451451    }
    452452
    453     /// \brief Sets the tolerance used by the algorithm.
    454     ///
    455     /// Sets the tolerance object used by the algorithm.
    456     /// \return <tt>(*this)</tt>
    457     Circulation& tolerance(const Tolerance& tolerance) {
     453    /// \brief Sets the tolerance used by algorithm.
     454    ///
     455    /// Sets the tolerance used by algorithm.
     456    Circulation& tolerance(const Tolerance& tolerance) const {
    458457      _tol = tolerance;
    459458      return *this;
     
    462461    /// \brief Returns a const reference to the tolerance.
    463462    ///
    464     /// Returns a const reference to the tolerance object used by
    465     /// the algorithm.
     463    /// Returns a const reference to the tolerance.
    466464    const Tolerance& tolerance() const {
    467       return _tol;
     465      return tolerance;
    468466    }
    469467
  • lemon/maps.h

    r742 r741  
    19021902
    19031903  /// This class provides simple invertable graph maps.
    1904   /// It wraps a standard graph map (\c NodeMap, \c ArcMap or \c EdgeMap)
    1905   /// and if a key is set to a new value, then stores it in the inverse map.
     1904  /// It wraps an arbitrary \ref concepts::ReadWriteMap "ReadWriteMap"
     1905  /// and if a key is set to a new value then store it
     1906  /// in the inverse map.
    19061907  /// The values of the map can be accessed
    19071908  /// with stl compatible forward iterator.
    19081909  ///
    19091910  /// This type is not reference map, so it cannot be modified with
    1910   /// the subscript operator.
     1911  /// the subscription operator.
    19111912  ///
    19121913  /// \tparam GR The graph type.
     
    19241925      template Map<V>::Type Map;
    19251926
    1926     typedef std::multimap<V, K> Container;
     1927    typedef std::map<V, K> Container;
    19271928    Container _inv_map;
    19281929
     
    19491950    /// iterator on the values of the map. The values can
    19501951    /// be accessed in the <tt>[beginValue, endValue)</tt> range.
    1951     /// They are considered with multiplicity, so each value is
    1952     /// traversed for each item it is assigned to.
    19531952    class ValueIterator
    19541953      : public std::iterator<std::forward_iterator_tag, Value> {
     
    20032002    void set(const Key& key, const Value& val) {
    20042003      Value oldval = Map::operator[](key);
    2005       typename Container::iterator it;
    2006       for (it = _inv_map.equal_range(oldval).first;
    2007            it != _inv_map.equal_range(oldval).second; ++it) {
    2008         if (it->second == key) {
    2009           _inv_map.erase(it);
    2010           break;
    2011         }
     2004      typename Container::iterator it = _inv_map.find(oldval);
     2005      if (it != _inv_map.end() && it->second == key) {
     2006        _inv_map.erase(it);
    20122007      }
    20132008      _inv_map.insert(std::make_pair(val, key));
     
    20232018    }
    20242019
    2025     /// \brief Gives back an item by its value.
    2026     ///
    2027     /// This function gives back an item that is assigned to
    2028     /// the given value or \c INVALID if no such item exists.
    2029     /// If there are more items with the same associated value,
    2030     /// only one of them is returned.
    2031     Key operator()(const Value& val) const {
    2032       typename Container::const_iterator it = _inv_map.find(val);
     2020    /// \brief Gives back the item by its value.
     2021    ///
     2022    /// Gives back the item by its value.
     2023    Key operator()(const Value& key) const {
     2024      typename Container::const_iterator it = _inv_map.find(key);
    20332025      return it != _inv_map.end() ? it->second : INVALID;
    20342026    }
     
    20422034    virtual void erase(const Key& key) {
    20432035      Value val = Map::operator[](key);
    2044       typename Container::iterator it;
    2045       for (it = _inv_map.equal_range(val).first;
    2046            it != _inv_map.equal_range(val).second; ++it) {
    2047         if (it->second == key) {
    2048           _inv_map.erase(it);
    2049           break;
    2050         }
     2036      typename Container::iterator it = _inv_map.find(val);
     2037      if (it != _inv_map.end() && it->second == key) {
     2038        _inv_map.erase(it);
    20512039      }
    20522040      Map::erase(key);
     
    20602048      for (int i = 0; i < int(keys.size()); ++i) {
    20612049        Value val = Map::operator[](keys[i]);
    2062         typename Container::iterator it;
    2063         for (it = _inv_map.equal_range(val).first;
    2064              it != _inv_map.equal_range(val).second; ++it) {
    2065           if (it->second == keys[i]) {
    2066             _inv_map.erase(it);
    2067             break;
    2068           }
     2050        typename Container::iterator it = _inv_map.find(val);
     2051        if (it != _inv_map.end() && it->second == keys[i]) {
     2052          _inv_map.erase(it);
    20692053        }
    20702054      }
     
    21022086      /// \brief Subscript operator.
    21032087      ///
    2104       /// Subscript operator. It gives back an item
    2105       /// that is assigned to the given value or \c INVALID
    2106       /// if no such item exists.
     2088      /// Subscript operator. It gives back the item
     2089      /// that was last assigned to the given value.
    21072090      Value operator[](const Key& key) const {
    21082091        return _inverted(key);
     
    23382321  ///
    23392322  /// This type is a reference map, so it can be modified with the
    2340   /// subscript operator.
     2323  /// subscription operator.
    23412324  ///
    23422325  /// \tparam GR The graph type.
     
    27052688  ///
    27062689  /// This type is a reference map, so it can be modified with the
    2707   /// subscript operator.
     2690  /// subscription operator.
    27082691  ///
    27092692  /// \note The size of the data structure depends on the largest
     
    29962979  ///
    29972980  /// This type is not reference map, so it cannot be modified with
    2998   /// the subscript operator.
     2981  /// the subscription operator.
    29992982  ///
    30002983  /// \tparam GR The graph type.
  • lemon/preflow.h

    r736 r688  
    9898  /// "flow of maximum value" in a digraph.
    9999  /// The preflow algorithms are the fastest known maximum
    100   /// flow algorithms. The current implementation uses a mixture of the
     100  /// flow algorithms. The current implementation use a mixture of the
    101101  /// \e "highest label" and the \e "bound decrease" heuristics.
    102102  /// The worst case time complexity of the algorithm is \f$O(n^2\sqrt{e})\f$.
     
    372372    }
    373373
    374     /// \brief Sets the tolerance used by the algorithm.
    375     ///
    376     /// Sets the tolerance object used by the algorithm.
    377     /// \return <tt>(*this)</tt>
    378     Preflow& tolerance(const Tolerance& tolerance) {
     374    /// \brief Sets the tolerance used by algorithm.
     375    ///
     376    /// Sets the tolerance used by algorithm.
     377    Preflow& tolerance(const Tolerance& tolerance) const {
    379378      _tolerance = tolerance;
    380379      return *this;
     
    383382    /// \brief Returns a const reference to the tolerance.
    384383    ///
    385     /// Returns a const reference to the tolerance object used by
    386     /// the algorithm.
     384    /// Returns a const reference to the tolerance.
    387385    const Tolerance& tolerance() const {
    388       return _tolerance;
     386      return tolerance;
    389387    }
    390388
  • test/circulation_test.cc

    r736 r658  
    8888    .supplyMap(supply)
    8989    .flowMap(flow);
    90  
    91   const CirculationType::Elevator& elev = const_circ_test.elevator();
    92   circ_test.elevator(const_cast<CirculationType::Elevator&>(elev));
    93   CirculationType::Tolerance tol = const_circ_test.tolerance();
    94   circ_test.tolerance(tol);
    9590
    9691  circ_test.init();
  • test/maps_test.cc

    r742 r741  
    351351  }
    352352
    353   // CrossRefMap
    354   {
    355     typedef SmartDigraph 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   }
    386  
    387353  // Iterable bool map
    388354  {
  • test/preflow_test.cc

    r736 r632  
    9595  PreflowType preflow_test(g, cap, n, n);
    9696  const PreflowType& const_preflow_test = preflow_test;
    97  
    98   const PreflowType::Elevator& elev = const_preflow_test.elevator();
    99   preflow_test.elevator(const_cast<PreflowType::Elevator&>(elev));
    100   PreflowType::Tolerance tol = const_preflow_test.tolerance();
    101   preflow_test.tolerance(tol);
    10297
    10398  preflow_test
  • tools/lemon-0.x-to-1.x.sh

    r738 r621  
    3636        -e "s/Edge\>/_Ar_c_label_/g"\
    3737        -e "s/\<edge\>/_ar_c_label_/g"\
    38         -e "s/_edge\>/__ar_c_label_/g"\
     38        -e "s/_edge\>/_ar_c_label_/g"\
    3939        -e "s/Edges\>/_Ar_c_label_s/g"\
    4040        -e "s/\<edges\>/_ar_c_label_s/g"\
    41         -e "s/_edges\>/__ar_c_label_s/g"\
     41        -e "s/_edges\>/_ar_c_label_s/g"\
    4242        -e "s/\([Ee]\)dge\([a-z]\)/_\1d_ge_label_\2/g"\
    4343        -e "s/\([a-z]\)edge/\1_ed_ge_label_/g"\
     
    6969        -e "s/_GR_APH_TY_PEDE_FS_label_/GRAPH_TYPEDEFS/g"\
    7070        -e "s/_DIGR_APH_TY_PEDE_FS_label_/DIGRAPH_TYPEDEFS/g"\
    71         -e "s/\<digraph_adaptor\.h\>/adaptors.h/g"\
    72         -e "s/\<digraph_utils\.h\>/core.h/g"\
    73         -e "s/\<digraph_reader\.h\>/lgf_reader.h/g"\
    74         -e "s/\<digraph_writer\.h\>/lgf_writer.h/g"\
    75         -e "s/\<topology\.h\>/connectivity.h/g"\
    7671        -e "s/DigraphToEps/GraphToEps/g"\
    7772        -e "s/digraphToEps/graphToEps/g"\
Note: See TracChangeset for help on using the changeset viewer.