Changes in lemon/concepts/graph_components.h [1270:dceba191c00d:1159:7fdaa05a69a1] in lemon
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/concepts/graph_components.h
r1270 r1159 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 35 * Copyright (C) 2003-2010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 109 109 110 110 bool b; 111 ::lemon::ignore_unused_variable_warning(b);112 113 111 b = (ia == ib) && (ia != ib); 114 112 b = (ia == INVALID) && (ib != INVALID); … … 290 288 ue = e; 291 289 bool d = graph.direction(e); 292 ::lemon::ignore_unused_variable_warning(d);290 ignore_unused_variable_warning(d); 293 291 } 294 292 } … … 296 294 const _Graph& graph; 297 295 Constraints() {} 298 };299 300 };301 302 /// \brief Base skeleton class for undirected bipartite graphs.303 ///304 /// This class describes the base interface of undirected305 /// bipartite graph types. All bipartite graph %concepts have to306 /// conform to this class. It extends the interface of \ref307 /// BaseGraphComponent with an \c Edge type and functions to get308 /// the end nodes of edges, to convert from arcs to edges and to309 /// get both direction of edges.310 class BaseBpGraphComponent : public BaseGraphComponent {311 public:312 313 typedef BaseBpGraphComponent BpGraph;314 315 typedef BaseDigraphComponent::Node Node;316 typedef BaseDigraphComponent::Arc Arc;317 318 /// \brief Class to represent red nodes.319 ///320 /// This class represents the red nodes of the graph. The red321 /// nodes can also be used as normal nodes.322 class RedNode : public Node {323 typedef Node Parent;324 325 public:326 /// \brief Default constructor.327 ///328 /// Default constructor.329 /// \warning The default constructor is not required to set330 /// the item to some well-defined value. So you should consider it331 /// as uninitialized.332 RedNode() {}333 334 /// \brief Copy constructor.335 ///336 /// Copy constructor.337 RedNode(const RedNode &) : Parent() {}338 339 /// \brief Constructor for conversion from \c INVALID.340 ///341 /// Constructor for conversion from \c INVALID.342 /// It initializes the item to be invalid.343 /// \sa Invalid for more details.344 RedNode(Invalid) {}345 };346 347 /// \brief Class to represent blue nodes.348 ///349 /// This class represents the blue nodes of the graph. The blue350 /// nodes can also be used as normal nodes.351 class BlueNode : public Node {352 typedef Node Parent;353 354 public:355 /// \brief Default constructor.356 ///357 /// Default constructor.358 /// \warning The default constructor is not required to set359 /// the item to some well-defined value. So you should consider it360 /// as uninitialized.361 BlueNode() {}362 363 /// \brief Copy constructor.364 ///365 /// Copy constructor.366 BlueNode(const BlueNode &) : Parent() {}367 368 /// \brief Constructor for conversion from \c INVALID.369 ///370 /// Constructor for conversion from \c INVALID.371 /// It initializes the item to be invalid.372 /// \sa Invalid for more details.373 BlueNode(Invalid) {}374 375 /// \brief Constructor for conversion from a node.376 ///377 /// Constructor for conversion from a node. The conversion can378 /// be invalid, since the Node can be member of the red379 /// set.380 BlueNode(const Node&) {}381 };382 383 /// \brief Gives back %true for red nodes.384 ///385 /// Gives back %true for red nodes.386 bool red(const Node&) const { return true; }387 388 /// \brief Gives back %true for blue nodes.389 ///390 /// Gives back %true for blue nodes.391 bool blue(const Node&) const { return true; }392 393 /// \brief Gives back the red end node of the edge.394 ///395 /// Gives back the red end node of the edge.396 RedNode redNode(const Edge&) const { return RedNode(); }397 398 /// \brief Gives back the blue end node of the edge.399 ///400 /// Gives back the blue end node of the edge.401 BlueNode blueNode(const Edge&) const { return BlueNode(); }402 403 /// \brief Converts the node to red node object.404 ///405 /// This function converts unsafely the node to red node406 /// object. It should be called only if the node is from the red407 /// partition or INVALID.408 RedNode asRedNodeUnsafe(const Node&) const { return RedNode(); }409 410 /// \brief Converts the node to blue node object.411 ///412 /// This function converts unsafely the node to blue node413 /// object. It should be called only if the node is from the red414 /// partition or INVALID.415 BlueNode asBlueNodeUnsafe(const Node&) const { return BlueNode(); }416 417 /// \brief Converts the node to red node object.418 ///419 /// This function converts safely the node to red node420 /// object. If the node is not from the red partition, then it421 /// returns INVALID.422 RedNode asRedNode(const Node&) const { return RedNode(); }423 424 /// \brief Converts the node to blue node object.425 ///426 /// This function converts unsafely the node to blue node427 /// object. If the node is not from the blue partition, then it428 /// returns INVALID.429 BlueNode asBlueNode(const Node&) const { return BlueNode(); }430 431 template <typename _BpGraph>432 struct Constraints {433 typedef typename _BpGraph::Node Node;434 typedef typename _BpGraph::RedNode RedNode;435 typedef typename _BpGraph::BlueNode BlueNode;436 typedef typename _BpGraph::Arc Arc;437 typedef typename _BpGraph::Edge Edge;438 439 void constraints() {440 checkConcept<BaseGraphComponent, _BpGraph>();441 checkConcept<GraphItem<'n'>, RedNode>();442 checkConcept<GraphItem<'n'>, BlueNode>();443 {444 Node n;445 RedNode rn;446 BlueNode bn;447 Node rnan = rn;448 Node bnan = bn;449 Edge e;450 bool b;451 b = bpgraph.red(rnan);452 b = bpgraph.blue(bnan);453 rn = bpgraph.redNode(e);454 bn = bpgraph.blueNode(e);455 rn = bpgraph.asRedNodeUnsafe(rnan);456 bn = bpgraph.asBlueNodeUnsafe(bnan);457 rn = bpgraph.asRedNode(rnan);458 bn = bpgraph.asBlueNode(bnan);459 ::lemon::ignore_unused_variable_warning(b);460 }461 }462 463 const _BpGraph& bpgraph;464 296 }; 465 297 … … 535 367 536 368 nid = digraph.maxNodeId(); 537 ::lemon::ignore_unused_variable_warning(nid);369 ignore_unused_variable_warning(nid); 538 370 eid = digraph.maxArcId(); 539 ::lemon::ignore_unused_variable_warning(eid);371 ignore_unused_variable_warning(eid); 540 372 } 541 373 … … 590 422 edge = graph.edgeFromId(ueid); 591 423 ueid = graph.maxEdgeId(); 592 ::lemon::ignore_unused_variable_warning(ueid);424 ignore_unused_variable_warning(ueid); 593 425 } 594 426 595 427 const _Graph& graph; 596 428 Constraints() {} 597 };598 };599 600 /// \brief Skeleton class for \e idable undirected bipartite graphs.601 ///602 /// This class describes the interface of \e idable undirected603 /// bipartite graphs. It extends \ref IDableGraphComponent with604 /// the core ID functions of undirected bipartite graphs. Beside605 /// the regular node ids, this class also provides ids within the606 /// the red and blue sets of the nodes. This concept is part of607 /// the BpGraph concept.608 template <typename BAS = BaseBpGraphComponent>609 class IDableBpGraphComponent : public IDableGraphComponent<BAS> {610 public:611 612 typedef BAS Base;613 typedef IDableGraphComponent<BAS> Parent;614 typedef typename Base::Node Node;615 typedef typename Base::RedNode RedNode;616 typedef typename Base::BlueNode BlueNode;617 618 using Parent::id;619 620 /// \brief Return a unique integer id for the given node in the red set.621 ///622 /// Return a unique integer id for the given node in the red set.623 int id(const RedNode&) const { return -1; }624 625 /// \brief Return a unique integer id for the given node in the blue set.626 ///627 /// Return a unique integer id for the given node in the blue set.628 int id(const BlueNode&) const { return -1; }629 630 /// \brief Return an integer greater or equal to the maximum631 /// node id in the red set.632 ///633 /// Return an integer greater or equal to the maximum634 /// node id in the red set.635 int maxRedId() const { return -1; }636 637 /// \brief Return an integer greater or equal to the maximum638 /// node id in the blue set.639 ///640 /// Return an integer greater or equal to the maximum641 /// node id in the blue set.642 int maxBlueId() const { return -1; }643 644 template <typename _BpGraph>645 struct Constraints {646 647 void constraints() {648 checkConcept<IDableGraphComponent<Base>, _BpGraph>();649 typename _BpGraph::Node node;650 typename _BpGraph::RedNode red;651 typename _BpGraph::BlueNode blue;652 int rid = bpgraph.id(red);653 int bid = bpgraph.id(blue);654 rid = bpgraph.maxRedId();655 bid = bpgraph.maxBlueId();656 ::lemon::ignore_unused_variable_warning(rid);657 ::lemon::ignore_unused_variable_warning(bid);658 }659 660 const _BpGraph& bpgraph;661 429 }; 662 430 }; … … 727 495 _GraphItemIt it3 = it1; 728 496 _GraphItemIt it4 = INVALID; 729 ::lemon::ignore_unused_variable_warning(it3);730 ::lemon::ignore_unused_variable_warning(it4);497 ignore_unused_variable_warning(it3); 498 ignore_unused_variable_warning(it4); 731 499 732 500 it2 = ++it1; … … 818 586 _GraphIncIt it3 = it1; 819 587 _GraphIncIt it4 = INVALID; 820 ::lemon::ignore_unused_variable_warning(it3);821 ::lemon::ignore_unused_variable_warning(it4);588 ignore_unused_variable_warning(it3); 589 ignore_unused_variable_warning(it4); 822 590 823 591 it2 = ++it1; … … 876 644 void next(Arc&) const {} 877 645 878 /// \brief Return the first arc incom ing to the given node.879 /// 880 /// This function gives back the first arc incom ing to the646 /// \brief Return the first arc incomming to the given node. 647 /// 648 /// This function gives back the first arc incomming to the 881 649 /// given node. 882 650 void firstIn(Arc&, const Node&) const {} 883 651 884 /// \brief Return the next arc incom ing to the given node.885 /// 886 /// This function gives back the next arc incom ing to the652 /// \brief Return the next arc incomming to the given node. 653 /// 654 /// This function gives back the next arc incomming to the 887 655 /// given node. 888 656 void nextIn(Arc&) const {} … … 1001 769 n = digraph.baseNode(oait); 1002 770 n = digraph.runningNode(oait); 1003 ::lemon::ignore_unused_variable_warning(n);771 ignore_unused_variable_warning(n); 1004 772 } 1005 773 } … … 1135 903 }; 1136 904 1137 /// \brief Skeleton class for iterable undirected bipartite graphs.1138 ///1139 /// This class describes the interface of iterable undirected1140 /// bipartite graphs. It extends \ref IterableGraphComponent with1141 /// the core iterable interface of undirected bipartite graphs.1142 /// This concept is part of the BpGraph concept.1143 template <typename BAS = BaseBpGraphComponent>1144 class IterableBpGraphComponent : public IterableGraphComponent<BAS> {1145 public:1146 1147 typedef BAS Base;1148 typedef typename Base::Node Node;1149 typedef typename Base::RedNode RedNode;1150 typedef typename Base::BlueNode BlueNode;1151 typedef typename Base::Arc Arc;1152 typedef typename Base::Edge Edge;1153 1154 typedef IterableBpGraphComponent BpGraph;1155 1156 using IterableGraphComponent<BAS>::first;1157 using IterableGraphComponent<BAS>::next;1158 1159 /// \name Base Iteration1160 ///1161 /// This interface provides functions for iteration on red and blue nodes.1162 ///1163 /// @{1164 1165 /// \brief Return the first red node.1166 ///1167 /// This function gives back the first red node in the iteration order.1168 void first(RedNode&) const {}1169 1170 /// \brief Return the next red node.1171 ///1172 /// This function gives back the next red node in the iteration order.1173 void next(RedNode&) const {}1174 1175 /// \brief Return the first blue node.1176 ///1177 /// This function gives back the first blue node in the iteration order.1178 void first(BlueNode&) const {}1179 1180 /// \brief Return the next blue node.1181 ///1182 /// This function gives back the next blue node in the iteration order.1183 void next(BlueNode&) const {}1184 1185 1186 /// @}1187 1188 /// \name Class Based Iteration1189 ///1190 /// This interface provides iterator classes for red and blue nodes.1191 ///1192 /// @{1193 1194 /// \brief This iterator goes through each red node.1195 ///1196 /// This iterator goes through each red node.1197 typedef GraphItemIt<BpGraph, RedNode> RedNodeIt;1198 1199 /// \brief This iterator goes through each blue node.1200 ///1201 /// This iterator goes through each blue node.1202 typedef GraphItemIt<BpGraph, BlueNode> BlueNodeIt;1203 1204 /// @}1205 1206 template <typename _BpGraph>1207 struct Constraints {1208 void constraints() {1209 checkConcept<IterableGraphComponent<Base>, _BpGraph>();1210 1211 typename _BpGraph::RedNode rn(INVALID);1212 bpgraph.first(rn);1213 bpgraph.next(rn);1214 typename _BpGraph::BlueNode bn(INVALID);1215 bpgraph.first(bn);1216 bpgraph.next(bn);1217 1218 checkConcept<GraphItemIt<_BpGraph, typename _BpGraph::RedNode>,1219 typename _BpGraph::RedNodeIt>();1220 checkConcept<GraphItemIt<_BpGraph, typename _BpGraph::BlueNode>,1221 typename _BpGraph::BlueNodeIt>();1222 }1223 1224 const _BpGraph& bpgraph;1225 };1226 };1227 1228 905 /// \brief Skeleton class for alterable directed graphs. 1229 906 /// … … 1251 928 ArcNotifier; 1252 929 1253 mutable NodeNotifier node_notifier;1254 mutable ArcNotifier arc_notifier;1255 1256 930 /// \brief Return the node alteration notifier. 1257 931 /// 1258 932 /// This function gives back the node alteration notifier. 1259 933 NodeNotifier& notifier(Node) const { 1260 return node_notifier;934 return NodeNotifier(); 1261 935 } 1262 936 … … 1265 939 /// This function gives back the arc alteration notifier. 1266 940 ArcNotifier& notifier(Arc) const { 1267 return arc_notifier;941 return ArcNotifier(); 1268 942 } 1269 943 … … 1278 952 = digraph.notifier(typename _Digraph::Arc()); 1279 953 1280 ::lemon::ignore_unused_variable_warning(nn);1281 ::lemon::ignore_unused_variable_warning(en);954 ignore_unused_variable_warning(nn); 955 ignore_unused_variable_warning(en); 1282 956 } 1283 957 … … 1301 975 1302 976 typedef BAS Base; 1303 typedef AlterableDigraphComponent<Base> Parent;1304 977 typedef typename Base::Edge Edge; 1305 978 … … 1309 982 EdgeNotifier; 1310 983 1311 mutable EdgeNotifier edge_notifier;1312 1313 using Parent::notifier;1314 1315 984 /// \brief Return the edge alteration notifier. 1316 985 /// 1317 986 /// This function gives back the edge alteration notifier. 1318 987 EdgeNotifier& notifier(Edge) const { 1319 return edge_notifier;988 return EdgeNotifier(); 1320 989 } 1321 990 … … 1326 995 typename _Graph::EdgeNotifier& uen 1327 996 = graph.notifier(typename _Graph::Edge()); 1328 ::lemon::ignore_unused_variable_warning(uen);997 ignore_unused_variable_warning(uen); 1329 998 } 1330 999 1331 1000 const _Graph& graph; 1332 1001 Constraints() {} 1333 };1334 };1335 1336 /// \brief Skeleton class for alterable undirected bipartite graphs.1337 ///1338 /// This class describes the interface of alterable undirected1339 /// bipartite graphs. It extends \ref AlterableGraphComponent with1340 /// the alteration notifier interface of bipartite graphs. It1341 /// implements an observer-notifier pattern for the red and blue1342 /// nodes. More obsevers can be registered into the notifier and1343 /// whenever an alteration occured in the graph all the observers1344 /// will be notified about it.1345 template <typename BAS = BaseBpGraphComponent>1346 class AlterableBpGraphComponent : public AlterableGraphComponent<BAS> {1347 public:1348 1349 typedef BAS Base;1350 typedef AlterableGraphComponent<Base> Parent;1351 typedef typename Base::RedNode RedNode;1352 typedef typename Base::BlueNode BlueNode;1353 1354 1355 /// Red node alteration notifier class.1356 typedef AlterationNotifier<AlterableBpGraphComponent, RedNode>1357 RedNodeNotifier;1358 1359 /// Blue node alteration notifier class.1360 typedef AlterationNotifier<AlterableBpGraphComponent, BlueNode>1361 BlueNodeNotifier;1362 1363 mutable RedNodeNotifier red_node_notifier;1364 mutable BlueNodeNotifier blue_node_notifier;1365 1366 using Parent::notifier;1367 1368 /// \brief Return the red node alteration notifier.1369 ///1370 /// This function gives back the red node alteration notifier.1371 RedNodeNotifier& notifier(RedNode) const {1372 return red_node_notifier;1373 }1374 1375 /// \brief Return the blue node alteration notifier.1376 ///1377 /// This function gives back the blue node alteration notifier.1378 BlueNodeNotifier& notifier(BlueNode) const {1379 return blue_node_notifier;1380 }1381 1382 template <typename _BpGraph>1383 struct Constraints {1384 void constraints() {1385 checkConcept<AlterableGraphComponent<Base>, _BpGraph>();1386 typename _BpGraph::RedNodeNotifier& rnn1387 = bpgraph.notifier(typename _BpGraph::RedNode());1388 typename _BpGraph::BlueNodeNotifier& bnn1389 = bpgraph.notifier(typename _BpGraph::BlueNode());1390 ::lemon::ignore_unused_variable_warning(rnn);1391 ::lemon::ignore_unused_variable_warning(bnn);1392 }1393 1394 const _BpGraph& bpgraph;1395 1002 }; 1396 1003 }; … … 1462 1069 // m3 = cmap; 1463 1070 1464 ::lemon::ignore_unused_variable_warning(m1);1465 ::lemon::ignore_unused_variable_warning(m2);1466 // ::lemon::ignore_unused_variable_warning(m3);1071 ignore_unused_variable_warning(m1); 1072 ignore_unused_variable_warning(m2); 1073 // ignore_unused_variable_warning(m3); 1467 1074 } 1468 1075 … … 1699 1306 }; 1700 1307 1701 /// \brief Skeleton class for mappable undirected bipartite graphs.1702 ///1703 /// This class describes the interface of mappable undirected1704 /// bipartite graphs. It extends \ref MappableGraphComponent with1705 /// the standard graph map class for red and blue nodes (\c1706 /// RedNodeMap and BlueNodeMap). This concept is part of the1707 /// BpGraph concept.1708 template <typename BAS = BaseBpGraphComponent>1709 class MappableBpGraphComponent : public MappableGraphComponent<BAS> {1710 public:1711 1712 typedef BAS Base;1713 typedef typename Base::Node Node;1714 1715 typedef MappableBpGraphComponent BpGraph;1716 1717 /// \brief Standard graph map for the red nodes.1718 ///1719 /// Standard graph map for the red nodes.1720 /// It conforms to the ReferenceMap concept.1721 template <typename V>1722 class RedNodeMap : public GraphMap<MappableBpGraphComponent, Node, V> {1723 typedef GraphMap<MappableBpGraphComponent, Node, V> Parent;1724 1725 public:1726 /// \brief Construct a new map.1727 ///1728 /// Construct a new map for the graph.1729 explicit RedNodeMap(const MappableBpGraphComponent& graph)1730 : Parent(graph) {}1731 1732 /// \brief Construct a new map with default value.1733 ///1734 /// Construct a new map for the graph and initalize the values.1735 RedNodeMap(const MappableBpGraphComponent& graph, const V& value)1736 : Parent(graph, value) {}1737 1738 private:1739 /// \brief Copy constructor.1740 ///1741 /// Copy Constructor.1742 RedNodeMap(const RedNodeMap& nm) : Parent(nm) {}1743 1744 /// \brief Assignment operator.1745 ///1746 /// Assignment operator.1747 template <typename CMap>1748 RedNodeMap& operator=(const CMap&) {1749 checkConcept<ReadMap<Node, V>, CMap>();1750 return *this;1751 }1752 1753 };1754 1755 /// \brief Standard graph map for the blue nodes.1756 ///1757 /// Standard graph map for the blue nodes.1758 /// It conforms to the ReferenceMap concept.1759 template <typename V>1760 class BlueNodeMap : public GraphMap<MappableBpGraphComponent, Node, V> {1761 typedef GraphMap<MappableBpGraphComponent, Node, V> Parent;1762 1763 public:1764 /// \brief Construct a new map.1765 ///1766 /// Construct a new map for the graph.1767 explicit BlueNodeMap(const MappableBpGraphComponent& graph)1768 : Parent(graph) {}1769 1770 /// \brief Construct a new map with default value.1771 ///1772 /// Construct a new map for the graph and initalize the values.1773 BlueNodeMap(const MappableBpGraphComponent& graph, const V& value)1774 : Parent(graph, value) {}1775 1776 private:1777 /// \brief Copy constructor.1778 ///1779 /// Copy Constructor.1780 BlueNodeMap(const BlueNodeMap& nm) : Parent(nm) {}1781 1782 /// \brief Assignment operator.1783 ///1784 /// Assignment operator.1785 template <typename CMap>1786 BlueNodeMap& operator=(const CMap&) {1787 checkConcept<ReadMap<Node, V>, CMap>();1788 return *this;1789 }1790 1791 };1792 1793 1794 template <typename _BpGraph>1795 struct Constraints {1796 1797 struct Dummy {1798 int value;1799 Dummy() : value(0) {}1800 Dummy(int _v) : value(_v) {}1801 };1802 1803 void constraints() {1804 checkConcept<MappableGraphComponent<Base>, _BpGraph>();1805 1806 { // int map test1807 typedef typename _BpGraph::template RedNodeMap<int>1808 IntRedNodeMap;1809 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, int>,1810 IntRedNodeMap >();1811 } { // bool map test1812 typedef typename _BpGraph::template RedNodeMap<bool>1813 BoolRedNodeMap;1814 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, bool>,1815 BoolRedNodeMap >();1816 } { // Dummy map test1817 typedef typename _BpGraph::template RedNodeMap<Dummy>1818 DummyRedNodeMap;1819 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, Dummy>,1820 DummyRedNodeMap >();1821 }1822 1823 { // int map test1824 typedef typename _BpGraph::template BlueNodeMap<int>1825 IntBlueNodeMap;1826 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, int>,1827 IntBlueNodeMap >();1828 } { // bool map test1829 typedef typename _BpGraph::template BlueNodeMap<bool>1830 BoolBlueNodeMap;1831 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, bool>,1832 BoolBlueNodeMap >();1833 } { // Dummy map test1834 typedef typename _BpGraph::template BlueNodeMap<Dummy>1835 DummyBlueNodeMap;1836 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, Dummy>,1837 DummyBlueNodeMap >();1838 }1839 }1840 1841 const _BpGraph& bpgraph;1842 };1843 };1844 1845 1308 /// \brief Skeleton class for extendable directed graphs. 1846 1309 /// … … 1933 1396 }; 1934 1397 1935 /// \brief Skeleton class for extendable undirected bipartite graphs.1936 ///1937 /// This class describes the interface of extendable undirected1938 /// bipartite graphs. It extends \ref BaseGraphComponent with1939 /// functions for adding nodes and edges to the graph. This1940 /// concept requires \ref AlterableBpGraphComponent.1941 template <typename BAS = BaseBpGraphComponent>1942 class ExtendableBpGraphComponent : public BAS {1943 public:1944 1945 typedef BAS Base;1946 typedef typename Base::Node Node;1947 typedef typename Base::RedNode RedNode;1948 typedef typename Base::BlueNode BlueNode;1949 typedef typename Base::Edge Edge;1950 1951 /// \brief Add a new red node to the digraph.1952 ///1953 /// This function adds a red new node to the digraph.1954 RedNode addRedNode() {1955 return INVALID;1956 }1957 1958 /// \brief Add a new blue node to the digraph.1959 ///1960 /// This function adds a blue new node to the digraph.1961 BlueNode addBlueNode() {1962 return INVALID;1963 }1964 1965 /// \brief Add a new edge connecting the given two nodes.1966 ///1967 /// This function adds a new edge connecting the given two nodes1968 /// of the graph. The first node has to be a red node, and the1969 /// second one a blue node.1970 Edge addEdge(const RedNode&, const BlueNode&) {1971 return INVALID;1972 }1973 Edge addEdge(const BlueNode&, const RedNode&) {1974 return INVALID;1975 }1976 1977 template <typename _BpGraph>1978 struct Constraints {1979 void constraints() {1980 checkConcept<Base, _BpGraph>();1981 typename _BpGraph::RedNode red_node;1982 typename _BpGraph::BlueNode blue_node;1983 red_node = bpgraph.addRedNode();1984 blue_node = bpgraph.addBlueNode();1985 typename _BpGraph::Edge edge;1986 edge = bpgraph.addEdge(red_node, blue_node);1987 edge = bpgraph.addEdge(blue_node, red_node);1988 }1989 1990 _BpGraph& bpgraph;1991 };1992 };1993 1994 1398 /// \brief Skeleton class for erasable directed graphs. 1995 1399 /// … … 2072 1476 }; 2073 1477 2074 /// \brief Skeleton class for erasable undirected graphs.2075 ///2076 /// This class describes the interface of erasable undirected2077 /// bipartite graphs. It extends \ref BaseBpGraphComponent with2078 /// functions for removing nodes and edges from the graph. This2079 /// concept requires \ref AlterableBpGraphComponent.2080 template <typename BAS = BaseBpGraphComponent>2081 class ErasableBpGraphComponent : public ErasableGraphComponent<BAS> {};2082 2083 1478 /// \brief Skeleton class for clearable directed graphs. 2084 1479 /// … … 2117 1512 /// This concept requires \ref AlterableGraphComponent. 2118 1513 template <typename BAS = BaseGraphComponent> 2119 class ClearableGraphComponent : public ClearableDigraphComponent<BAS> {}; 2120 2121 /// \brief Skeleton class for clearable undirected biparite graphs. 2122 /// 2123 /// This class describes the interface of clearable undirected 2124 /// bipartite graphs. It extends \ref BaseBpGraphComponent with a 2125 /// function for clearing the graph. This concept requires \ref 2126 /// AlterableBpGraphComponent. 2127 template <typename BAS = BaseBpGraphComponent> 2128 class ClearableBpGraphComponent : public ClearableGraphComponent<BAS> {}; 1514 class ClearableGraphComponent : public ClearableDigraphComponent<BAS> { 1515 public: 1516 1517 typedef BAS Base; 1518 1519 /// \brief Erase all nodes and edges from the graph. 1520 /// 1521 /// This function erases all nodes and edges from the graph. 1522 void clear() {} 1523 1524 template <typename _Graph> 1525 struct Constraints { 1526 void constraints() { 1527 checkConcept<Base, _Graph>(); 1528 graph.clear(); 1529 } 1530 1531 _Graph& graph; 1532 Constraints() {} 1533 }; 1534 }; 2129 1535 2130 1536 }
Note: See TracChangeset
for help on using the changeset viewer.