Changeset 1026:699c7eac2c6d in lemon-main
- Timestamp:
- 01/11/12 22:21:07 (13 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/graph_extender.h
r1025 r1026 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() {}921 922 Red It(Invalid i) : RedNode(i) { }923 924 explicit Red It(const BpGraph& graph) : _graph(&graph) {920 RedNodeIt() {} 921 922 RedNodeIt(Invalid i) : RedNode(i) { } 923 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; … … 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() {}943 944 Blue It(Invalid i) : BlueNode(i) { }945 946 explicit Blue It(const BpGraph& graph) : _graph(&graph) {942 BlueNodeIt() {} 943 944 BlueNodeIt(Invalid i) : BlueNode(i) { } 945 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; … … 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; … … 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; -
lemon/bits/traits.h
r1019 r1026 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;182 183 public: 184 typedef typename GR::template Red Map<V> Type;180 class Map : public GR::template RedNodeMap<V> { 181 typedef typename GR::template RedNodeMap<V> Parent; 182 183 public: 184 typedef typename GR::template RedNodeMap<V> Type; 185 185 typedef typename Parent::Value Value; 186 186 … … 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;223 224 public: 225 typedef typename GR::template Blue Map<V> Type;221 class Map : public GR::template BlueNodeMap<V> { 222 typedef typename GR::template BlueNodeMap<V> Parent; 223 224 public: 225 typedef typename GR::template BlueNodeMap<V> Type; 226 226 typedef typename Parent::Value Value; 227 227 -
lemon/concepts/bpgraph.h
r1025 r1026 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 … … 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 … … 194 194 /// Default constructor. 195 195 /// \warning It sets the iterator to an undefined value. 196 Red It() { }197 /// Copy constructor. 198 199 /// Copy constructor. 200 /// 201 Red It(const RedIt& n) : RedNode(n) { }196 RedNodeIt() { } 197 /// Copy constructor. 198 199 /// Copy constructor. 200 /// 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 … … 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 … … 237 237 /// Default constructor. 238 238 /// \warning It sets the iterator to an undefined value. 239 Blue It() { }240 /// Copy constructor. 241 242 /// Copy constructor. 243 /// 244 Blue It(const BlueIt& n) : BlueNode(n) { }239 BlueNodeIt() { } 240 /// Copy constructor. 241 242 /// Copy constructor. 243 /// 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 … … 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; … … 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; -
lemon/concepts/graph_components.h
r1025 r1026 1207 1207 /// 1208 1208 /// This iterator goes through each red node. 1209 typedef GraphItemIt<BpGraph, RedNode> Red It;1209 typedef GraphItemIt<BpGraph, RedNode> RedNodeIt; 1210 1210 1211 1211 /// \brief This iterator goes through each blue node. 1212 1212 /// 1213 1213 /// This iterator goes through each blue node. 1214 typedef GraphItemIt<BpGraph, BlueNode> Blue It;1214 typedef GraphItemIt<BpGraph, BlueNode> BlueNodeIt; 1215 1215 1216 1216 /// @} … … 1229 1229 1230 1230 checkConcept<GraphItemIt<_BpGraph, typename _BpGraph::RedNode>, 1231 typename _BpGraph::Red It>();1231 typename _BpGraph::RedNodeIt>(); 1232 1232 checkConcept<GraphItemIt<_BpGraph, typename _BpGraph::BlueNode>, 1233 typename _BpGraph::Blue It>();1233 typename _BpGraph::BlueNodeIt>(); 1234 1234 } 1235 1235 … … 1716 1716 /// bipartite graphs. It extends \ref MappableGraphComponent with 1717 1717 /// the standard graph map class for red and blue nodes (\c 1718 /// RedMap and BlueMap). This concept is part of the BpGraph concept. 1718 /// RedNodeMap and BlueNodeMap). This concept is part of the 1719 /// BpGraph concept. 1719 1720 template <typename BAS = BaseBpGraphComponent> 1720 1721 class MappableBpGraphComponent : public MappableGraphComponent<BAS> { … … 1731 1732 /// It conforms to the ReferenceMap concept. 1732 1733 template <typename V> 1733 class Red Map : public GraphMap<MappableBpGraphComponent, Node, V> {1734 class RedNodeMap : public GraphMap<MappableBpGraphComponent, Node, V> { 1734 1735 typedef GraphMap<MappableBpGraphComponent, Node, V> Parent; 1735 1736 … … 1738 1739 /// 1739 1740 /// Construct a new map for the graph. 1740 explicit Red Map(const MappableBpGraphComponent& graph)1741 explicit RedNodeMap(const MappableBpGraphComponent& graph) 1741 1742 : Parent(graph) {} 1742 1743 … … 1744 1745 /// 1745 1746 /// Construct a new map for the graph and initalize the values. 1746 Red Map(const MappableBpGraphComponent& graph, const V& value)1747 RedNodeMap(const MappableBpGraphComponent& graph, const V& value) 1747 1748 : Parent(graph, value) {} 1748 1749 … … 1751 1752 /// 1752 1753 /// Copy Constructor. 1753 Red Map(const RedMap& nm) : Parent(nm) {}1754 RedNodeMap(const RedNodeMap& nm) : Parent(nm) {} 1754 1755 1755 1756 /// \brief Assignment operator. … … 1757 1758 /// Assignment operator. 1758 1759 template <typename CMap> 1759 Red Map& operator=(const CMap&) {1760 RedNodeMap& operator=(const CMap&) { 1760 1761 checkConcept<ReadMap<Node, V>, CMap>(); 1761 1762 return *this; … … 1769 1770 /// It conforms to the ReferenceMap concept. 1770 1771 template <typename V> 1771 class Blue Map : public GraphMap<MappableBpGraphComponent, Node, V> {1772 class BlueNodeMap : public GraphMap<MappableBpGraphComponent, Node, V> { 1772 1773 typedef GraphMap<MappableBpGraphComponent, Node, V> Parent; 1773 1774 … … 1776 1777 /// 1777 1778 /// Construct a new map for the graph. 1778 explicit Blue Map(const MappableBpGraphComponent& graph)1779 explicit BlueNodeMap(const MappableBpGraphComponent& graph) 1779 1780 : Parent(graph) {} 1780 1781 … … 1782 1783 /// 1783 1784 /// Construct a new map for the graph and initalize the values. 1784 Blue Map(const MappableBpGraphComponent& graph, const V& value)1785 BlueNodeMap(const MappableBpGraphComponent& graph, const V& value) 1785 1786 : Parent(graph, value) {} 1786 1787 … … 1789 1790 /// 1790 1791 /// Copy Constructor. 1791 Blue Map(const BlueMap& nm) : Parent(nm) {}1792 BlueNodeMap(const BlueNodeMap& nm) : Parent(nm) {} 1792 1793 1793 1794 /// \brief Assignment operator. … … 1795 1796 /// Assignment operator. 1796 1797 template <typename CMap> 1797 Blue Map& operator=(const CMap&) {1798 BlueNodeMap& operator=(const CMap&) { 1798 1799 checkConcept<ReadMap<Node, V>, CMap>(); 1799 1800 return *this; … … 1816 1817 1817 1818 { // int map test 1818 typedef typename _BpGraph::template RedMap<int> IntRedMap; 1819 typedef typename _BpGraph::template RedNodeMap<int> 1820 IntRedNodeMap; 1819 1821 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, int>, 1820 IntRed Map >();1822 IntRedNodeMap >(); 1821 1823 } { // bool map test 1822 typedef typename _BpGraph::template RedMap<bool> BoolRedMap; 1824 typedef typename _BpGraph::template RedNodeMap<bool> 1825 BoolRedNodeMap; 1823 1826 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, bool>, 1824 BoolRed Map >();1827 BoolRedNodeMap >(); 1825 1828 } { // Dummy map test 1826 typedef typename _BpGraph::template RedMap<Dummy> DummyRedMap; 1829 typedef typename _BpGraph::template RedNodeMap<Dummy> 1830 DummyRedNodeMap; 1827 1831 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, Dummy>, 1828 DummyRed Map >();1832 DummyRedNodeMap >(); 1829 1833 } 1830 1834 1831 1835 { // int map test 1832 typedef typename _BpGraph::template BlueMap<int> IntBlueMap; 1836 typedef typename _BpGraph::template BlueNodeMap<int> 1837 IntBlueNodeMap; 1833 1838 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, int>, 1834 IntBlue Map >();1839 IntBlueNodeMap >(); 1835 1840 } { // bool map test 1836 typedef typename _BpGraph::template BlueMap<bool> BoolBlueMap; 1841 typedef typename _BpGraph::template BlueNodeMap<bool> 1842 BoolBlueNodeMap; 1837 1843 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, bool>, 1838 BoolBlue Map >();1844 BoolBlueNodeMap >(); 1839 1845 } { // Dummy map test 1840 typedef typename _BpGraph::template BlueMap<Dummy> DummyBlueMap; 1846 typedef typename _BpGraph::template BlueNodeMap<Dummy> 1847 DummyBlueNodeMap; 1841 1848 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, Dummy>, 1842 DummyBlue Map >();1849 DummyBlueNodeMap >(); 1843 1850 } 1844 1851 } -
lemon/core.h
r1025 r1026 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 … … 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 … … 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. … … 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 } … … 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; … … 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 … … 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)); … … 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)); -
lemon/lgf_reader.h
r1024 r1026 2149 2149 /// sections can contain different set of maps. 2150 2150 /// 2151 /// The red and blue maps are read from the corresponding2151 /// The red and blue node maps are read from the corresponding 2152 2152 /// sections. If a map is defined with the same name in both of 2153 2153 /// these sections, then it can be read as a node map. … … 2338 2338 } 2339 2339 2340 /// Add a red map reading rule to the reader.2340 /// Add a red node map reading rule to the reader. 2341 2341 template <typename Map> 2342 BpGraphReader& red Map(const std::string& caption, Map& map) {2342 BpGraphReader& redNodeMap(const std::string& caption, Map& map) { 2343 2343 checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>(); 2344 2344 _reader_bits::MapStorageBase<Node>* storage = … … 2348 2348 } 2349 2349 2350 /// \brief Red map reading rule2351 /// 2352 /// Add a red map reading rule with specialized converter to the2353 /// reader.2350 /// \brief Red node map reading rule 2351 /// 2352 /// Add a red node map node reading rule with specialized converter to 2353 /// the reader. 2354 2354 template <typename Map, typename Converter> 2355 BpGraphReader& red Map(const std::string& caption, Map& map,2356 const Converter& converter = Converter()) {2355 BpGraphReader& redNodeMap(const std::string& caption, Map& map, 2356 const Converter& converter = Converter()) { 2357 2357 checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>(); 2358 2358 _reader_bits::MapStorageBase<Node>* storage = … … 2362 2362 } 2363 2363 2364 /// Add a blue map reading rule to the reader.2364 /// Add a blue node map reading rule to the reader. 2365 2365 template <typename Map> 2366 BpGraphReader& blue Map(const std::string& caption, Map& map) {2366 BpGraphReader& blueNodeMap(const std::string& caption, Map& map) { 2367 2367 checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>(); 2368 2368 _reader_bits::MapStorageBase<Node>* storage = … … 2372 2372 } 2373 2373 2374 /// \brief Blue map reading rule2375 /// 2376 /// Add a blue map reading rule with specialized converter to the2377 /// reader.2374 /// \brief Blue node map reading rule 2375 /// 2376 /// Add a blue node map reading rule with specialized converter to 2377 /// the reader. 2378 2378 template <typename Map, typename Converter> 2379 BpGraphReader& blue Map(const std::string& caption, Map& map,2380 const Converter& converter = Converter()) {2379 BpGraphReader& blueNodeMap(const std::string& caption, Map& map, 2380 const Converter& converter = Converter()) { 2381 2381 checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>(); 2382 2382 _reader_bits::MapStorageBase<Node>* storage = … … 2685 2685 if (maps.find(map) != maps.end()) { 2686 2686 std::ostringstream msg; 2687 msg << "Multiple occurence of red map: " << map;2687 msg << "Multiple occurence of red node map: " << map; 2688 2688 throw FormatError(msg.str()); 2689 2689 } … … 2778 2778 if (maps.find(map) != maps.end()) { 2779 2779 std::ostringstream msg; 2780 msg << "Multiple occurence of blue map: " << map;2780 msg << "Multiple occurence of blue node map: " << map; 2781 2781 throw FormatError(msg.str()); 2782 2782 } -
lemon/lgf_writer.h
r1024 r1026 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. … … 1806 1806 } 1807 1807 1808 /// \brief Red map writing rule1809 /// 1810 /// Add a red map writing rule to the writer.1808 /// \brief Red node map writing rule 1809 /// 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 = … … 1818 1818 } 1819 1819 1820 /// \brief Red map writing rule1821 /// 1822 /// Add a red map writing rule with specialized converter to the1820 /// \brief Red node map writing rule 1821 /// 1822 /// 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 = … … 1832 1832 } 1833 1833 1834 /// \brief Blue map writing rule1835 /// 1836 /// Add a blue map writing rule to the writer.1834 /// \brief Blue node map writing rule 1835 /// 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 = … … 1844 1844 } 1845 1845 1846 /// \brief Blue map writing rule1847 /// 1848 /// Add a blue map writing rule with specialized converter to the1846 /// \brief Blue node map writing rule 1847 /// 1848 /// 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 = … … 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 } … … 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 } -
test/bpgraph_test.cc
r1025 r1026 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); … … 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); … … 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); … … 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); … … 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); -
test/graph_copy_test.cc
r1025 r1026 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); … … 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); … … 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). … … 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."); … … 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."); … … 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."); -
test/graph_test.h
r1025 r1026 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."); … … 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."); … … 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"); … … 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"); … … 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;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) {309 typedef typename Graph::RedNodeIt RedNodeIt; 310 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[]."); … … 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 } … … 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;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) {339 typedef typename Graph::BlueNodeIt BlueNodeIt; 340 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[]."); … … 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 }
Note: See TracChangeset
for help on using the changeset viewer.