Changeset 1026:699c7eac2c6d in lemon-main for lemon/concepts
- Timestamp:
- 01/11/12 22:21:07 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- lemon/concepts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.