Changeset 1261:97f1760dcd13 in lemon for lemon/concepts/graph_components.h
- Timestamp:
- 08/07/13 07:04:58 (11 years ago)
- Branch:
- default
- Parents:
- 1256:cae19e9eeca4 (diff), 1260:a337a0dd3f75 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/concepts/graph_components.h
r1217 r1261 109 109 110 110 bool b; 111 ignore_unused_variable_warning(b);111 ::lemon::ignore_unused_variable_warning(b); 112 112 113 113 b = (ia == ib) && (ia != ib); … … 290 290 ue = e; 291 291 bool d = graph.direction(e); 292 ignore_unused_variable_warning(d);292 ::lemon::ignore_unused_variable_warning(d); 293 293 } 294 294 } … … 535 535 536 536 nid = digraph.maxNodeId(); 537 ignore_unused_variable_warning(nid);537 ::lemon::ignore_unused_variable_warning(nid); 538 538 eid = digraph.maxArcId(); 539 ignore_unused_variable_warning(eid);539 ::lemon::ignore_unused_variable_warning(eid); 540 540 } 541 541 … … 590 590 edge = graph.edgeFromId(ueid); 591 591 ueid = graph.maxEdgeId(); 592 ignore_unused_variable_warning(ueid);592 ::lemon::ignore_unused_variable_warning(ueid); 593 593 } 594 594 … … 727 727 _GraphItemIt it3 = it1; 728 728 _GraphItemIt it4 = INVALID; 729 ignore_unused_variable_warning(it3);730 ignore_unused_variable_warning(it4);729 ::lemon::ignore_unused_variable_warning(it3); 730 ::lemon::ignore_unused_variable_warning(it4); 731 731 732 732 it2 = ++it1; … … 818 818 _GraphIncIt it3 = it1; 819 819 _GraphIncIt it4 = INVALID; 820 ignore_unused_variable_warning(it3);821 ignore_unused_variable_warning(it4);820 ::lemon::ignore_unused_variable_warning(it3); 821 ::lemon::ignore_unused_variable_warning(it4); 822 822 823 823 it2 = ++it1; … … 1001 1001 n = digraph.baseNode(oait); 1002 1002 n = digraph.runningNode(oait); 1003 ignore_unused_variable_warning(n);1003 ::lemon::ignore_unused_variable_warning(n); 1004 1004 } 1005 1005 } … … 1278 1278 = digraph.notifier(typename _Digraph::Arc()); 1279 1279 1280 ignore_unused_variable_warning(nn);1281 ignore_unused_variable_warning(en);1280 ::lemon::ignore_unused_variable_warning(nn); 1281 ::lemon::ignore_unused_variable_warning(en); 1282 1282 } 1283 1283 … … 1326 1326 typename _Graph::EdgeNotifier& uen 1327 1327 = graph.notifier(typename _Graph::Edge()); 1328 ignore_unused_variable_warning(uen);1328 ::lemon::ignore_unused_variable_warning(uen); 1329 1329 } 1330 1330 … … 1462 1462 // m3 = cmap; 1463 1463 1464 ignore_unused_variable_warning(m1);1465 ignore_unused_variable_warning(m2);1466 // ignore_unused_variable_warning(m3);1464 ::lemon::ignore_unused_variable_warning(m1); 1465 ::lemon::ignore_unused_variable_warning(m2); 1466 // ::lemon::ignore_unused_variable_warning(m3); 1467 1467 } 1468 1468 -
lemon/concepts/graph_components.h
r1259 r1261 300 300 }; 301 301 302 /// \brief Base skeleton class for undirected bipartite graphs. 303 /// 304 /// This class describes the base interface of undirected 305 /// bipartite graph types. All bipartite graph %concepts have to 306 /// conform to this class. It extends the interface of \ref 307 /// BaseGraphComponent with an \c Edge type and functions to get 308 /// the end nodes of edges, to convert from arcs to edges and to 309 /// 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 red 321 /// 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 set 330 /// the item to some well-defined value. So you should consider it 331 /// 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 blue 350 /// 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 set 359 /// the item to some well-defined value. So you should consider it 360 /// 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 can 378 /// be invalid, since the Node can be member of the red 379 /// 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 node 406 /// object. It should be called only if the node is from the red 407 /// 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 node 413 /// object. It should be called only if the node is from the red 414 /// 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 node 420 /// object. If the node is not from the red partition, then it 421 /// 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 node 427 /// object. If the node is not from the blue partition, then it 428 /// 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 ignore_unused_variable_warning(b); 460 } 461 } 462 463 const _BpGraph& bpgraph; 464 }; 465 466 }; 467 302 468 /// \brief Skeleton class for \e idable directed graphs. 303 469 /// … … 432 598 }; 433 599 600 /// \brief Skeleton class for \e idable undirected bipartite graphs. 601 /// 602 /// This class describes the interface of \e idable undirected 603 /// bipartite graphs. It extends \ref IDableGraphComponent with 604 /// the core ID functions of undirected bipartite graphs. Beside 605 /// the regular node ids, this class also provides ids within the 606 /// the red and blue sets of the nodes. This concept is part of 607 /// 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 maximum 631 /// node id in the red set. 632 /// 633 /// Return an integer greater or equal to the maximum 634 /// node id in the red set. 635 int maxRedId() const { return -1; } 636 637 /// \brief Return an integer greater or equal to the maximum 638 /// node id in the blue set. 639 /// 640 /// Return an integer greater or equal to the maximum 641 /// 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 ignore_unused_variable_warning(rid); 657 ignore_unused_variable_warning(bid); 658 } 659 660 const _BpGraph& bpgraph; 661 }; 662 }; 663 434 664 /// \brief Concept class for \c NodeIt, \c ArcIt and \c EdgeIt types. 435 665 /// … … 646 876 void next(Arc&) const {} 647 877 648 /// \brief Return the first arc incom ming to the given node.649 /// 650 /// This function gives back the first arc incom ming to the878 /// \brief Return the first arc incoming to the given node. 879 /// 880 /// This function gives back the first arc incoming to the 651 881 /// given node. 652 882 void firstIn(Arc&, const Node&) const {} 653 883 654 /// \brief Return the next arc incom ming to the given node.655 /// 656 /// This function gives back the next arc incom ming to the884 /// \brief Return the next arc incoming to the given node. 885 /// 886 /// This function gives back the next arc incoming to the 657 887 /// given node. 658 888 void nextIn(Arc&) const {} … … 905 1135 }; 906 1136 1137 /// \brief Skeleton class for iterable undirected bipartite graphs. 1138 /// 1139 /// This class describes the interface of iterable undirected 1140 /// bipartite graphs. It extends \ref IterableGraphComponent with 1141 /// 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 Iteration 1160 /// 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 Iteration 1189 /// 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 907 1228 /// \brief Skeleton class for alterable directed graphs. 908 1229 /// … … 930 1251 ArcNotifier; 931 1252 1253 mutable NodeNotifier node_notifier; 1254 mutable ArcNotifier arc_notifier; 1255 932 1256 /// \brief Return the node alteration notifier. 933 1257 /// 934 1258 /// This function gives back the node alteration notifier. 935 1259 NodeNotifier& notifier(Node) const { 936 return NodeNotifier();1260 return node_notifier; 937 1261 } 938 1262 … … 941 1265 /// This function gives back the arc alteration notifier. 942 1266 ArcNotifier& notifier(Arc) const { 943 return ArcNotifier();1267 return arc_notifier; 944 1268 } 945 1269 … … 977 1301 978 1302 typedef BAS Base; 1303 typedef AlterableDigraphComponent<Base> Parent; 979 1304 typedef typename Base::Edge Edge; 980 1305 … … 984 1309 EdgeNotifier; 985 1310 1311 mutable EdgeNotifier edge_notifier; 1312 1313 using Parent::notifier; 1314 986 1315 /// \brief Return the edge alteration notifier. 987 1316 /// 988 1317 /// This function gives back the edge alteration notifier. 989 1318 EdgeNotifier& notifier(Edge) const { 990 return EdgeNotifier();1319 return edge_notifier; 991 1320 } 992 1321 … … 1002 1331 const _Graph& graph; 1003 1332 Constraints() {} 1333 }; 1334 }; 1335 1336 /// \brief Skeleton class for alterable undirected bipartite graphs. 1337 /// 1338 /// This class describes the interface of alterable undirected 1339 /// bipartite graphs. It extends \ref AlterableGraphComponent with 1340 /// the alteration notifier interface of bipartite graphs. It 1341 /// implements an observer-notifier pattern for the red and blue 1342 /// nodes. More obsevers can be registered into the notifier and 1343 /// whenever an alteration occured in the graph all the observers 1344 /// 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& rnn 1387 = bpgraph.notifier(typename _BpGraph::RedNode()); 1388 typename _BpGraph::BlueNodeNotifier& bnn 1389 = bpgraph.notifier(typename _BpGraph::BlueNode()); 1390 ignore_unused_variable_warning(rnn); 1391 ignore_unused_variable_warning(bnn); 1392 } 1393 1394 const _BpGraph& bpgraph; 1004 1395 }; 1005 1396 }; … … 1308 1699 }; 1309 1700 1701 /// \brief Skeleton class for mappable undirected bipartite graphs. 1702 /// 1703 /// This class describes the interface of mappable undirected 1704 /// bipartite graphs. It extends \ref MappableGraphComponent with 1705 /// the standard graph map class for red and blue nodes (\c 1706 /// RedNodeMap and BlueNodeMap). This concept is part of the 1707 /// 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 test 1807 typedef typename _BpGraph::template RedNodeMap<int> 1808 IntRedNodeMap; 1809 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, int>, 1810 IntRedNodeMap >(); 1811 } { // bool map test 1812 typedef typename _BpGraph::template RedNodeMap<bool> 1813 BoolRedNodeMap; 1814 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, bool>, 1815 BoolRedNodeMap >(); 1816 } { // Dummy map test 1817 typedef typename _BpGraph::template RedNodeMap<Dummy> 1818 DummyRedNodeMap; 1819 checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, Dummy>, 1820 DummyRedNodeMap >(); 1821 } 1822 1823 { // int map test 1824 typedef typename _BpGraph::template BlueNodeMap<int> 1825 IntBlueNodeMap; 1826 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, int>, 1827 IntBlueNodeMap >(); 1828 } { // bool map test 1829 typedef typename _BpGraph::template BlueNodeMap<bool> 1830 BoolBlueNodeMap; 1831 checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, bool>, 1832 BoolBlueNodeMap >(); 1833 } { // Dummy map test 1834 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 1310 1845 /// \brief Skeleton class for extendable directed graphs. 1311 1846 /// … … 1398 1933 }; 1399 1934 1935 /// \brief Skeleton class for extendable undirected bipartite graphs. 1936 /// 1937 /// This class describes the interface of extendable undirected 1938 /// bipartite graphs. It extends \ref BaseGraphComponent with 1939 /// functions for adding nodes and edges to the graph. This 1940 /// 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 nodes 1968 /// of the graph. The first node has to be a red node, and the 1969 /// 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 1400 1994 /// \brief Skeleton class for erasable directed graphs. 1401 1995 /// … … 1478 2072 }; 1479 2073 2074 /// \brief Skeleton class for erasable undirected graphs. 2075 /// 2076 /// This class describes the interface of erasable undirected 2077 /// bipartite graphs. It extends \ref BaseBpGraphComponent with 2078 /// functions for removing nodes and edges from the graph. This 2079 /// concept requires \ref AlterableBpGraphComponent. 2080 template <typename BAS = BaseBpGraphComponent> 2081 class ErasableBpGraphComponent : public ErasableGraphComponent<BAS> {}; 2082 1480 2083 /// \brief Skeleton class for clearable directed graphs. 1481 2084 /// … … 1514 2117 /// This concept requires \ref AlterableGraphComponent. 1515 2118 template <typename BAS = BaseGraphComponent> 1516 class ClearableGraphComponent : public ClearableDigraphComponent<BAS> { 1517 public: 1518 1519 typedef BAS Base; 1520 1521 /// \brief Erase all nodes and edges from the graph. 1522 /// 1523 /// This function erases all nodes and edges from the graph. 1524 void clear() {} 1525 1526 template <typename _Graph> 1527 struct Constraints { 1528 void constraints() { 1529 checkConcept<Base, _Graph>(); 1530 graph.clear(); 1531 } 1532 1533 _Graph& graph; 1534 Constraints() {} 1535 }; 1536 }; 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> {}; 1537 2129 1538 2130 }
Note: See TracChangeset
for help on using the changeset viewer.