Index: lemon/Makefile.am
===================================================================
--- lemon/Makefile.am (revision 686)
+++ lemon/Makefile.am (revision 681)
@@ -93,4 +93,5 @@
lemon/lp_base.h \
lemon/lp_skeleton.h \
+ lemon/list_graph.h \
lemon/maps.h \
lemon/matching.h \
Index: lemon/bits/edge_set_extender.h
===================================================================
--- lemon/bits/edge_set_extender.h (revision 685)
+++ lemon/bits/edge_set_extender.h (revision 617)
@@ -538,5 +538,5 @@
public:
- explicit ArcMap(const Graph& _g)
+ ArcMap(const Graph& _g)
: Parent(_g) {}
ArcMap(const Graph& _g, const _Value& _v)
@@ -562,5 +562,5 @@
public:
- explicit EdgeMap(const Graph& _g)
+ EdgeMap(const Graph& _g)
: Parent(_g) {}
Index: lemon/bits/graph_extender.h
===================================================================
--- lemon/bits/graph_extender.h (revision 685)
+++ lemon/bits/graph_extender.h (revision 617)
@@ -605,5 +605,5 @@
public:
- explicit NodeMap(const Graph& graph)
+ NodeMap(const Graph& graph)
: Parent(graph) {}
NodeMap(const Graph& graph, const _Value& value)
@@ -629,5 +629,5 @@
public:
- explicit ArcMap(const Graph& graph)
+ ArcMap(const Graph& graph)
: Parent(graph) {}
ArcMap(const Graph& graph, const _Value& value)
@@ -653,5 +653,5 @@
public:
- explicit EdgeMap(const Graph& graph)
+ EdgeMap(const Graph& graph)
: Parent(graph) {}
Index: lemon/circulation.h
===================================================================
--- lemon/circulation.h (revision 689)
+++ lemon/circulation.h (revision 641)
@@ -451,9 +451,8 @@
}
- /// \brief Sets the tolerance used by the algorithm.
- ///
- /// Sets the tolerance object used by the algorithm.
- /// \return (*this)
- Circulation& tolerance(const Tolerance& tolerance) {
+ /// \brief Sets the tolerance used by algorithm.
+ ///
+ /// Sets the tolerance used by algorithm.
+ Circulation& tolerance(const Tolerance& tolerance) const {
_tol = tolerance;
return *this;
@@ -462,8 +461,7 @@
/// \brief Returns a const reference to the tolerance.
///
- /// Returns a const reference to the tolerance object used by
- /// the algorithm.
+ /// Returns a const reference to the tolerance.
const Tolerance& tolerance() const {
- return _tol;
+ return tolerance;
}
Index: lemon/maps.h
===================================================================
--- lemon/maps.h (revision 684)
+++ lemon/maps.h (revision 617)
@@ -1903,11 +1903,10 @@
/// This class provides simple invertable graph maps.
- /// It wraps a standard graph map (\c NodeMap, \c ArcMap or \c EdgeMap)
- /// and if a key is set to a new value, then stores it in the inverse map.
+ /// It wraps an arbitrary \ref concepts::ReadWriteMap "ReadWriteMap"
+ /// and if a key is set to a new value then store it
+ /// in the inverse map.
+ ///
/// The values of the map can be accessed
/// with stl compatible forward iterator.
- ///
- /// This type is not reference map, so it cannot be modified with
- /// the subscript operator.
///
/// \tparam GR The graph type.
@@ -1925,5 +1924,5 @@
template Map::Type Map;
- typedef std::multimap Container;
+ typedef std::map Container;
Container _inv_map;
@@ -1950,6 +1949,4 @@
/// iterator on the values of the map. The values can
/// be accessed in the [beginValue, endValue) range.
- /// They are considered with multiplicity, so each value is
- /// traversed for each item it is assigned to.
class ValueIterator
: public std::iterator {
@@ -2004,13 +2001,9 @@
void set(const Key& key, const Value& val) {
Value oldval = Map::operator[](key);
- typename Container::iterator it;
- for (it = _inv_map.equal_range(oldval).first;
- it != _inv_map.equal_range(oldval).second; ++it) {
- if (it->second == key) {
- _inv_map.erase(it);
- break;
- }
+ typename Container::iterator it = _inv_map.find(oldval);
+ if (it != _inv_map.end() && it->second == key) {
+ _inv_map.erase(it);
}
- _inv_map.insert(std::make_pair(val, key));
+ _inv_map.insert(make_pair(val, key));
Map::set(key, val);
}
@@ -2024,12 +2017,9 @@
}
- /// \brief Gives back an item by its value.
- ///
- /// This function gives back an item that is assigned to
- /// the given value or \c INVALID if no such item exists.
- /// If there are more items with the same associated value,
- /// only one of them is returned.
- Key operator()(const Value& val) const {
- typename Container::const_iterator it = _inv_map.find(val);
+ /// \brief Gives back the item by its value.
+ ///
+ /// Gives back the item by its value.
+ Key operator()(const Value& key) const {
+ typename Container::const_iterator it = _inv_map.find(key);
return it != _inv_map.end() ? it->second : INVALID;
}
@@ -2043,11 +2033,7 @@
virtual void erase(const Key& key) {
Value val = Map::operator[](key);
- typename Container::iterator it;
- for (it = _inv_map.equal_range(val).first;
- it != _inv_map.equal_range(val).second; ++it) {
- if (it->second == key) {
- _inv_map.erase(it);
- break;
- }
+ typename Container::iterator it = _inv_map.find(val);
+ if (it != _inv_map.end() && it->second == key) {
+ _inv_map.erase(it);
}
Map::erase(key);
@@ -2061,11 +2047,7 @@
for (int i = 0; i < int(keys.size()); ++i) {
Value val = Map::operator[](keys[i]);
- typename Container::iterator it;
- for (it = _inv_map.equal_range(val).first;
- it != _inv_map.equal_range(val).second; ++it) {
- if (it->second == keys[i]) {
- _inv_map.erase(it);
- break;
- }
+ typename Container::iterator it = _inv_map.find(val);
+ if (it != _inv_map.end() && it->second == keys[i]) {
+ _inv_map.erase(it);
}
}
@@ -2103,7 +2085,6 @@
/// \brief Subscript operator.
///
- /// Subscript operator. It gives back an item
- /// that is assigned to the given value or \c INVALID
- /// if no such item exists.
+ /// Subscript operator. It gives back the item
+ /// that was last assigned to the given value.
Value operator[](const Key& key) const {
return _inverted(key);
Index: lemon/preflow.h
===================================================================
--- lemon/preflow.h (revision 689)
+++ lemon/preflow.h (revision 641)
@@ -98,5 +98,5 @@
/// "flow of maximum value" in a digraph.
/// The preflow algorithms are the fastest known maximum
- /// flow algorithms. The current implementation uses a mixture of the
+ /// flow algorithms. The current implementation use a mixture of the
/// \e "highest label" and the \e "bound decrease" heuristics.
/// The worst case time complexity of the algorithm is \f$O(n^2\sqrt{e})\f$.
@@ -372,9 +372,8 @@
}
- /// \brief Sets the tolerance used by the algorithm.
- ///
- /// Sets the tolerance object used by the algorithm.
- /// \return (*this)
- Preflow& tolerance(const Tolerance& tolerance) {
+ /// \brief Sets the tolerance used by algorithm.
+ ///
+ /// Sets the tolerance used by algorithm.
+ Preflow& tolerance(const Tolerance& tolerance) const {
_tolerance = tolerance;
return *this;
@@ -383,8 +382,7 @@
/// \brief Returns a const reference to the tolerance.
///
- /// Returns a const reference to the tolerance object used by
- /// the algorithm.
+ /// Returns a const reference to the tolerance.
const Tolerance& tolerance() const {
- return _tolerance;
+ return tolerance;
}
Index: test/circulation_test.cc
===================================================================
--- test/circulation_test.cc (revision 689)
+++ test/circulation_test.cc (revision 611)
@@ -88,9 +88,4 @@
.supplyMap(supply)
.flowMap(flow);
-
- const CirculationType::Elevator& elev = const_circ_test.elevator();
- circ_test.elevator(const_cast(elev));
- CirculationType::Tolerance tol = const_circ_test.tolerance();
- circ_test.tolerance(tol);
circ_test.init();
Index: test/maps_test.cc
===================================================================
--- test/maps_test.cc (revision 684)
+++ test/maps_test.cc (revision 507)
@@ -23,5 +23,4 @@
#include
#include
-#include
#include "test_tools.h"
@@ -350,38 +349,4 @@
check(v1[i++] == *it, "Something is wrong with LoggerBoolMap");
}
-
- // CrossRefMap
- {
- typedef ListDigraph Graph;
- DIGRAPH_TYPEDEFS(Graph);
-
- checkConcept,
- CrossRefMap >();
-
- Graph gr;
- typedef CrossRefMap CRMap;
- typedef CRMap::ValueIterator ValueIt;
- CRMap map(gr);
-
- Node n0 = gr.addNode();
- Node n1 = gr.addNode();
- Node n2 = gr.addNode();
-
- map.set(n0, 'A');
- map.set(n1, 'B');
- map.set(n2, 'C');
- map.set(n2, 'A');
- map.set(n0, 'C');
-
- check(map[n0] == 'C' && map[n1] == 'B' && map[n2] == 'A',
- "Wrong CrossRefMap");
- check(map('A') == n2 && map.inverse()['A'] == n2, "Wrong CrossRefMap");
- check(map('B') == n1 && map.inverse()['B'] == n1, "Wrong CrossRefMap");
- check(map('C') == n0 && map.inverse()['C'] == n0, "Wrong CrossRefMap");
-
- ValueIt it = map.beginValue();
- check(*it++ == 'A' && *it++ == 'B' && *it++ == 'C' &&
- it == map.endValue(), "Wrong value iterator");
- }
return 0;
Index: test/preflow_test.cc
===================================================================
--- test/preflow_test.cc (revision 689)
+++ test/preflow_test.cc (revision 585)
@@ -95,9 +95,4 @@
PreflowType preflow_test(g, cap, n, n);
const PreflowType& const_preflow_test = preflow_test;
-
- const PreflowType::Elevator& elev = const_preflow_test.elevator();
- preflow_test.elevator(const_cast(elev));
- PreflowType::Tolerance tol = const_preflow_test.tolerance();
- preflow_test.tolerance(tol);
preflow_test
Index: tools/lemon-0.x-to-1.x.sh
===================================================================
--- tools/lemon-0.x-to-1.x.sh (revision 574)
+++ tools/lemon-0.x-to-1.x.sh (revision 691)
@@ -36,8 +36,8 @@
-e "s/Edge\>/_Ar_c_label_/g"\
-e "s/\/_ar_c_label_/g"\
- -e "s/_edge\>/_ar_c_label_/g"\
+ -e "s/_edge\>/__ar_c_label_/g"\
-e "s/Edges\>/_Ar_c_label_s/g"\
-e "s/\/_ar_c_label_s/g"\
- -e "s/_edges\>/_ar_c_label_s/g"\
+ -e "s/_edges\>/__ar_c_label_s/g"\
-e "s/\([Ee]\)dge\([a-z]\)/_\1d_ge_label_\2/g"\
-e "s/\([a-z]\)edge/\1_ed_ge_label_/g"\
@@ -69,4 +69,9 @@
-e "s/_GR_APH_TY_PEDE_FS_label_/GRAPH_TYPEDEFS/g"\
-e "s/_DIGR_APH_TY_PEDE_FS_label_/DIGRAPH_TYPEDEFS/g"\
+ -e "s/\/adaptors.h/g"\
+ -e "s/\/core.h/g"\
+ -e "s/\/lgf_reader.h/g"\
+ -e "s/\/lgf_writer.h/g"\
+ -e "s/\/connectivity.h/g"\
-e "s/DigraphToEps/GraphToEps/g"\
-e "s/digraphToEps/graphToEps/g"\