Ticket #69: d248eca9ca25.patch
File d248eca9ca25.patch, 41.5 KB (added by , 13 years ago) |
---|
-
lemon/bits/graph_extender.h
# HG changeset patch # User Balazs Dezso <deba@inf.elte.hu> # Date 1326316867 -3600 # Node ID d248eca9ca25b2dc0a185c45ea9a3934dedca484 # Parent 434a20e7458562409f15f552583d9ca64f7f8c6c Renamings: - RedIt->RedNodeIt - BlueIt->BlueNodeIt - RedMap->RedNodeMap - BlueMap->BlueNodeMap diff -r 434a20e74585 -r d248eca9ca25 lemon/bits/graph_extender.h
a b 913 913 914 914 }; 915 915 916 class Red It : public RedNode {916 class RedNodeIt : public RedNode { 917 917 const BpGraph* _graph; 918 918 public: 919 919 920 Red It() {}920 RedNodeIt() {} 921 921 922 Red It(Invalid i) : RedNode(i) { }922 RedNodeIt(Invalid i) : RedNode(i) { } 923 923 924 explicit Red It(const BpGraph& graph) : _graph(&graph) {924 explicit RedNodeIt(const BpGraph& graph) : _graph(&graph) { 925 925 _graph->first(static_cast<RedNode&>(*this)); 926 926 } 927 927 928 Red It(const BpGraph& graph, const RedNode& node)928 RedNodeIt(const BpGraph& graph, const RedNode& node) 929 929 : RedNode(node), _graph(&graph) {} 930 930 931 Red It& operator++() {931 RedNodeIt& operator++() { 932 932 _graph->next(static_cast<RedNode&>(*this)); 933 933 return *this; 934 934 } 935 935 936 936 }; 937 937 938 class Blue It : public BlueNode {938 class BlueNodeIt : public BlueNode { 939 939 const BpGraph* _graph; 940 940 public: 941 941 942 Blue It() {}942 BlueNodeIt() {} 943 943 944 Blue It(Invalid i) : BlueNode(i) { }944 BlueNodeIt(Invalid i) : BlueNode(i) { } 945 945 946 explicit Blue It(const BpGraph& graph) : _graph(&graph) {946 explicit BlueNodeIt(const BpGraph& graph) : _graph(&graph) { 947 947 _graph->first(static_cast<BlueNode&>(*this)); 948 948 } 949 949 950 Blue It(const BpGraph& graph, const BlueNode& node)950 BlueNodeIt(const BpGraph& graph, const BlueNode& node) 951 951 : BlueNode(node), _graph(&graph) {} 952 952 953 Blue It& operator++() {953 BlueNodeIt& operator++() { 954 954 _graph->next(static_cast<BlueNode&>(*this)); 955 955 return *this; 956 956 } … … 1144 1144 }; 1145 1145 1146 1146 template <typename _Value> 1147 class Red Map1147 class RedNodeMap 1148 1148 : public MapExtender<DefaultMap<BpGraph, RedNode, _Value> > { 1149 1149 typedef MapExtender<DefaultMap<BpGraph, RedNode, _Value> > Parent; 1150 1150 1151 1151 public: 1152 explicit Red Map(const BpGraph& bpgraph)1152 explicit RedNodeMap(const BpGraph& bpgraph) 1153 1153 : Parent(bpgraph) {} 1154 Red Map(const BpGraph& bpgraph, const _Value& value)1154 RedNodeMap(const BpGraph& bpgraph, const _Value& value) 1155 1155 : Parent(bpgraph, value) {} 1156 1156 1157 1157 private: 1158 Red Map& operator=(const RedMap& cmap) {1159 return operator=<Red Map>(cmap);1158 RedNodeMap& operator=(const RedNodeMap& cmap) { 1159 return operator=<RedNodeMap>(cmap); 1160 1160 } 1161 1161 1162 1162 template <typename CMap> 1163 Red Map& operator=(const CMap& cmap) {1163 RedNodeMap& operator=(const CMap& cmap) { 1164 1164 Parent::operator=(cmap); 1165 1165 return *this; 1166 1166 } … … 1168 1168 }; 1169 1169 1170 1170 template <typename _Value> 1171 class Blue Map1171 class BlueNodeMap 1172 1172 : public MapExtender<DefaultMap<BpGraph, BlueNode, _Value> > { 1173 1173 typedef MapExtender<DefaultMap<BpGraph, BlueNode, _Value> > Parent; 1174 1174 1175 1175 public: 1176 explicit Blue Map(const BpGraph& bpgraph)1176 explicit BlueNodeMap(const BpGraph& bpgraph) 1177 1177 : Parent(bpgraph) {} 1178 Blue Map(const BpGraph& bpgraph, const _Value& value)1178 BlueNodeMap(const BpGraph& bpgraph, const _Value& value) 1179 1179 : Parent(bpgraph, value) {} 1180 1180 1181 1181 private: 1182 Blue Map& operator=(const BlueMap& cmap) {1183 return operator=<Blue Map>(cmap);1182 BlueNodeMap& operator=(const BlueNodeMap& cmap) { 1183 return operator=<BlueNodeMap>(cmap); 1184 1184 } 1185 1185 1186 1186 template <typename CMap> 1187 Blue Map& operator=(const CMap& cmap) {1187 BlueNodeMap& operator=(const CMap& cmap) { 1188 1188 Parent::operator=(cmap); 1189 1189 return *this; 1190 1190 } -
lemon/bits/traits.h
diff -r 434a20e74585 -r d248eca9ca25 lemon/bits/traits.h
a b 172 172 typedef GR Digraph; 173 173 174 174 typedef typename GR::RedNode Item; 175 typedef typename GR::Red It ItemIt;175 typedef typename GR::RedNodeIt ItemIt; 176 176 177 177 typedef typename RedNodeNotifierIndicator<GR>::Type ItemNotifier; 178 178 179 179 template <typename V> 180 class Map : public GR::template Red Map<V> {181 typedef typename GR::template Red Map<V> Parent;180 class Map : public GR::template RedNodeMap<V> { 181 typedef typename GR::template RedNodeMap<V> Parent; 182 182 183 183 public: 184 typedef typename GR::template Red Map<V> Type;184 typedef typename GR::template RedNodeMap<V> Type; 185 185 typedef typename Parent::Value Value; 186 186 187 187 Map(const GR& _bpgraph) : Parent(_bpgraph) {} … … 213 213 typedef GR Digraph; 214 214 215 215 typedef typename GR::BlueNode Item; 216 typedef typename GR::Blue It ItemIt;216 typedef typename GR::BlueNodeIt ItemIt; 217 217 218 218 typedef typename BlueNodeNotifierIndicator<GR>::Type ItemNotifier; 219 219 220 220 template <typename V> 221 class Map : public GR::template Blue Map<V> {222 typedef typename GR::template Blue Map<V> Parent;221 class Map : public GR::template BlueNodeMap<V> { 222 typedef typename GR::template BlueNodeMap<V> Parent; 223 223 224 224 public: 225 typedef typename GR::template Blue Map<V> Type;225 typedef typename GR::template BlueNodeMap<V> Type; 226 226 typedef typename Parent::Value Value; 227 227 228 228 Map(const GR& _bpgraph) : Parent(_bpgraph) {} -
lemon/concepts/bpgraph.h
diff -r 434a20e74585 -r d248eca9ca25 lemon/concepts/bpgraph.h
a b 48 48 /// The bipartite graphs also fulfill the concept of \ref Graph 49 49 /// "undirected graphs". Bipartite graphs provide a bipartition of 50 50 /// the node set, namely a red and blue set of the nodes. The 51 /// nodes can be iterated with the Red It and BlueIt in the two52 /// node sets. With RedMap and BlueMap values can be assigned to53 /// the nodes in the two sets.51 /// nodes can be iterated with the RedNodeIt and BlueNodeIt in the 52 /// two node sets. With RedNodeMap and BlueNodeMap values can be 53 /// assigned to the nodes in the two sets. 54 54 /// 55 55 /// The edges of the graph cannot connect two nodes of the same 56 56 /// set. The edges inherent orientation is from the red nodes to … … 187 187 /// int count=0; 188 188 /// for (BpGraph::RedNodeIt n(g); n!=INVALID; ++n) ++count; 189 189 ///\endcode 190 class Red It : public RedNode {190 class RedNodeIt : public RedNode { 191 191 public: 192 192 /// Default constructor 193 193 194 194 /// Default constructor. 195 195 /// \warning It sets the iterator to an undefined value. 196 Red It() { }196 RedNodeIt() { } 197 197 /// Copy constructor. 198 198 199 199 /// Copy constructor. 200 200 /// 201 Red It(const RedIt& n) : RedNode(n) { }201 RedNodeIt(const RedNodeIt& n) : RedNode(n) { } 202 202 /// %Invalid constructor \& conversion. 203 203 204 204 /// Initializes the iterator to be invalid. 205 205 /// \sa Invalid for more details. 206 Red It(Invalid) { }206 RedNodeIt(Invalid) { } 207 207 /// Sets the iterator to the first red node. 208 208 209 209 /// Sets the iterator to the first red node of the given 210 210 /// digraph. 211 explicit Red It(const BpGraph&) { }211 explicit RedNodeIt(const BpGraph&) { } 212 212 /// Sets the iterator to the given red node. 213 213 214 214 /// Sets the iterator to the given red node of the given 215 215 /// digraph. 216 Red It(const BpGraph&, const RedNode&) { }216 RedNodeIt(const BpGraph&, const RedNode&) { } 217 217 /// Next node. 218 218 219 219 /// Assign the iterator to the next red node. 220 220 /// 221 Red It& operator++() { return *this; }221 RedNodeIt& operator++() { return *this; } 222 222 }; 223 223 224 224 /// Iterator class for the blue nodes. … … 230 230 /// int count=0; 231 231 /// for (BpGraph::BlueNodeIt n(g); n!=INVALID; ++n) ++count; 232 232 ///\endcode 233 class Blue It : public BlueNode {233 class BlueNodeIt : public BlueNode { 234 234 public: 235 235 /// Default constructor 236 236 237 237 /// Default constructor. 238 238 /// \warning It sets the iterator to an undefined value. 239 Blue It() { }239 BlueNodeIt() { } 240 240 /// Copy constructor. 241 241 242 242 /// Copy constructor. 243 243 /// 244 Blue It(const BlueIt& n) : BlueNode(n) { }244 BlueNodeIt(const BlueNodeIt& n) : BlueNode(n) { } 245 245 /// %Invalid constructor \& conversion. 246 246 247 247 /// Initializes the iterator to be invalid. 248 248 /// \sa Invalid for more details. 249 Blue It(Invalid) { }249 BlueNodeIt(Invalid) { } 250 250 /// Sets the iterator to the first blue node. 251 251 252 252 /// Sets the iterator to the first blue node of the given 253 253 /// digraph. 254 explicit Blue It(const BpGraph&) { }254 explicit BlueNodeIt(const BpGraph&) { } 255 255 /// Sets the iterator to the given blue node. 256 256 257 257 /// Sets the iterator to the given blue node of the given 258 258 /// digraph. 259 Blue It(const BpGraph&, const BlueNode&) { }259 BlueNodeIt(const BpGraph&, const BlueNode&) { } 260 260 /// Next node. 261 261 262 262 /// Assign the iterator to the next blue node. 263 263 /// 264 Blue It& operator++() { return *this; }264 BlueNodeIt& operator++() { return *this; } 265 265 }; 266 266 267 267 /// Iterator class for the nodes. … … 663 663 /// Standard graph map type for the red nodes. 664 664 /// It conforms to the ReferenceMap concept. 665 665 template<class T> 666 class Red Map : public ReferenceMap<Node, T, T&, const T&>666 class RedNodeMap : public ReferenceMap<Node, T, T&, const T&> 667 667 { 668 668 public: 669 669 670 670 /// Constructor 671 explicit Red Map(const BpGraph&) { }671 explicit RedNodeMap(const BpGraph&) { } 672 672 /// Constructor with given initial value 673 Red Map(const BpGraph&, T) { }673 RedNodeMap(const BpGraph&, T) { } 674 674 675 675 private: 676 676 ///Copy constructor 677 Red Map(const RedMap& nm) :677 RedNodeMap(const RedNodeMap& nm) : 678 678 ReferenceMap<Node, T, T&, const T&>(nm) { } 679 679 ///Assignment operator 680 680 template <typename CMap> 681 Red Map& operator=(const CMap&) {681 RedNodeMap& operator=(const CMap&) { 682 682 checkConcept<ReadMap<Node, T>, CMap>(); 683 683 return *this; 684 684 } … … 689 689 /// Standard graph map type for the blue nodes. 690 690 /// It conforms to the ReferenceMap concept. 691 691 template<class T> 692 class Blue Map : public ReferenceMap<Node, T, T&, const T&>692 class BlueNodeMap : public ReferenceMap<Node, T, T&, const T&> 693 693 { 694 694 public: 695 695 696 696 /// Constructor 697 explicit Blue Map(const BpGraph&) { }697 explicit BlueNodeMap(const BpGraph&) { } 698 698 /// Constructor with given initial value 699 Blue Map(const BpGraph&, T) { }699 BlueNodeMap(const BpGraph&, T) { } 700 700 701 701 private: 702 702 ///Copy constructor 703 Blue Map(const BlueMap& nm) :703 BlueNodeMap(const BlueNodeMap& nm) : 704 704 ReferenceMap<Node, T, T&, const T&>(nm) { } 705 705 ///Assignment operator 706 706 template <typename CMap> 707 Blue Map& operator=(const CMap&) {707 BlueNodeMap& operator=(const CMap&) { 708 708 checkConcept<ReadMap<Node, T>, CMap>(); 709 709 return *this; 710 710 } -
lemon/concepts/graph_components.h
diff -r 434a20e74585 -r d248eca9ca25 lemon/concepts/graph_components.h
a b 1191 1191 /// \brief This iterator goes through each red node. 1192 1192 /// 1193 1193 /// This iterator goes through each red node. 1194 typedef GraphItemIt<BpGraph, RedNode> Red It;1194 typedef GraphItemIt<BpGraph, RedNode> RedNodeIt; 1195 1195 1196 1196 /// \brief This iterator goes through each blue node. 1197 1197 /// 1198 1198 /// This iterator goes through each blue node. 1199 typedef GraphItemIt<BpGraph, BlueNode> Blue It;1199 typedef GraphItemIt<BpGraph, BlueNode> BlueNodeIt; 1200 1200 1201 1201 /// @} 1202 1202 … … 1213 1213 bpgraph.next(bn); 1214 1214 1215 1215 checkConcept<GraphItemIt<_BpGraph, typename _BpGraph::RedNode>, 1216 typename _BpGraph::Red It>();1216 typename _BpGraph::RedNodeIt>(); 1217 1217 checkConcept<GraphItemIt<_BpGraph, typename _BpGraph::BlueNode>, 1218 typename _BpGraph::Blue It>();1218 typename _BpGraph::BlueNodeIt>(); 1219 1219 } 1220 1220 1221 1221 const _BpGraph& bpgraph; … … 1695 1695 /// This class describes the interface of mappable undirected 1696 1696 /// bipartite graphs. It extends \ref MappableGraphComponent with 1697 1697 /// the standard graph map class for red and blue nodes (\c 1698 /// RedMap and BlueMap). This concept is part of the BpGraph concept. 1698 /// RedNodeMap and BlueNodeMap). This concept is part of the 1699 /// BpGraph concept. 1699 1700 template <typename BAS = BaseBpGraphComponent> 1700 1701 class MappableBpGraphComponent : public MappableGraphComponent<BAS> { 1701 1702 public: … … 1710 1711 /// Standard graph map for the red nodes. 1711 1712 /// It conforms to the ReferenceMap concept. 1712 1713 template <typename V> 1713 class Red Map : public GraphMap<MappableBpGraphComponent, Node, V> {1714 class RedNodeMap : public GraphMap<MappableBpGraphComponent, Node, V> { 1714 1715 typedef GraphMap<MappableBpGraphComponent, Node, V> Parent; 1715 1716 1716 1717 public: 1717 1718 /// \brief Construct a new map. 1718 1719 /// 1719 1720 /// Construct a new map for the graph. 1720 explicit Red Map(const MappableBpGraphComponent& graph)1721 explicit RedNodeMap(const MappableBpGraphComponent& graph) 1721 1722 : Parent(graph) {} 1722 1723 1723 1724 /// \brief Construct a new map with default value. 1724 1725 /// 1725 1726 /// Construct a new map for the graph and initalize the values. 1726 Red Map(const MappableBpGraphComponent& graph, const V& value)1727 RedNodeMap(const MappableBpGraphComponent& graph, const V& value) 1727 1728 : Parent(graph, value) {} 1728 1729 1729 1730 private: 1730 1731 /// \brief Copy constructor. 1731 1732 /// 1732 1733 /// Copy Constructor. 1733 Red Map(const RedMap& nm) : Parent(nm) {}1734 RedNodeMap(const RedNodeMap& nm) : Parent(nm) {} 1734 1735 1735 1736 /// \brief Assignment operator. 1736 1737 /// 1737 1738 /// Assignment operator. 1738 1739 template <typename CMap> 1739 Red Map& operator=(const CMap&) {1740 RedNodeMap& operator=(const CMap&) { 1740 1741 checkConcept<ReadMap<Node, V>, CMap>(); 1741 1742 return *this; 1742 1743 } … … 1748 1749 /// Standard graph map for the blue nodes. 1749 1750 /// It conforms to the ReferenceMap concept. 1750 1751 template <typename V> 1751 class Blue Map : public GraphMap<MappableBpGraphComponent, Node, V> {1752 class BlueNodeMap : public GraphMap<MappableBpGraphComponent, Node, V> { 1752 1753 typedef GraphMap<MappableBpGraphComponent, Node, V> Parent; 1753 1754 1754 1755 public: 1755 1756 /// \brief Construct a new map. 1756 1757 /// 1757 1758 /// Construct a new map for the graph. 1758 explicit Blue Map(const MappableBpGraphComponent& graph)1759 explicit BlueNodeMap(const MappableBpGraphComponent& graph) 1759 1760 : Parent(graph) {} 1760 1761 1761 1762 /// \brief Construct a new map with default value. 1762 1763 /// 1763 1764 /// Construct a new map for the graph and initalize the values. 1764 Blue Map(const MappableBpGraphComponent& graph, const V& value)1765 BlueNodeMap(const MappableBpGraphComponent& graph, const V& value) 1765 1766 : Parent(graph, value) {} 1766 1767 1767 1768 private: 1768 1769 /// \brief Copy constructor. 1769 1770 /// 1770 1771 /// Copy Constructor. 1771 Blue Map(const BlueMap& nm) : Parent(nm) {}1772 BlueNodeMap(const BlueNodeMap& nm) : Parent(nm) {} 1772 1773 1773 1774 /// \brief Assignment operator. 1774 1775 /// 1775 1776 /// Assignment operator. 1776 1777 template <typename CMap> 1777 Blue Map& operator=(const CMap&) {1778 BlueNodeMap& operator=(const CMap&) { 1778 1779 checkConcept<ReadMap<Node, V>, CMap>(); 1779 1780 return *this; 1780 1781 } … … 1795 1796 checkConcept<MappableGraphComponent<Base>, _BpGraph>(); 1796 1797 1797 1798 { // int map test 1798 typedef typename _BpGraph::template RedMap<int> IntRedMap; 1799 typedef typename _BpGraph::template RedNodeMap<int> 1800 IntRedNodeMap; 1799 1801 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, int>, 1800 IntRed Map >();1802 IntRedNodeMap >(); 1801 1803 } { // bool map test 1802 typedef typename _BpGraph::template RedMap<bool> BoolRedMap; 1804 typedef typename _BpGraph::template RedNodeMap<bool> 1805 BoolRedNodeMap; 1803 1806 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, bool>, 1804 BoolRed Map >();1807 BoolRedNodeMap >(); 1805 1808 } { // Dummy map test 1806 typedef typename _BpGraph::template RedMap<Dummy> DummyRedMap; 1809 typedef typename _BpGraph::template RedNodeMap<Dummy> 1810 DummyRedNodeMap; 1807 1811 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, Dummy>, 1808 DummyRed Map >();1812 DummyRedNodeMap >(); 1809 1813 } 1810 1814 1811 1815 { // int map test 1812 typedef typename _BpGraph::template BlueMap<int> IntBlueMap; 1816 typedef typename _BpGraph::template BlueNodeMap<int> 1817 IntBlueNodeMap; 1813 1818 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, int>, 1814 IntBlue Map >();1819 IntBlueNodeMap >(); 1815 1820 } { // bool map test 1816 typedef typename _BpGraph::template BlueMap<bool> BoolBlueMap; 1821 typedef typename _BpGraph::template BlueNodeMap<bool> 1822 BoolBlueNodeMap; 1817 1823 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, bool>, 1818 BoolBlue Map >();1824 BoolBlueNodeMap >(); 1819 1825 } { // Dummy map test 1820 typedef typename _BpGraph::template BlueMap<Dummy> DummyBlueMap; 1826 typedef typename _BpGraph::template BlueNodeMap<Dummy> 1827 DummyBlueNodeMap; 1821 1828 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, Dummy>, 1822 DummyBlue Map >();1829 DummyBlueNodeMap >(); 1823 1830 } 1824 1831 } 1825 1832 -
lemon/core.h
diff -r 434a20e74585 -r d248eca9ca25 lemon/core.h
a b 150 150 151 151 ///Create convenience typedefs for the bipartite graph types and iterators 152 152 153 ///This \c \#define creates the same convenient type definitions as defined 154 ///by \ref GRAPH_TYPEDEFS(BpGraph) and ten more, namely it creates 155 ///\c RedNode, \c RedIt, \c BoolRedMap, \c IntRedMap, \c DoubleRedMap, 156 ///\c BlueNode, \c BlueIt, \c BoolBlueMap, \c IntBlueMap, \c DoubleBlueMap. 153 ///This \c \#define creates the same convenient type definitions as 154 ///defined by \ref GRAPH_TYPEDEFS(BpGraph) and ten more, namely it 155 ///creates \c RedNode, \c RedNodeIt, \c BoolRedNodeMap, 156 ///\c IntRedNodeMap, \c DoubleRedNodeMap, \c BlueNode, \c BlueNodeIt, 157 ///\c BoolBlueNodeMap, \c IntBlueNodeMap, \c DoubleBlueNodeMap. 157 158 /// 158 159 ///\note If the graph type is a dependent type, ie. the graph type depend 159 160 ///on a template parameter, then use \c TEMPLATE_BPGRAPH_TYPEDEFS() … … 161 162 #define BPGRAPH_TYPEDEFS(BpGraph) \ 162 163 GRAPH_TYPEDEFS(BpGraph); \ 163 164 typedef BpGraph::RedNode RedNode; \ 164 typedef BpGraph::Red It RedIt;\165 typedef BpGraph::Red Map<bool> BoolRedMap;\166 typedef BpGraph::Red Map<int> IntRedMap;\167 typedef BpGraph::Red Map<double> DoubleRedMap;\165 typedef BpGraph::RedNodeIt RedNodeIt; \ 166 typedef BpGraph::RedNodeMap<bool> BoolRedNodeMap; \ 167 typedef BpGraph::RedNodeMap<int> IntRedNodeMap; \ 168 typedef BpGraph::RedNodeMap<double> DoubleRedNodeMap; \ 168 169 typedef BpGraph::BlueNode BlueNode; \ 169 typedef BpGraph::Blue It BlueIt;\170 typedef BpGraph::Blue Map<bool> BoolBlueMap;\171 typedef BpGraph::Blue Map<int> IntBlueMap;\172 typedef BpGraph::Blue Map<double> DoubleBlueMap170 typedef BpGraph::BlueNodeIt BlueNodeIt; \ 171 typedef BpGraph::BlueNodeMap<bool> BoolBlueNodeMap; \ 172 typedef BpGraph::BlueNodeMap<int> IntBlueNodeMap; \ 173 typedef BpGraph::BlueNodeMap<double> DoubleBlueNodeMap 173 174 174 175 ///Create convenience typedefs for the bipartite graph types and iterators 175 176 … … 177 178 /// 178 179 ///\note Use this macro, if the graph type is a dependent type, 179 180 ///ie. the graph type depend on a template parameter. 180 #define TEMPLATE_BPGRAPH_TYPEDEFS(BpGraph) \181 TEMPLATE_GRAPH_TYPEDEFS(BpGraph); \182 typedef typename BpGraph::RedNode RedNode; \183 typedef typename BpGraph::Red It RedIt;\184 typedef typename BpGraph::template Red Map<bool> BoolRedMap;\185 typedef typename BpGraph::template Red Map<int> IntRedMap;\186 typedef typename BpGraph::template Red Map<double> DoubleRedMap;\187 typedef typename BpGraph::BlueNode BlueNode; \188 typedef typename BpGraph::Blue It BlueIt;\189 typedef typename BpGraph::template Blue Map<bool> BoolBlueMap;\190 typedef typename BpGraph::template Blue Map<int> IntBlueMap;\191 typedef typename BpGraph::template Blue Map<double> DoubleBlueMap181 #define TEMPLATE_BPGRAPH_TYPEDEFS(BpGraph) \ 182 TEMPLATE_GRAPH_TYPEDEFS(BpGraph); \ 183 typedef typename BpGraph::RedNode RedNode; \ 184 typedef typename BpGraph::RedNodeIt RedNodeIt; \ 185 typedef typename BpGraph::template RedNodeMap<bool> BoolRedNodeMap; \ 186 typedef typename BpGraph::template RedNodeMap<int> IntRedNodeMap; \ 187 typedef typename BpGraph::template RedNodeMap<double> DoubleRedNodeMap; \ 188 typedef typename BpGraph::BlueNode BlueNode; \ 189 typedef typename BpGraph::BlueNodeIt BlueNodeIt; \ 190 typedef typename BpGraph::template BlueNodeMap<bool> BoolBlueNodeMap; \ 191 typedef typename BpGraph::template BlueNodeMap<int> IntBlueNodeMap; \ 192 typedef typename BpGraph::template BlueNodeMap<double> DoubleBlueNodeMap 192 193 193 194 /// \brief Function to count the items in a graph. 194 195 /// … … 565 566 BlueNodeRefMap& blueNodeRefMap, 566 567 EdgeRefMap& edgeRefMap) { 567 568 to.clear(); 568 for (typename From::Red It it(from); it != INVALID; ++it) {569 for (typename From::RedNodeIt it(from); it != INVALID; ++it) { 569 570 redNodeRefMap[it] = to.addRedNode(); 570 571 } 571 for (typename From::Blue It it(from); it != INVALID; ++it) {572 for (typename From::BlueNodeIt it(from); it != INVALID; ++it) { 572 573 blueNodeRefMap[it] = to.addBlueNode(); 573 574 } 574 575 for (typename From::EdgeIt it(from); it != INVALID; ++it) { … … 1164 1165 /// // Create cross references (inverse) for the edges 1165 1166 /// NewBpGraph::EdgeMap<OrigBpGraph::Edge> ecr(new_graph); 1166 1167 /// cg.edgeCrossRef(ecr); 1167 /// // Copy a red map1168 /// OrigBpGraph::Red Map<double> ormap(orig_graph);1169 /// NewBpGraph::Red Map<double> nrmap(new_graph);1170 /// cg. edgeMap(ormap, nrmap);1168 /// // Copy a red node map 1169 /// OrigBpGraph::RedNodeMap<double> ormap(orig_graph); 1170 /// NewBpGraph::RedNodeMap<double> nrmap(new_graph); 1171 /// cg.redNodeMap(ormap, nrmap); 1171 1172 /// // Copy a node 1172 1173 /// OrigBpGraph::Node on; 1173 1174 /// NewBpGraph::Node nn; … … 1194 1195 typedef typename To::Arc TArc; 1195 1196 typedef typename To::Edge TEdge; 1196 1197 1197 typedef typename From::template Red Map<TRedNode> RedNodeRefMap;1198 typedef typename From::template Blue Map<TBlueNode> BlueNodeRefMap;1198 typedef typename From::template RedNodeMap<TRedNode> RedNodeRefMap; 1199 typedef typename From::template BlueNodeMap<TBlueNode> BlueNodeRefMap; 1199 1200 typedef typename From::template EdgeMap<TEdge> EdgeRefMap; 1200 1201 1201 1202 struct NodeRefMap { … … 1352 1353 /// the original map \c map should be the Node type of the source 1353 1354 /// graph. 1354 1355 template <typename FromMap, typename ToMap> 1355 BpGraphCopy& red Map(const FromMap& map, ToMap& tmap) {1356 BpGraphCopy& redNodeMap(const FromMap& map, ToMap& tmap) { 1356 1357 _red_maps.push_back(new _core_bits::MapCopy<From, RedNode, 1357 1358 RedNodeRefMap, FromMap, ToMap>(map, tmap)); 1358 1359 return *this; … … 1403 1404 /// the original map \c map should be the Node type of the source 1404 1405 /// graph. 1405 1406 template <typename FromMap, typename ToMap> 1406 BpGraphCopy& blue Map(const FromMap& map, ToMap& tmap) {1407 BpGraphCopy& blueNodeMap(const FromMap& map, ToMap& tmap) { 1407 1408 _blue_maps.push_back(new _core_bits::MapCopy<From, BlueNode, 1408 1409 BlueNodeRefMap, FromMap, ToMap>(map, tmap)); 1409 1410 return *this; -
lemon/lgf_reader.h
diff -r 434a20e74585 -r d248eca9ca25 lemon/lgf_reader.h
a b 2134 2134 /// reads the red and blue nodes from separate sections, and these 2135 2135 /// sections can contain different set of maps. 2136 2136 /// 2137 /// The red and blue maps are read from the corresponding2137 /// The red and blue node maps are read from the corresponding 2138 2138 /// sections. If a map is defined with the same name in both of 2139 2139 /// these sections, then it can be read as a node map. 2140 2140 template <typename BGR> … … 2323 2323 return *this; 2324 2324 } 2325 2325 2326 /// Add a red map reading rule to the reader.2326 /// Add a red node map reading rule to the reader. 2327 2327 template <typename Map> 2328 BpGraphReader& red Map(const std::string& caption, Map& map) {2328 BpGraphReader& redNodeMap(const std::string& caption, Map& map) { 2329 2329 checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>(); 2330 2330 _reader_bits::MapStorageBase<Node>* storage = 2331 2331 new _reader_bits::MapStorage<Node, Map>(map); … … 2333 2333 return *this; 2334 2334 } 2335 2335 2336 /// \brief Red map reading rule2336 /// \brief Red node map reading rule 2337 2337 /// 2338 /// Add a red map reading rule with specialized converter to the2339 /// reader.2338 /// Add a red node map node reading rule with specialized converter to 2339 /// the reader. 2340 2340 template <typename Map, typename Converter> 2341 BpGraphReader& red Map(const std::string& caption, Map& map,2342 const Converter& converter = Converter()) {2341 BpGraphReader& redNodeMap(const std::string& caption, Map& map, 2342 const Converter& converter = Converter()) { 2343 2343 checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>(); 2344 2344 _reader_bits::MapStorageBase<Node>* storage = 2345 2345 new _reader_bits::MapStorage<Node, Map, Converter>(map, converter); … … 2347 2347 return *this; 2348 2348 } 2349 2349 2350 /// Add a blue map reading rule to the reader.2350 /// Add a blue node map reading rule to the reader. 2351 2351 template <typename Map> 2352 BpGraphReader& blue Map(const std::string& caption, Map& map) {2352 BpGraphReader& blueNodeMap(const std::string& caption, Map& map) { 2353 2353 checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>(); 2354 2354 _reader_bits::MapStorageBase<Node>* storage = 2355 2355 new _reader_bits::MapStorage<Node, Map>(map); … … 2357 2357 return *this; 2358 2358 } 2359 2359 2360 /// \brief Blue map reading rule2360 /// \brief Blue node map reading rule 2361 2361 /// 2362 /// Add a blue map reading rule with specialized converter to the2363 /// reader.2362 /// Add a blue node map reading rule with specialized converter to 2363 /// the reader. 2364 2364 template <typename Map, typename Converter> 2365 BpGraphReader& blue Map(const std::string& caption, Map& map,2366 const Converter& converter = Converter()) {2365 BpGraphReader& blueNodeMap(const std::string& caption, Map& map, 2366 const Converter& converter = Converter()) { 2367 2367 checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>(); 2368 2368 _reader_bits::MapStorageBase<Node>* storage = 2369 2369 new _reader_bits::MapStorage<Node, Map, Converter>(map, converter); … … 2670 2670 while (_reader_bits::readToken(line, map)) { 2671 2671 if (maps.find(map) != maps.end()) { 2672 2672 std::ostringstream msg; 2673 msg << "Multiple occurence of red map: " << map;2673 msg << "Multiple occurence of red node map: " << map; 2674 2674 throw FormatError(msg.str()); 2675 2675 } 2676 2676 maps.insert(std::make_pair(map, index)); … … 2763 2763 while (_reader_bits::readToken(line, map)) { 2764 2764 if (maps.find(map) != maps.end()) { 2765 2765 std::ostringstream msg; 2766 msg << "Multiple occurence of blue map: " << map;2766 msg << "Multiple occurence of blue node map: " << map; 2767 2767 throw FormatError(msg.str()); 2768 2768 } 2769 2769 maps.insert(std::make_pair(map, index)); -
lemon/lgf_writer.h
diff -r 434a20e74585 -r d248eca9ca25 lemon/lgf_writer.h
a b 1629 1629 /// reads the red and blue nodes from separate sections, and these 1630 1630 /// sections can contain different set of maps. 1631 1631 /// 1632 /// The red and blue maps are written to the corresponding1632 /// The red and blue node maps are written to the corresponding 1633 1633 /// sections. The node maps are written to both of these sections 1634 1634 /// with the same map name. 1635 1635 template <typename BGR> … … 1805 1805 return *this; 1806 1806 } 1807 1807 1808 /// \brief Red map writing rule1808 /// \brief Red node map writing rule 1809 1809 /// 1810 /// Add a red map writing rule to the writer.1810 /// Add a red node map writing rule to the writer. 1811 1811 template <typename Map> 1812 BpGraphWriter& red Map(const std::string& caption, const Map& map) {1812 BpGraphWriter& redNodeMap(const std::string& caption, const Map& map) { 1813 1813 checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>(); 1814 1814 _writer_bits::MapStorageBase<Node>* storage = 1815 1815 new _writer_bits::MapStorage<Node, Map>(map); … … 1817 1817 return *this; 1818 1818 } 1819 1819 1820 /// \brief Red map writing rule1820 /// \brief Red node map writing rule 1821 1821 /// 1822 /// Add a red map writing rule with specialized converter to the1822 /// Add a red node map writing rule with specialized converter to the 1823 1823 /// writer. 1824 1824 template <typename Map, typename Converter> 1825 BpGraphWriter& red Map(const std::string& caption, const Map& map,1826 const Converter& converter = Converter()) {1825 BpGraphWriter& redNodeMap(const std::string& caption, const Map& map, 1826 const Converter& converter = Converter()) { 1827 1827 checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>(); 1828 1828 _writer_bits::MapStorageBase<Node>* storage = 1829 1829 new _writer_bits::MapStorage<Node, Map, Converter>(map, converter); … … 1831 1831 return *this; 1832 1832 } 1833 1833 1834 /// \brief Blue map writing rule1834 /// \brief Blue node map writing rule 1835 1835 /// 1836 /// Add a blue map writing rule to the writer.1836 /// Add a blue node map writing rule to the writer. 1837 1837 template <typename Map> 1838 BpGraphWriter& blue Map(const std::string& caption, const Map& map) {1838 BpGraphWriter& blueNodeMap(const std::string& caption, const Map& map) { 1839 1839 checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>(); 1840 1840 _writer_bits::MapStorageBase<Node>* storage = 1841 1841 new _writer_bits::MapStorage<Node, Map>(map); … … 1843 1843 return *this; 1844 1844 } 1845 1845 1846 /// \brief Blue map writing rule1846 /// \brief Blue node map writing rule 1847 1847 /// 1848 /// Add a blue map writing rule with specialized converter to the1848 /// Add a blue node map writing rule with specialized converter to the 1849 1849 /// writer. 1850 1850 template <typename Map, typename Converter> 1851 BpGraphWriter& blue Map(const std::string& caption, const Map& map,1852 const Converter& converter = Converter()) {1851 BpGraphWriter& blueNodeMap(const std::string& caption, const Map& map, 1852 const Converter& converter = Converter()) { 1853 1853 checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>(); 1854 1854 _writer_bits::MapStorageBase<Node>* storage = 1855 1855 new _writer_bits::MapStorage<Node, Map, Converter>(map, converter); … … 2058 2058 *_os << std::endl; 2059 2059 2060 2060 std::vector<Node> nodes; 2061 for (Red It n(_graph); n != INVALID; ++n) {2061 for (RedNodeIt n(_graph); n != INVALID; ++n) { 2062 2062 nodes.push_back(n); 2063 2063 } 2064 2064 … … 2118 2118 *_os << std::endl; 2119 2119 2120 2120 std::vector<Node> nodes; 2121 for (Blue It n(_graph); n != INVALID; ++n) {2121 for (BlueNodeIt n(_graph); n != INVALID; ++n) { 2122 2122 nodes.push_back(n); 2123 2123 } 2124 2124 -
test/bpgraph_test.cc
diff -r 434a20e74585 -r d248eca9ca25 test/bpgraph_test.cc
a b 101 101 checkEdgeIds(G); 102 102 103 103 checkGraphNodeMap(G); 104 checkGraphRed Map(G);105 checkGraphBlue Map(G);104 checkGraphRedNodeMap(G); 105 checkGraphBlueNodeMap(G); 106 106 checkGraphArcMap(G); 107 107 checkGraphEdgeMap(G); 108 108 } … … 260 260 checkEdgeIds(G); 261 261 262 262 checkGraphNodeMap(G); 263 checkGraphRed Map(G);264 checkGraphBlue Map(G);263 checkGraphRedNodeMap(G); 264 checkGraphBlueNodeMap(G); 265 265 checkGraphArcMap(G); 266 266 checkGraphEdgeMap(G); 267 267 … … 369 369 checkGraphEdgeList(G, redNum * blueNum); 370 370 checkGraphArcList(G, 2 * redNum * blueNum); 371 371 372 for (Red It n(G); n != INVALID; ++n) {372 for (RedNodeIt n(G); n != INVALID; ++n) { 373 373 checkGraphOutArcList(G, n, blueNum); 374 374 checkGraphInArcList(G, n, blueNum); 375 375 checkGraphIncEdgeList(G, n, blueNum); 376 376 } 377 377 378 for (Blue It n(G); n != INVALID; ++n) {378 for (BlueNodeIt n(G); n != INVALID; ++n) { 379 379 checkGraphOutArcList(G, n, redNum); 380 380 checkGraphInArcList(G, n, redNum); 381 381 checkGraphIncEdgeList(G, n, redNum); … … 393 393 checkEdgeIds(G); 394 394 395 395 checkGraphNodeMap(G); 396 checkGraphRed Map(G);397 checkGraphBlue Map(G);396 checkGraphRedNodeMap(G); 397 checkGraphBlueNodeMap(G); 398 398 checkGraphArcMap(G); 399 399 checkGraphEdgeMap(G); 400 400 -
test/graph_copy_test.cc
diff -r 434a20e74585 -r d248eca9ca25 test/graph_copy_test.cc
a b 216 216 // Build a graph 217 217 SmartBpGraph from; 218 218 SmartBpGraph::NodeMap<int> fnm(from); 219 SmartBpGraph::Red Map<int> frnm(from);220 SmartBpGraph::Blue Map<int> fbnm(from);219 SmartBpGraph::RedNodeMap<int> frnm(from); 220 SmartBpGraph::BlueNodeMap<int> fbnm(from); 221 221 SmartBpGraph::ArcMap<int> fam(from); 222 222 SmartBpGraph::EdgeMap<int> fem(from); 223 223 SmartBpGraph::Node fn = INVALID; … … 261 261 // Test graph copy 262 262 GR to; 263 263 typename GR::template NodeMap<int> tnm(to); 264 typename GR::template Red Map<int> trnm(to);265 typename GR::template Blue Map<int> tbnm(to);264 typename GR::template RedNodeMap<int> trnm(to); 265 typename GR::template BlueNodeMap<int> tbnm(to); 266 266 typename GR::template ArcMap<int> tam(to); 267 267 typename GR::template EdgeMap<int> tem(to); 268 268 typename GR::Node tn; … … 272 272 typename GR::Edge te; 273 273 274 274 SmartBpGraph::NodeMap<typename GR::Node> nr(from); 275 SmartBpGraph::Red Map<typename GR::RedNode> rnr(from);276 SmartBpGraph::Blue Map<typename GR::BlueNode> bnr(from);275 SmartBpGraph::RedNodeMap<typename GR::RedNode> rnr(from); 276 SmartBpGraph::BlueNodeMap<typename GR::BlueNode> bnr(from); 277 277 SmartBpGraph::ArcMap<typename GR::Arc> ar(from); 278 278 SmartBpGraph::EdgeMap<typename GR::Edge> er(from); 279 279 280 280 typename GR::template NodeMap<SmartBpGraph::Node> ncr(to); 281 typename GR::template Red Map<SmartBpGraph::RedNode> rncr(to);282 typename GR::template Blue Map<SmartBpGraph::BlueNode> bncr(to);281 typename GR::template RedNodeMap<SmartBpGraph::RedNode> rncr(to); 282 typename GR::template BlueNodeMap<SmartBpGraph::BlueNode> bncr(to); 283 283 typename GR::template ArcMap<SmartBpGraph::Arc> acr(to); 284 284 typename GR::template EdgeMap<SmartBpGraph::Edge> ecr(to); 285 285 286 286 bpGraphCopy(from, to). 287 nodeMap(fnm, tnm).redMap(frnm, trnm).blueMap(fbnm, tbnm). 287 nodeMap(fnm, tnm). 288 redNodeMap(frnm, trnm).blueNodeMap(fbnm, tbnm). 288 289 arcMap(fam, tam).edgeMap(fem, tem). 289 290 nodeRef(nr).redRef(rnr).blueRef(bnr). 290 291 arcRef(ar).edgeRef(er). … … 304 305 check(fnm[it] == tnm[nr[it]], "Wrong copy."); 305 306 } 306 307 307 for (SmartBpGraph::Red It it(from); it != INVALID; ++it) {308 for (SmartBpGraph::RedNodeIt it(from); it != INVALID; ++it) { 308 309 check(ncr[nr[it]] == it, "Wrong copy."); 309 310 check(fnm[it] == tnm[nr[it]], "Wrong copy."); 310 311 check(rnr[it] == nr[it], "Wrong copy."); … … 313 314 check(to.red(rnr[it]), "Wrong copy."); 314 315 } 315 316 316 for (SmartBpGraph::Blue It it(from); it != INVALID; ++it) {317 for (SmartBpGraph::BlueNodeIt it(from); it != INVALID; ++it) { 317 318 check(ncr[nr[it]] == it, "Wrong copy."); 318 319 check(fnm[it] == tnm[nr[it]], "Wrong copy."); 319 320 check(bnr[it] == nr[it], "Wrong copy."); … … 343 344 for (typename GR::NodeIt it(to); it != INVALID; ++it) { 344 345 check(nr[ncr[it]] == it, "Wrong copy."); 345 346 } 346 for (typename GR::Red It it(to); it != INVALID; ++it) {347 for (typename GR::RedNodeIt it(to); it != INVALID; ++it) { 347 348 check(rncr[it] == ncr[it], "Wrong copy."); 348 349 check(rnr[rncr[it]] == it, "Wrong copy."); 349 350 } 350 for (typename GR::Blue It it(to); it != INVALID; ++it) {351 for (typename GR::BlueNodeIt it(to); it != INVALID; ++it) { 351 352 check(bncr[it] == ncr[it], "Wrong copy."); 352 353 check(bnr[bncr[it]] == it, "Wrong copy."); 353 354 } -
test/graph_test.h
diff -r 434a20e74585 -r d248eca9ca25 test/graph_test.h
a b 43 43 template<class Graph> 44 44 void checkGraphRedNodeList(const Graph &G, int cnt) 45 45 { 46 typename Graph::Red It n(G);46 typename Graph::RedNodeIt n(G); 47 47 for(int i=0;i<cnt;i++) { 48 48 check(n!=INVALID,"Wrong red Node list linking."); 49 49 check(G.red(n),"Wrong node set check."); … … 65 65 template<class Graph> 66 66 void checkGraphBlueNodeList(const Graph &G, int cnt) 67 67 { 68 typename Graph::Blue It n(G);68 typename Graph::BlueNodeIt n(G); 69 69 for(int i=0;i<cnt;i++) { 70 70 check(n!=INVALID,"Wrong blue Node list linking."); 71 71 check(G.blue(n),"Wrong node set check."); … … 225 225 void checkRedNodeIds(const Graph& G) { 226 226 typedef typename Graph::RedNode RedNode; 227 227 std::set<int> values; 228 for (typename Graph::Red It n(G); n != INVALID; ++n) {228 for (typename Graph::RedNodeIt n(G); n != INVALID; ++n) { 229 229 check(G.red(n), "Wrong partition"); 230 230 check(values.find(G.id(n)) == values.end(), "Wrong id"); 231 231 check(G.id(n) <= G.maxRedId(), "Wrong maximum id"); … … 238 238 void checkBlueNodeIds(const Graph& G) { 239 239 typedef typename Graph::BlueNode BlueNode; 240 240 std::set<int> values; 241 for (typename Graph::Blue It n(G); n != INVALID; ++n) {241 for (typename Graph::BlueNodeIt n(G); n != INVALID; ++n) { 242 242 check(G.blue(n), "Wrong partition"); 243 243 check(values.find(G.id(n)) == values.end(), "Wrong id"); 244 244 check(G.id(n) <= G.maxBlueId(), "Wrong maximum id"); … … 304 304 } 305 305 306 306 template <typename Graph> 307 void checkGraphRed Map(const Graph& G) {307 void checkGraphRedNodeMap(const Graph& G) { 308 308 typedef typename Graph::Node Node; 309 typedef typename Graph::Red It RedIt;309 typedef typename Graph::RedNodeIt RedNodeIt; 310 310 311 typedef typename Graph::template Red Map<int> IntRedMap;312 IntRed Map map(G, 42);313 for (Red It it(G); it != INVALID; ++it) {311 typedef typename Graph::template RedNodeMap<int> IntRedNodeMap; 312 IntRedNodeMap map(G, 42); 313 for (RedNodeIt it(G); it != INVALID; ++it) { 314 314 check(map[it] == 42, "Wrong map constructor."); 315 315 } 316 316 int s = 0; 317 for (Red It it(G); it != INVALID; ++it) {317 for (RedNodeIt it(G); it != INVALID; ++it) { 318 318 map[it] = 0; 319 319 check(map[it] == 0, "Wrong operator[]."); 320 320 map.set(it, s); … … 322 322 ++s; 323 323 } 324 324 s = s * (s - 1) / 2; 325 for (Red It it(G); it != INVALID; ++it) {325 for (RedNodeIt it(G); it != INVALID; ++it) { 326 326 s -= map[it]; 327 327 } 328 328 check(s == 0, "Wrong sum."); … … 334 334 } 335 335 336 336 template <typename Graph> 337 void checkGraphBlue Map(const Graph& G) {337 void checkGraphBlueNodeMap(const Graph& G) { 338 338 typedef typename Graph::Node Node; 339 typedef typename Graph::Blue It BlueIt;339 typedef typename Graph::BlueNodeIt BlueNodeIt; 340 340 341 typedef typename Graph::template Blue Map<int> IntBlueMap;342 IntBlue Map map(G, 42);343 for (Blue It it(G); it != INVALID; ++it) {341 typedef typename Graph::template BlueNodeMap<int> IntBlueNodeMap; 342 IntBlueNodeMap map(G, 42); 343 for (BlueNodeIt it(G); it != INVALID; ++it) { 344 344 check(map[it] == 42, "Wrong map constructor."); 345 345 } 346 346 int s = 0; 347 for (Blue It it(G); it != INVALID; ++it) {347 for (BlueNodeIt it(G); it != INVALID; ++it) { 348 348 map[it] = 0; 349 349 check(map[it] == 0, "Wrong operator[]."); 350 350 map.set(it, s); … … 352 352 ++s; 353 353 } 354 354 s = s * (s - 1) / 2; 355 for (Blue It it(G); it != INVALID; ++it) {355 for (BlueNodeIt it(G); it != INVALID; ++it) { 356 356 s -= map[it]; 357 357 } 358 358 check(s == 0, "Wrong sum.");