Welcome to mirror list, hosted at ThFree Co, Russian Federation.

graph_components.h « concepts « lemon « lemon-1.3.1 « 3rd « quadriflow « extern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9df28f37e61e0c9ce50c53295279043ad570273a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
/* -*- mode: C++; indent-tabs-mode: nil; -*-
 *
 * This file is a part of LEMON, a generic C++ optimization library.
 *
 * Copyright (C) 2003-2013
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
 *
 * Permission to use, modify and distribute this software is granted
 * provided that this copyright notice appears in all copies. For
 * precise terms see the accompanying LICENSE file.
 *
 * This software is provided "AS IS" with no warranty of any kind,
 * express or implied, and with no claim as to its suitability for any
 * purpose.
 *
 */

///\ingroup graph_concepts
///\file
///\brief The concepts of graph components.

#ifndef LEMON_CONCEPTS_GRAPH_COMPONENTS_H
#define LEMON_CONCEPTS_GRAPH_COMPONENTS_H

#include <lemon/core.h>
#include <lemon/concepts/maps.h>

#include <lemon/bits/alteration_notifier.h>

namespace lemon {
  namespace concepts {

    /// \brief Concept class for \c Node, \c Arc and \c Edge types.
    ///
    /// This class describes the concept of \c Node, \c Arc and \c Edge
    /// subtypes of digraph and graph types.
    ///
    /// \note This class is a template class so that we can use it to
    /// create graph skeleton classes. The reason for this is that \c Node
    /// and \c Arc (or \c Edge) types should \e not derive from the same
    /// base class. For \c Node you should instantiate it with character
    /// \c 'n', for \c Arc with \c 'a' and for \c Edge with \c 'e'.
#ifndef DOXYGEN
    template <char sel = '0'>
#endif
    class GraphItem {
    public:
      /// \brief Default constructor.
      ///
      /// Default constructor.
      /// \warning The default constructor is not required to set
      /// the item to some well-defined value. So you should consider it
      /// as uninitialized.
      GraphItem() {}

      /// \brief Copy constructor.
      ///
      /// Copy constructor.
      GraphItem(const GraphItem &) {}

      /// \brief Constructor for conversion from \c INVALID.
      ///
      /// Constructor for conversion from \c INVALID.
      /// It initializes the item to be invalid.
      /// \sa Invalid for more details.
      GraphItem(Invalid) {}

      /// \brief Assignment operator.
      ///
      /// Assignment operator for the item.
      GraphItem& operator=(const GraphItem&) { return *this; }

      /// \brief Assignment operator for INVALID.
      ///
      /// This operator makes the item invalid.
      GraphItem& operator=(Invalid) { return *this; }

      /// \brief Equality operator.
      ///
      /// Equality operator.
      bool operator==(const GraphItem&) const { return false; }

      /// \brief Inequality operator.
      ///
      /// Inequality operator.
      bool operator!=(const GraphItem&) const { return false; }

      /// \brief Ordering operator.
      ///
      /// This operator defines an ordering of the items.
      /// It makes possible to use graph item types as key types in
      /// associative containers (e.g. \c std::map).
      ///
      /// \note This operator only has to define some strict ordering of
      /// the items; this order has nothing to do with the iteration
      /// ordering of the items.
      bool operator<(const GraphItem&) const { return false; }

      template<typename _GraphItem>
      struct Constraints {
        void constraints() {
          _GraphItem i1;
          i1=INVALID;
          _GraphItem i2 = i1;
          _GraphItem i3 = INVALID;

          i1 = i2 = i3;

          bool b;
          ::lemon::ignore_unused_variable_warning(b);

          b = (ia == ib) && (ia != ib);
          b = (ia == INVALID) && (ib != INVALID);
          b = (ia < ib);
        }

        const _GraphItem &ia;
        const _GraphItem &ib;
        Constraints() {}
      };
    };

    /// \brief Base skeleton class for directed graphs.
    ///
    /// This class describes the base interface of directed graph types.
    /// All digraph %concepts have to conform to this class.
    /// It just provides types for nodes and arcs and functions
    /// to get the source and the target nodes of arcs.
    class BaseDigraphComponent {
    public:

      typedef BaseDigraphComponent Digraph;

      /// \brief Node class of the digraph.
      ///
      /// This class represents the nodes of the digraph.
      typedef GraphItem<'n'> Node;

      /// \brief Arc class of the digraph.
      ///
      /// This class represents the arcs of the digraph.
      typedef GraphItem<'a'> Arc;

      /// \brief Return the source node of an arc.
      ///
      /// This function returns the source node of an arc.
      Node source(const Arc&) const { return INVALID; }

      /// \brief Return the target node of an arc.
      ///
      /// This function returns the target node of an arc.
      Node target(const Arc&) const { return INVALID; }

      /// \brief Return the opposite node on the given arc.
      ///
      /// This function returns the opposite node on the given arc.
      Node oppositeNode(const Node&, const Arc&) const {
        return INVALID;
      }

      template <typename _Digraph>
      struct Constraints {
        typedef typename _Digraph::Node Node;
        typedef typename _Digraph::Arc Arc;

        void constraints() {
          checkConcept<GraphItem<'n'>, Node>();
          checkConcept<GraphItem<'a'>, Arc>();
          {
            Node n;
            Arc e(INVALID);
            n = digraph.source(e);
            n = digraph.target(e);
            n = digraph.oppositeNode(n, e);
          }
        }

        const _Digraph& digraph;
        Constraints() {}
      };
    };

    /// \brief Base skeleton class for undirected graphs.
    ///
    /// This class describes the base interface of undirected graph types.
    /// All graph %concepts have to conform to this class.
    /// It extends the interface of \ref BaseDigraphComponent with an
    /// \c Edge type and functions to get the end nodes of edges,
    /// to convert from arcs to edges and to get both direction of edges.
    class BaseGraphComponent : public BaseDigraphComponent {
    public:

      typedef BaseGraphComponent Graph;

      typedef BaseDigraphComponent::Node Node;
      typedef BaseDigraphComponent::Arc Arc;

      /// \brief Undirected edge class of the graph.
      ///
      /// This class represents the undirected edges of the graph.
      /// Undirected graphs can be used as directed graphs, each edge is
      /// represented by two opposite directed arcs.
      class Edge : public GraphItem<'e'> {
        typedef GraphItem<'e'> Parent;

      public:
        /// \brief Default constructor.
        ///
        /// Default constructor.
        /// \warning The default constructor is not required to set
        /// the item to some well-defined value. So you should consider it
        /// as uninitialized.
        Edge() {}

        /// \brief Copy constructor.
        ///
        /// Copy constructor.
        Edge(const Edge &) : Parent() {}

        /// \brief Constructor for conversion from \c INVALID.
        ///
        /// Constructor for conversion from \c INVALID.
        /// It initializes the item to be invalid.
        /// \sa Invalid for more details.
        Edge(Invalid) {}

        /// \brief Constructor for conversion from an arc.
        ///
        /// Constructor for conversion from an arc.
        /// Besides the core graph item functionality each arc should
        /// be convertible to the represented edge.
        Edge(const Arc&) {}
     };

      /// \brief Return one end node of an edge.
      ///
      /// This function returns one end node of an edge.
      Node u(const Edge&) const { return INVALID; }

      /// \brief Return the other end node of an edge.
      ///
      /// This function returns the other end node of an edge.
      Node v(const Edge&) const { return INVALID; }

      /// \brief Return a directed arc related to an edge.
      ///
      /// This function returns a directed arc from its direction and the
      /// represented edge.
      Arc direct(const Edge&, bool) const { return INVALID; }

      /// \brief Return a directed arc related to an edge.
      ///
      /// This function returns a directed arc from its source node and the
      /// represented edge.
      Arc direct(const Edge&, const Node&) const { return INVALID; }

      /// \brief Return the direction of the arc.
      ///
      /// Returns the direction of the arc. Each arc represents an
      /// edge with a direction. It gives back the
      /// direction.
      bool direction(const Arc&) const { return true; }

      /// \brief Return the opposite arc.
      ///
      /// This function returns the opposite arc, i.e. the arc representing
      /// the same edge and has opposite direction.
      Arc oppositeArc(const Arc&) const { return INVALID; }

      template <typename _Graph>
      struct Constraints {
        typedef typename _Graph::Node Node;
        typedef typename _Graph::Arc Arc;
        typedef typename _Graph::Edge Edge;

        void constraints() {
          checkConcept<BaseDigraphComponent, _Graph>();
          checkConcept<GraphItem<'e'>, Edge>();
          {
            Node n;
            Edge ue(INVALID);
            Arc e;
            n = graph.u(ue);
            n = graph.v(ue);
            e = graph.direct(ue, true);
            e = graph.direct(ue, false);
            e = graph.direct(ue, n);
            e = graph.oppositeArc(e);
            ue = e;
            bool d = graph.direction(e);
            ::lemon::ignore_unused_variable_warning(d);
          }
        }

        const _Graph& graph;
      Constraints() {}
      };

    };

    /// \brief Base skeleton class for undirected bipartite graphs.
    ///
    /// This class describes the base interface of undirected
    /// bipartite graph types.  All bipartite graph %concepts have to
    /// conform to this class.  It extends the interface of \ref
    /// BaseGraphComponent with an \c Edge type and functions to get
    /// the end nodes of edges, to convert from arcs to edges and to
    /// get both direction of edges.
    class BaseBpGraphComponent : public BaseGraphComponent {
    public:

      typedef BaseBpGraphComponent BpGraph;

      typedef BaseDigraphComponent::Node Node;
      typedef BaseDigraphComponent::Arc Arc;

      /// \brief Class to represent red nodes.
      ///
      /// This class represents the red nodes of the graph. The red
      /// nodes can also be used as normal nodes.
      class RedNode : public Node {
        typedef Node Parent;

      public:
        /// \brief Default constructor.
        ///
        /// Default constructor.
        /// \warning The default constructor is not required to set
        /// the item to some well-defined value. So you should consider it
        /// as uninitialized.
        RedNode() {}

        /// \brief Copy constructor.
        ///
        /// Copy constructor.
        RedNode(const RedNode &) : Parent() {}

        /// \brief Constructor for conversion from \c INVALID.
        ///
        /// Constructor for conversion from \c INVALID.
        /// It initializes the item to be invalid.
        /// \sa Invalid for more details.
        RedNode(Invalid) {}
      };

      /// \brief Class to represent blue nodes.
      ///
      /// This class represents the blue nodes of the graph. The blue
      /// nodes can also be used as normal nodes.
      class BlueNode : public Node {
        typedef Node Parent;

      public:
        /// \brief Default constructor.
        ///
        /// Default constructor.
        /// \warning The default constructor is not required to set
        /// the item to some well-defined value. So you should consider it
        /// as uninitialized.
        BlueNode() {}

        /// \brief Copy constructor.
        ///
        /// Copy constructor.
        BlueNode(const BlueNode &) : Parent() {}

        /// \brief Constructor for conversion from \c INVALID.
        ///
        /// Constructor for conversion from \c INVALID.
        /// It initializes the item to be invalid.
        /// \sa Invalid for more details.
        BlueNode(Invalid) {}

        /// \brief Constructor for conversion from a node.
        ///
        /// Constructor for conversion from a node. The conversion can
        /// be invalid, since the Node can be member of the red
        /// set.
        BlueNode(const Node&) {}
      };

      /// \brief Gives back %true for red nodes.
      ///
      /// Gives back %true for red nodes.
      bool red(const Node&) const { return true; }

      /// \brief Gives back %true for blue nodes.
      ///
      /// Gives back %true for blue nodes.
      bool blue(const Node&) const { return true; }

      /// \brief Gives back the red end node of the edge.
      ///
      /// Gives back the red end node of the edge.
      RedNode redNode(const Edge&) const { return RedNode(); }

      /// \brief Gives back the blue end node of the edge.
      ///
      /// Gives back the blue end node of the edge.
      BlueNode blueNode(const Edge&) const { return BlueNode(); }

      /// \brief Converts the node to red node object.
      ///
      /// This function converts unsafely the node to red node
      /// object. It should be called only if the node is from the red
      /// partition or INVALID.
      RedNode asRedNodeUnsafe(const Node&) const { return RedNode(); }

      /// \brief Converts the node to blue node object.
      ///
      /// This function converts unsafely the node to blue node
      /// object. It should be called only if the node is from the red
      /// partition or INVALID.
      BlueNode asBlueNodeUnsafe(const Node&) const { return BlueNode(); }

      /// \brief Converts the node to red node object.
      ///
      /// This function converts safely the node to red node
      /// object. If the node is not from the red partition, then it
      /// returns INVALID.
      RedNode asRedNode(const Node&) const { return RedNode(); }

      /// \brief Converts the node to blue node object.
      ///
      /// This function converts unsafely the node to blue node
      /// object. If the node is not from the blue partition, then it
      /// returns INVALID.
      BlueNode asBlueNode(const Node&) const { return BlueNode(); }

      template <typename _BpGraph>
      struct Constraints {
        typedef typename _BpGraph::Node Node;
        typedef typename _BpGraph::RedNode RedNode;
        typedef typename _BpGraph::BlueNode BlueNode;
        typedef typename _BpGraph::Arc Arc;
        typedef typename _BpGraph::Edge Edge;

        void constraints() {
          checkConcept<BaseGraphComponent, _BpGraph>();
          checkConcept<GraphItem<'n'>, RedNode>();
          checkConcept<GraphItem<'n'>, BlueNode>();
          {
            Node n;
            RedNode rn;
            BlueNode bn;
            Node rnan = rn;
            Node bnan = bn;
            Edge e;
            bool b;
            b = bpgraph.red(rnan);
            b = bpgraph.blue(bnan);
            rn = bpgraph.redNode(e);
            bn = bpgraph.blueNode(e);
            rn = bpgraph.asRedNodeUnsafe(rnan);
            bn = bpgraph.asBlueNodeUnsafe(bnan);
            rn = bpgraph.asRedNode(rnan);
            bn = bpgraph.asBlueNode(bnan);
            ::lemon::ignore_unused_variable_warning(b);
          }
        }

        const _BpGraph& bpgraph;
      };

    };

    /// \brief Skeleton class for \e idable directed graphs.
    ///
    /// This class describes the interface of \e idable directed graphs.
    /// It extends \ref BaseDigraphComponent with the core ID functions.
    /// The ids of the items must be unique and immutable.
    /// This concept is part of the Digraph concept.
    template <typename BAS = BaseDigraphComponent>
    class IDableDigraphComponent : public BAS {
    public:

      typedef BAS Base;
      typedef typename Base::Node Node;
      typedef typename Base::Arc Arc;

      /// \brief Return a unique integer id for the given node.
      ///
      /// This function returns a unique integer id for the given node.
      int id(const Node&) const { return -1; }

      /// \brief Return the node by its unique id.
      ///
      /// This function returns the node by its unique id.
      /// If the digraph does not contain a node with the given id,
      /// then the result of the function is undefined.
      Node nodeFromId(int) const { return INVALID; }

      /// \brief Return a unique integer id for the given arc.
      ///
      /// This function returns a unique integer id for the given arc.
      int id(const Arc&) const { return -1; }

      /// \brief Return the arc by its unique id.
      ///
      /// This function returns the arc by its unique id.
      /// If the digraph does not contain an arc with the given id,
      /// then the result of the function is undefined.
      Arc arcFromId(int) const { return INVALID; }

      /// \brief Return an integer greater or equal to the maximum
      /// node id.
      ///
      /// This function returns an integer greater or equal to the
      /// maximum node id.
      int maxNodeId() const { return -1; }

      /// \brief Return an integer greater or equal to the maximum
      /// arc id.
      ///
      /// This function returns an integer greater or equal to the
      /// maximum arc id.
      int maxArcId() const { return -1; }

      template <typename _Digraph>
      struct Constraints {

        void constraints() {
          checkConcept<Base, _Digraph >();
          typename _Digraph::Node node;
          node=INVALID;
          int nid = digraph.id(node);
          nid = digraph.id(node);
          node = digraph.nodeFromId(nid);
          typename _Digraph::Arc arc;
          arc=INVALID;
          int eid = digraph.id(arc);
          eid = digraph.id(arc);
          arc = digraph.arcFromId(eid);

          nid = digraph.maxNodeId();
          ::lemon::ignore_unused_variable_warning(nid);
          eid = digraph.maxArcId();
          ::lemon::ignore_unused_variable_warning(eid);
        }

        const _Digraph& digraph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for \e idable undirected graphs.
    ///
    /// This class describes the interface of \e idable undirected
    /// graphs. It extends \ref IDableDigraphComponent with the core ID
    /// functions of undirected graphs.
    /// The ids of the items must be unique and immutable.
    /// This concept is part of the Graph concept.
    template <typename BAS = BaseGraphComponent>
    class IDableGraphComponent : public IDableDigraphComponent<BAS> {
    public:

      typedef BAS Base;
      typedef typename Base::Edge Edge;

      using IDableDigraphComponent<Base>::id;

      /// \brief Return a unique integer id for the given edge.
      ///
      /// This function returns a unique integer id for the given edge.
      int id(const Edge&) const { return -1; }

      /// \brief Return the edge by its unique id.
      ///
      /// This function returns the edge by its unique id.
      /// If the graph does not contain an edge with the given id,
      /// then the result of the function is undefined.
      Edge edgeFromId(int) const { return INVALID; }

      /// \brief Return an integer greater or equal to the maximum
      /// edge id.
      ///
      /// This function returns an integer greater or equal to the
      /// maximum edge id.
      int maxEdgeId() const { return -1; }

      template <typename _Graph>
      struct Constraints {

        void constraints() {
          checkConcept<IDableDigraphComponent<Base>, _Graph >();
          typename _Graph::Edge edge;
          int ueid = graph.id(edge);
          ueid = graph.id(edge);
          edge = graph.edgeFromId(ueid);
          ueid = graph.maxEdgeId();
          ::lemon::ignore_unused_variable_warning(ueid);
        }

        const _Graph& graph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for \e idable undirected bipartite graphs.
    ///
    /// This class describes the interface of \e idable undirected
    /// bipartite graphs. It extends \ref IDableGraphComponent with
    /// the core ID functions of undirected bipartite graphs. Beside
    /// the regular node ids, this class also provides ids within the
    /// the red and blue sets of the nodes. This concept is part of
    /// the BpGraph concept.
    template <typename BAS = BaseBpGraphComponent>
    class IDableBpGraphComponent : public IDableGraphComponent<BAS> {
    public:

      typedef BAS Base;
      typedef IDableGraphComponent<BAS> Parent;
      typedef typename Base::Node Node;
      typedef typename Base::RedNode RedNode;
      typedef typename Base::BlueNode BlueNode;

      using Parent::id;

      /// \brief Return a unique integer id for the given node in the red set.
      ///
      /// Return a unique integer id for the given node in the red set.
      int id(const RedNode&) const { return -1; }

      /// \brief Return a unique integer id for the given node in the blue set.
      ///
      /// Return a unique integer id for the given node in the blue set.
      int id(const BlueNode&) const { return -1; }

      /// \brief Return an integer greater or equal to the maximum
      /// node id in the red set.
      ///
      /// Return an integer greater or equal to the maximum
      /// node id in the red set.
      int maxRedId() const { return -1; }

      /// \brief Return an integer greater or equal to the maximum
      /// node id in the blue set.
      ///
      /// Return an integer greater or equal to the maximum
      /// node id in the blue set.
      int maxBlueId() const { return -1; }

      template <typename _BpGraph>
      struct Constraints {

        void constraints() {
          checkConcept<IDableGraphComponent<Base>, _BpGraph>();
          typename _BpGraph::Node node;
          typename _BpGraph::RedNode red;
          typename _BpGraph::BlueNode blue;
          int rid = bpgraph.id(red);
          int bid = bpgraph.id(blue);
          rid = bpgraph.maxRedId();
          bid = bpgraph.maxBlueId();
          ::lemon::ignore_unused_variable_warning(rid);
          ::lemon::ignore_unused_variable_warning(bid);
        }

        const _BpGraph& bpgraph;
      };
    };

    /// \brief Concept class for \c NodeIt, \c ArcIt and \c EdgeIt types.
    ///
    /// This class describes the concept of \c NodeIt, \c ArcIt and
    /// \c EdgeIt subtypes of digraph and graph types.
    template <typename GR, typename Item>
    class GraphItemIt : public Item {
    public:
      /// \brief Default constructor.
      ///
      /// Default constructor.
      /// \warning The default constructor is not required to set
      /// the iterator to some well-defined value. So you should consider it
      /// as uninitialized.
      GraphItemIt() {}

      /// \brief Copy constructor.
      ///
      /// Copy constructor.
      GraphItemIt(const GraphItemIt& it) : Item(it) {}

      /// \brief Constructor that sets the iterator to the first item.
      ///
      /// Constructor that sets the iterator to the first item.
      explicit GraphItemIt(const GR&) {}

      /// \brief Constructor for conversion from \c INVALID.
      ///
      /// Constructor for conversion from \c INVALID.
      /// It initializes the iterator to be invalid.
      /// \sa Invalid for more details.
      GraphItemIt(Invalid) {}

      /// \brief Assignment operator.
      ///
      /// Assignment operator for the iterator.
      GraphItemIt& operator=(const GraphItemIt&) { return *this; }

      /// \brief Increment the iterator.
      ///
      /// This operator increments the iterator, i.e. assigns it to the
      /// next item.
      GraphItemIt& operator++() { return *this; }

      /// \brief Equality operator
      ///
      /// Equality operator.
      /// Two iterators are equal if and only if they point to the
      /// same object or both are invalid.
      bool operator==(const GraphItemIt&) const { return true;}

      /// \brief Inequality operator
      ///
      /// Inequality operator.
      /// Two iterators are equal if and only if they point to the
      /// same object or both are invalid.
      bool operator!=(const GraphItemIt&) const { return true;}

      template<typename _GraphItemIt>
      struct Constraints {
        void constraints() {
          checkConcept<GraphItem<>, _GraphItemIt>();
          _GraphItemIt it1(g);
          _GraphItemIt it2;
          _GraphItemIt it3 = it1;
          _GraphItemIt it4 = INVALID;
          ::lemon::ignore_unused_variable_warning(it3);
          ::lemon::ignore_unused_variable_warning(it4);

          it2 = ++it1;
          ++it2 = it1;
          ++(++it1);

          Item bi = it1;
          bi = it2;
        }
        const GR& g;
        Constraints() {}
      };
    };

    /// \brief Concept class for \c InArcIt, \c OutArcIt and
    /// \c IncEdgeIt types.
    ///
    /// This class describes the concept of \c InArcIt, \c OutArcIt
    /// and \c IncEdgeIt subtypes of digraph and graph types.
    ///
    /// \note Since these iterator classes do not inherit from the same
    /// base class, there is an additional template parameter (selector)
    /// \c sel. For \c InArcIt you should instantiate it with character
    /// \c 'i', for \c OutArcIt with \c 'o' and for \c IncEdgeIt with \c 'e'.
    template <typename GR,
              typename Item = typename GR::Arc,
              typename Base = typename GR::Node,
              char sel = '0'>
    class GraphIncIt : public Item {
    public:
      /// \brief Default constructor.
      ///
      /// Default constructor.
      /// \warning The default constructor is not required to set
      /// the iterator to some well-defined value. So you should consider it
      /// as uninitialized.
      GraphIncIt() {}

      /// \brief Copy constructor.
      ///
      /// Copy constructor.
      GraphIncIt(const GraphIncIt& it) : Item(it) {}

      /// \brief Constructor that sets the iterator to the first
      /// incoming or outgoing arc.
      ///
      /// Constructor that sets the iterator to the first arc
      /// incoming to or outgoing from the given node.
      explicit GraphIncIt(const GR&, const Base&) {}

      /// \brief Constructor for conversion from \c INVALID.
      ///
      /// Constructor for conversion from \c INVALID.
      /// It initializes the iterator to be invalid.
      /// \sa Invalid for more details.
      GraphIncIt(Invalid) {}

      /// \brief Assignment operator.
      ///
      /// Assignment operator for the iterator.
      GraphIncIt& operator=(const GraphIncIt&) { return *this; }

      /// \brief Increment the iterator.
      ///
      /// This operator increments the iterator, i.e. assigns it to the
      /// next arc incoming to or outgoing from the given node.
      GraphIncIt& operator++() { return *this; }

      /// \brief Equality operator
      ///
      /// Equality operator.
      /// Two iterators are equal if and only if they point to the
      /// same object or both are invalid.
      bool operator==(const GraphIncIt&) const { return true;}

      /// \brief Inequality operator
      ///
      /// Inequality operator.
      /// Two iterators are equal if and only if they point to the
      /// same object or both are invalid.
      bool operator!=(const GraphIncIt&) const { return true;}

      template <typename _GraphIncIt>
      struct Constraints {
        void constraints() {
          checkConcept<GraphItem<sel>, _GraphIncIt>();
          _GraphIncIt it1(graph, node);
          _GraphIncIt it2;
          _GraphIncIt it3 = it1;
          _GraphIncIt it4 = INVALID;
          ::lemon::ignore_unused_variable_warning(it3);
          ::lemon::ignore_unused_variable_warning(it4);

          it2 = ++it1;
          ++it2 = it1;
          ++(++it1);
          Item e = it1;
          e = it2;
        }
        const Base& node;
        const GR& graph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for iterable directed graphs.
    ///
    /// This class describes the interface of iterable directed
    /// graphs. It extends \ref BaseDigraphComponent with the core
    /// iterable interface.
    /// This concept is part of the Digraph concept.
    template <typename BAS = BaseDigraphComponent>
    class IterableDigraphComponent : public BAS {

    public:

      typedef BAS Base;
      typedef typename Base::Node Node;
      typedef typename Base::Arc Arc;

      typedef IterableDigraphComponent Digraph;

      /// \name Base Iteration
      ///
      /// This interface provides functions for iteration on digraph items.
      ///
      /// @{

      /// \brief Return the first node.
      ///
      /// This function gives back the first node in the iteration order.
      void first(Node&) const {}

      /// \brief Return the next node.
      ///
      /// This function gives back the next node in the iteration order.
      void next(Node&) const {}

      /// \brief Return the first arc.
      ///
      /// This function gives back the first arc in the iteration order.
      void first(Arc&) const {}

      /// \brief Return the next arc.
      ///
      /// This function gives back the next arc in the iteration order.
      void next(Arc&) const {}

      /// \brief Return the first arc incoming to the given node.
      ///
      /// This function gives back the first arc incoming to the
      /// given node.
      void firstIn(Arc&, const Node&) const {}

      /// \brief Return the next arc incoming to the given node.
      ///
      /// This function gives back the next arc incoming to the
      /// given node.
      void nextIn(Arc&) const {}

      /// \brief Return the first arc outgoing form the given node.
      ///
      /// This function gives back the first arc outgoing form the
      /// given node.
      void firstOut(Arc&, const Node&) const {}

      /// \brief Return the next arc outgoing form the given node.
      ///
      /// This function gives back the next arc outgoing form the
      /// given node.
      void nextOut(Arc&) const {}

      /// @}

      /// \name Class Based Iteration
      ///
      /// This interface provides iterator classes for digraph items.
      ///
      /// @{

      /// \brief This iterator goes through each node.
      ///
      /// This iterator goes through each node.
      ///
      typedef GraphItemIt<Digraph, Node> NodeIt;

      /// \brief This iterator goes through each arc.
      ///
      /// This iterator goes through each arc.
      ///
      typedef GraphItemIt<Digraph, Arc> ArcIt;

      /// \brief This iterator goes trough the incoming arcs of a node.
      ///
      /// This iterator goes trough the \e incoming arcs of a certain node
      /// of a digraph.
      typedef GraphIncIt<Digraph, Arc, Node, 'i'> InArcIt;

      /// \brief This iterator goes trough the outgoing arcs of a node.
      ///
      /// This iterator goes trough the \e outgoing arcs of a certain node
      /// of a digraph.
      typedef GraphIncIt<Digraph, Arc, Node, 'o'> OutArcIt;

      /// \brief The base node of the iterator.
      ///
      /// This function gives back the base node of the iterator.
      /// It is always the target node of the pointed arc.
      Node baseNode(const InArcIt&) const { return INVALID; }

      /// \brief The running node of the iterator.
      ///
      /// This function gives back the running node of the iterator.
      /// It is always the source node of the pointed arc.
      Node runningNode(const InArcIt&) const { return INVALID; }

      /// \brief The base node of the iterator.
      ///
      /// This function gives back the base node of the iterator.
      /// It is always the source node of the pointed arc.
      Node baseNode(const OutArcIt&) const { return INVALID; }

      /// \brief The running node of the iterator.
      ///
      /// This function gives back the running node of the iterator.
      /// It is always the target node of the pointed arc.
      Node runningNode(const OutArcIt&) const { return INVALID; }

      /// @}

      template <typename _Digraph>
      struct Constraints {
        void constraints() {
          checkConcept<Base, _Digraph>();

          {
            typename _Digraph::Node node(INVALID);
            typename _Digraph::Arc arc(INVALID);
            {
              digraph.first(node);
              digraph.next(node);
            }
            {
              digraph.first(arc);
              digraph.next(arc);
            }
            {
              digraph.firstIn(arc, node);
              digraph.nextIn(arc);
            }
            {
              digraph.firstOut(arc, node);
              digraph.nextOut(arc);
            }
          }

          {
            checkConcept<GraphItemIt<_Digraph, typename _Digraph::Arc>,
              typename _Digraph::ArcIt >();
            checkConcept<GraphItemIt<_Digraph, typename _Digraph::Node>,
              typename _Digraph::NodeIt >();
            checkConcept<GraphIncIt<_Digraph, typename _Digraph::Arc,
              typename _Digraph::Node, 'i'>, typename _Digraph::InArcIt>();
            checkConcept<GraphIncIt<_Digraph, typename _Digraph::Arc,
              typename _Digraph::Node, 'o'>, typename _Digraph::OutArcIt>();

            typename _Digraph::Node n;
            const typename _Digraph::InArcIt iait(INVALID);
            const typename _Digraph::OutArcIt oait(INVALID);
            n = digraph.baseNode(iait);
            n = digraph.runningNode(iait);
            n = digraph.baseNode(oait);
            n = digraph.runningNode(oait);
            ::lemon::ignore_unused_variable_warning(n);
          }
        }

        const _Digraph& digraph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for iterable undirected graphs.
    ///
    /// This class describes the interface of iterable undirected
    /// graphs. It extends \ref IterableDigraphComponent with the core
    /// iterable interface of undirected graphs.
    /// This concept is part of the Graph concept.
    template <typename BAS = BaseGraphComponent>
    class IterableGraphComponent : public IterableDigraphComponent<BAS> {
    public:

      typedef BAS Base;
      typedef typename Base::Node Node;
      typedef typename Base::Arc Arc;
      typedef typename Base::Edge Edge;


      typedef IterableGraphComponent Graph;

      /// \name Base Iteration
      ///
      /// This interface provides functions for iteration on edges.
      ///
      /// @{

      using IterableDigraphComponent<Base>::first;
      using IterableDigraphComponent<Base>::next;

      /// \brief Return the first edge.
      ///
      /// This function gives back the first edge in the iteration order.
      void first(Edge&) const {}

      /// \brief Return the next edge.
      ///
      /// This function gives back the next edge in the iteration order.
      void next(Edge&) const {}

      /// \brief Return the first edge incident to the given node.
      ///
      /// This function gives back the first edge incident to the given
      /// node. The bool parameter gives back the direction for which the
      /// source node of the directed arc representing the edge is the
      /// given node.
      void firstInc(Edge&, bool&, const Node&) const {}

      /// \brief Gives back the next of the edges from the
      /// given node.
      ///
      /// This function gives back the next edge incident to the given
      /// node. The bool parameter should be used as \c firstInc() use it.
      void nextInc(Edge&, bool&) const {}

      using IterableDigraphComponent<Base>::baseNode;
      using IterableDigraphComponent<Base>::runningNode;

      /// @}

      /// \name Class Based Iteration
      ///
      /// This interface provides iterator classes for edges.
      ///
      /// @{

      /// \brief This iterator goes through each edge.
      ///
      /// This iterator goes through each edge.
      typedef GraphItemIt<Graph, Edge> EdgeIt;

      /// \brief This iterator goes trough the incident edges of a
      /// node.
      ///
      /// This iterator goes trough the incident edges of a certain
      /// node of a graph.
      typedef GraphIncIt<Graph, Edge, Node, 'e'> IncEdgeIt;

      /// \brief The base node of the iterator.
      ///
      /// This function gives back the base node of the iterator.
      Node baseNode(const IncEdgeIt&) const { return INVALID; }

      /// \brief The running node of the iterator.
      ///
      /// This function gives back the running node of the iterator.
      Node runningNode(const IncEdgeIt&) const { return INVALID; }

      /// @}

      template <typename _Graph>
      struct Constraints {
        void constraints() {
          checkConcept<IterableDigraphComponent<Base>, _Graph>();

          {
            typename _Graph::Node node(INVALID);
            typename _Graph::Edge edge(INVALID);
            bool dir;
            {
              graph.first(edge);
              graph.next(edge);
            }
            {
              graph.firstInc(edge, dir, node);
              graph.nextInc(edge, dir);
            }

          }

          {
            checkConcept<GraphItemIt<_Graph, typename _Graph::Edge>,
              typename _Graph::EdgeIt >();
            checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
              typename _Graph::Node, 'e'>, typename _Graph::IncEdgeIt>();

            typename _Graph::Node n;
            const typename _Graph::IncEdgeIt ieit(INVALID);
            n = graph.baseNode(ieit);
            n = graph.runningNode(ieit);
          }
        }

        const _Graph& graph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for iterable undirected bipartite graphs.
    ///
    /// This class describes the interface of iterable undirected
    /// bipartite graphs. It extends \ref IterableGraphComponent with
    /// the core iterable interface of undirected bipartite graphs.
    /// This concept is part of the BpGraph concept.
    template <typename BAS = BaseBpGraphComponent>
    class IterableBpGraphComponent : public IterableGraphComponent<BAS> {
    public:

      typedef BAS Base;
      typedef typename Base::Node Node;
      typedef typename Base::RedNode RedNode;
      typedef typename Base::BlueNode BlueNode;
      typedef typename Base::Arc Arc;
      typedef typename Base::Edge Edge;

      typedef IterableBpGraphComponent BpGraph;

      using IterableGraphComponent<BAS>::first;
      using IterableGraphComponent<BAS>::next;

      /// \name Base Iteration
      ///
      /// This interface provides functions for iteration on red and blue nodes.
      ///
      /// @{

      /// \brief Return the first red node.
      ///
      /// This function gives back the first red node in the iteration order.
      void first(RedNode&) const {}

      /// \brief Return the next red node.
      ///
      /// This function gives back the next red node in the iteration order.
      void next(RedNode&) const {}

      /// \brief Return the first blue node.
      ///
      /// This function gives back the first blue node in the iteration order.
      void first(BlueNode&) const {}

      /// \brief Return the next blue node.
      ///
      /// This function gives back the next blue node in the iteration order.
      void next(BlueNode&) const {}


      /// @}

      /// \name Class Based Iteration
      ///
      /// This interface provides iterator classes for red and blue nodes.
      ///
      /// @{

      /// \brief This iterator goes through each red node.
      ///
      /// This iterator goes through each red node.
      typedef GraphItemIt<BpGraph, RedNode> RedNodeIt;

      /// \brief This iterator goes through each blue node.
      ///
      /// This iterator goes through each blue node.
      typedef GraphItemIt<BpGraph, BlueNode> BlueNodeIt;

      /// @}

      template <typename _BpGraph>
      struct Constraints {
        void constraints() {
          checkConcept<IterableGraphComponent<Base>, _BpGraph>();

          typename _BpGraph::RedNode rn(INVALID);
          bpgraph.first(rn);
          bpgraph.next(rn);
          typename _BpGraph::BlueNode bn(INVALID);
          bpgraph.first(bn);
          bpgraph.next(bn);

          checkConcept<GraphItemIt<_BpGraph, typename _BpGraph::RedNode>,
            typename _BpGraph::RedNodeIt>();
          checkConcept<GraphItemIt<_BpGraph, typename _BpGraph::BlueNode>,
            typename _BpGraph::BlueNodeIt>();
        }

        const _BpGraph& bpgraph;
      };
    };

    /// \brief Skeleton class for alterable directed graphs.
    ///
    /// This class describes the interface of alterable directed
    /// graphs. It extends \ref BaseDigraphComponent with the alteration
    /// notifier interface. It implements
    /// an observer-notifier pattern for each digraph item. More
    /// obsevers can be registered into the notifier and whenever an
    /// alteration occured in the digraph all the observers will be
    /// notified about it.
    template <typename BAS = BaseDigraphComponent>
    class AlterableDigraphComponent : public BAS {
    public:

      typedef BAS Base;
      typedef typename Base::Node Node;
      typedef typename Base::Arc Arc;


      /// Node alteration notifier class.
      typedef AlterationNotifier<AlterableDigraphComponent, Node>
      NodeNotifier;
      /// Arc alteration notifier class.
      typedef AlterationNotifier<AlterableDigraphComponent, Arc>
      ArcNotifier;

      mutable NodeNotifier node_notifier;
      mutable ArcNotifier arc_notifier;

      /// \brief Return the node alteration notifier.
      ///
      /// This function gives back the node alteration notifier.
      NodeNotifier& notifier(Node) const {
        return node_notifier;
      }

      /// \brief Return the arc alteration notifier.
      ///
      /// This function gives back the arc alteration notifier.
      ArcNotifier& notifier(Arc) const {
        return arc_notifier;
      }

      template <typename _Digraph>
      struct Constraints {
        void constraints() {
          checkConcept<Base, _Digraph>();
          typename _Digraph::NodeNotifier& nn
            = digraph.notifier(typename _Digraph::Node());

          typename _Digraph::ArcNotifier& en
            = digraph.notifier(typename _Digraph::Arc());

          ::lemon::ignore_unused_variable_warning(nn);
          ::lemon::ignore_unused_variable_warning(en);
        }

        const _Digraph& digraph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for alterable undirected graphs.
    ///
    /// This class describes the interface of alterable undirected
    /// graphs. It extends \ref AlterableDigraphComponent with the alteration
    /// notifier interface of undirected graphs. It implements
    /// an observer-notifier pattern for the edges. More
    /// obsevers can be registered into the notifier and whenever an
    /// alteration occured in the graph all the observers will be
    /// notified about it.
    template <typename BAS = BaseGraphComponent>
    class AlterableGraphComponent : public AlterableDigraphComponent<BAS> {
    public:

      typedef BAS Base;
      typedef AlterableDigraphComponent<Base> Parent;
      typedef typename Base::Edge Edge;


      /// Edge alteration notifier class.
      typedef AlterationNotifier<AlterableGraphComponent, Edge>
      EdgeNotifier;

      mutable EdgeNotifier edge_notifier;

      using Parent::notifier;

      /// \brief Return the edge alteration notifier.
      ///
      /// This function gives back the edge alteration notifier.
      EdgeNotifier& notifier(Edge) const {
        return edge_notifier;
      }

      template <typename _Graph>
      struct Constraints {
        void constraints() {
          checkConcept<AlterableDigraphComponent<Base>, _Graph>();
          typename _Graph::EdgeNotifier& uen
            = graph.notifier(typename _Graph::Edge());
          ::lemon::ignore_unused_variable_warning(uen);
        }

        const _Graph& graph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for alterable undirected bipartite graphs.
    ///
    /// This class describes the interface of alterable undirected
    /// bipartite graphs. It extends \ref AlterableGraphComponent with
    /// the alteration notifier interface of bipartite graphs. It
    /// implements an observer-notifier pattern for the red and blue
    /// nodes. More obsevers can be registered into the notifier and
    /// whenever an alteration occured in the graph all the observers
    /// will be notified about it.
    template <typename BAS = BaseBpGraphComponent>
    class AlterableBpGraphComponent : public AlterableGraphComponent<BAS> {
    public:

      typedef BAS Base;
      typedef AlterableGraphComponent<Base> Parent;
      typedef typename Base::RedNode RedNode;
      typedef typename Base::BlueNode BlueNode;


      /// Red node alteration notifier class.
      typedef AlterationNotifier<AlterableBpGraphComponent, RedNode>
      RedNodeNotifier;

      /// Blue node alteration notifier class.
      typedef AlterationNotifier<AlterableBpGraphComponent, BlueNode>
      BlueNodeNotifier;

      mutable RedNodeNotifier red_node_notifier;
      mutable BlueNodeNotifier blue_node_notifier;

      using Parent::notifier;

      /// \brief Return the red node alteration notifier.
      ///
      /// This function gives back the red node alteration notifier.
      RedNodeNotifier& notifier(RedNode) const {
        return red_node_notifier;
      }

      /// \brief Return the blue node alteration notifier.
      ///
      /// This function gives back the blue node alteration notifier.
      BlueNodeNotifier& notifier(BlueNode) const {
        return blue_node_notifier;
      }

      template <typename _BpGraph>
      struct Constraints {
        void constraints() {
          checkConcept<AlterableGraphComponent<Base>, _BpGraph>();
          typename _BpGraph::RedNodeNotifier& rnn
            = bpgraph.notifier(typename _BpGraph::RedNode());
          typename _BpGraph::BlueNodeNotifier& bnn
            = bpgraph.notifier(typename _BpGraph::BlueNode());
          ::lemon::ignore_unused_variable_warning(rnn);
          ::lemon::ignore_unused_variable_warning(bnn);
        }

        const _BpGraph& bpgraph;
      };
    };

    /// \brief Concept class for standard graph maps.
    ///
    /// This class describes the concept of standard graph maps, i.e.
    /// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and
    /// graph types, which can be used for associating data to graph items.
    /// The standard graph maps must conform to the ReferenceMap concept.
    template <typename GR, typename K, typename V>
    class GraphMap : public ReferenceMap<K, V, V&, const V&> {
      typedef ReferenceMap<K, V, V&, const V&> Parent;

    public:

      /// The key type of the map.
      typedef K Key;
      /// The value type of the map.
      typedef V Value;
      /// The reference type of the map.
      typedef Value& Reference;
      /// The const reference type of the map.
      typedef const Value& ConstReference;

      // The reference map tag.
      typedef True ReferenceMapTag;

      /// \brief Construct a new map.
      ///
      /// Construct a new map for the graph.
      explicit GraphMap(const GR&) {}
      /// \brief Construct a new map with default value.
      ///
      /// Construct a new map for the graph and initalize the values.
      GraphMap(const GR&, const Value&) {}

    private:
      /// \brief Copy constructor.
      ///
      /// Copy Constructor.
      GraphMap(const GraphMap&) : Parent() {}

      /// \brief Assignment operator.
      ///
      /// Assignment operator. It does not mofify the underlying graph,
      /// it just iterates on the current item set and set the  map
      /// with the value returned by the assigned map.
      template <typename CMap>
      GraphMap& operator=(const CMap&) {
        checkConcept<ReadMap<Key, Value>, CMap>();
        return *this;
      }

    public:
      template<typename _Map>
      struct Constraints {
        void constraints() {
          checkConcept
            <ReferenceMap<Key, Value, Value&, const Value&>, _Map>();
          _Map m1(g);
          _Map m2(g,t);

          // Copy constructor
          // _Map m3(m);

          // Assignment operator
          // ReadMap<Key, Value> cmap;
          // m3 = cmap;

          ::lemon::ignore_unused_variable_warning(m1);
          ::lemon::ignore_unused_variable_warning(m2);
          // ::lemon::ignore_unused_variable_warning(m3);
        }

        const _Map &m;
        const GR &g;
        const typename GraphMap::Value &t;
        Constraints() {}
      };

    };

    /// \brief Skeleton class for mappable directed graphs.
    ///
    /// This class describes the interface of mappable directed graphs.
    /// It extends \ref BaseDigraphComponent with the standard digraph
    /// map classes, namely \c NodeMap and \c ArcMap.
    /// This concept is part of the Digraph concept.
    template <typename BAS = BaseDigraphComponent>
    class MappableDigraphComponent : public BAS  {
    public:

      typedef BAS Base;
      typedef typename Base::Node Node;
      typedef typename Base::Arc Arc;

      typedef MappableDigraphComponent Digraph;

      /// \brief Standard graph map for the nodes.
      ///
      /// Standard graph map for the nodes.
      /// It conforms to the ReferenceMap concept.
      template <typename V>
      class NodeMap : public GraphMap<MappableDigraphComponent, Node, V> {
        typedef GraphMap<MappableDigraphComponent, Node, V> Parent;

      public:
        /// \brief Construct a new map.
        ///
        /// Construct a new map for the digraph.
        explicit NodeMap(const MappableDigraphComponent& digraph)
          : Parent(digraph) {}

        /// \brief Construct a new map with default value.
        ///
        /// Construct a new map for the digraph and initalize the values.
        NodeMap(const MappableDigraphComponent& digraph, const V& value)
          : Parent(digraph, value) {}

      private:
        /// \brief Copy constructor.
        ///
        /// Copy Constructor.
        NodeMap(const NodeMap& nm) : Parent(nm) {}

        /// \brief Assignment operator.
        ///
        /// Assignment operator.
        template <typename CMap>
        NodeMap& operator=(const CMap&) {
          checkConcept<ReadMap<Node, V>, CMap>();
          return *this;
        }

      };

      /// \brief Standard graph map for the arcs.
      ///
      /// Standard graph map for the arcs.
      /// It conforms to the ReferenceMap concept.
      template <typename V>
      class ArcMap : public GraphMap<MappableDigraphComponent, Arc, V> {
        typedef GraphMap<MappableDigraphComponent, Arc, V> Parent;

      public:
        /// \brief Construct a new map.
        ///
        /// Construct a new map for the digraph.
        explicit ArcMap(const MappableDigraphComponent& digraph)
          : Parent(digraph) {}

        /// \brief Construct a new map with default value.
        ///
        /// Construct a new map for the digraph and initalize the values.
        ArcMap(const MappableDigraphComponent& digraph, const V& value)
          : Parent(digraph, value) {}

      private:
        /// \brief Copy constructor.
        ///
        /// Copy Constructor.
        ArcMap(const ArcMap& nm) : Parent(nm) {}

        /// \brief Assignment operator.
        ///
        /// Assignment operator.
        template <typename CMap>
        ArcMap& operator=(const CMap&) {
          checkConcept<ReadMap<Arc, V>, CMap>();
          return *this;
        }

      };


      template <typename _Digraph>
      struct Constraints {

        struct Dummy {
          int value;
          Dummy() : value(0) {}
          Dummy(int _v) : value(_v) {}
        };

        void constraints() {
          checkConcept<Base, _Digraph>();
          { // int map test
            typedef typename _Digraph::template NodeMap<int> IntNodeMap;
            checkConcept<GraphMap<_Digraph, typename _Digraph::Node, int>,
              IntNodeMap >();
          } { // bool map test
            typedef typename _Digraph::template NodeMap<bool> BoolNodeMap;
            checkConcept<GraphMap<_Digraph, typename _Digraph::Node, bool>,
              BoolNodeMap >();
          } { // Dummy map test
            typedef typename _Digraph::template NodeMap<Dummy> DummyNodeMap;
            checkConcept<GraphMap<_Digraph, typename _Digraph::Node, Dummy>,
              DummyNodeMap >();
          }

          { // int map test
            typedef typename _Digraph::template ArcMap<int> IntArcMap;
            checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, int>,
              IntArcMap >();
          } { // bool map test
            typedef typename _Digraph::template ArcMap<bool> BoolArcMap;
            checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, bool>,
              BoolArcMap >();
          } { // Dummy map test
            typedef typename _Digraph::template ArcMap<Dummy> DummyArcMap;
            checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, Dummy>,
              DummyArcMap >();
          }
        }

        const _Digraph& digraph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for mappable undirected graphs.
    ///
    /// This class describes the interface of mappable undirected graphs.
    /// It extends \ref MappableDigraphComponent with the standard graph
    /// map class for edges (\c EdgeMap).
    /// This concept is part of the Graph concept.
    template <typename BAS = BaseGraphComponent>
    class MappableGraphComponent : public MappableDigraphComponent<BAS>  {
    public:

      typedef BAS Base;
      typedef typename Base::Edge Edge;

      typedef MappableGraphComponent Graph;

      /// \brief Standard graph map for the edges.
      ///
      /// Standard graph map for the edges.
      /// It conforms to the ReferenceMap concept.
      template <typename V>
      class EdgeMap : public GraphMap<MappableGraphComponent, Edge, V> {
        typedef GraphMap<MappableGraphComponent, Edge, V> Parent;

      public:
        /// \brief Construct a new map.
        ///
        /// Construct a new map for the graph.
        explicit EdgeMap(const MappableGraphComponent& graph)
          : Parent(graph) {}

        /// \brief Construct a new map with default value.
        ///
        /// Construct a new map for the graph and initalize the values.
        EdgeMap(const MappableGraphComponent& graph, const V& value)
          : Parent(graph, value) {}

      private:
        /// \brief Copy constructor.
        ///
        /// Copy Constructor.
        EdgeMap(const EdgeMap& nm) : Parent(nm) {}

        /// \brief Assignment operator.
        ///
        /// Assignment operator.
        template <typename CMap>
        EdgeMap& operator=(const CMap&) {
          checkConcept<ReadMap<Edge, V>, CMap>();
          return *this;
        }

      };


      template <typename _Graph>
      struct Constraints {

        struct Dummy {
          int value;
          Dummy() : value(0) {}
          Dummy(int _v) : value(_v) {}
        };

        void constraints() {
          checkConcept<MappableDigraphComponent<Base>, _Graph>();

          { // int map test
            typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
            checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>,
              IntEdgeMap >();
          } { // bool map test
            typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap;
            checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>,
              BoolEdgeMap >();
          } { // Dummy map test
            typedef typename _Graph::template EdgeMap<Dummy> DummyEdgeMap;
            checkConcept<GraphMap<_Graph, typename _Graph::Edge, Dummy>,
              DummyEdgeMap >();
          }
        }

        const _Graph& graph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for mappable undirected bipartite graphs.
    ///
    /// This class describes the interface of mappable undirected
    /// bipartite graphs.  It extends \ref MappableGraphComponent with
    /// the standard graph map class for red and blue nodes (\c
    /// RedNodeMap and BlueNodeMap). This concept is part of the
    /// BpGraph concept.
    template <typename BAS = BaseBpGraphComponent>
    class MappableBpGraphComponent : public MappableGraphComponent<BAS>  {
    public:

      typedef BAS Base;
      typedef typename Base::Node Node;

      typedef MappableBpGraphComponent BpGraph;

      /// \brief Standard graph map for the red nodes.
      ///
      /// Standard graph map for the red nodes.
      /// It conforms to the ReferenceMap concept.
      template <typename V>
      class RedNodeMap : public GraphMap<MappableBpGraphComponent, Node, V> {
        typedef GraphMap<MappableBpGraphComponent, Node, V> Parent;

      public:
        /// \brief Construct a new map.
        ///
        /// Construct a new map for the graph.
        explicit RedNodeMap(const MappableBpGraphComponent& graph)
          : Parent(graph) {}

        /// \brief Construct a new map with default value.
        ///
        /// Construct a new map for the graph and initalize the values.
        RedNodeMap(const MappableBpGraphComponent& graph, const V& value)
          : Parent(graph, value) {}

      private:
        /// \brief Copy constructor.
        ///
        /// Copy Constructor.
        RedNodeMap(const RedNodeMap& nm) : Parent(nm) {}

        /// \brief Assignment operator.
        ///
        /// Assignment operator.
        template <typename CMap>
        RedNodeMap& operator=(const CMap&) {
          checkConcept<ReadMap<Node, V>, CMap>();
          return *this;
        }

      };

      /// \brief Standard graph map for the blue nodes.
      ///
      /// Standard graph map for the blue nodes.
      /// It conforms to the ReferenceMap concept.
      template <typename V>
      class BlueNodeMap : public GraphMap<MappableBpGraphComponent, Node, V> {
        typedef GraphMap<MappableBpGraphComponent, Node, V> Parent;

      public:
        /// \brief Construct a new map.
        ///
        /// Construct a new map for the graph.
        explicit BlueNodeMap(const MappableBpGraphComponent& graph)
          : Parent(graph) {}

        /// \brief Construct a new map with default value.
        ///
        /// Construct a new map for the graph and initalize the values.
        BlueNodeMap(const MappableBpGraphComponent& graph, const V& value)
          : Parent(graph, value) {}

      private:
        /// \brief Copy constructor.
        ///
        /// Copy Constructor.
        BlueNodeMap(const BlueNodeMap& nm) : Parent(nm) {}

        /// \brief Assignment operator.
        ///
        /// Assignment operator.
        template <typename CMap>
        BlueNodeMap& operator=(const CMap&) {
          checkConcept<ReadMap<Node, V>, CMap>();
          return *this;
        }

      };


      template <typename _BpGraph>
      struct Constraints {

        struct Dummy {
          int value;
          Dummy() : value(0) {}
          Dummy(int _v) : value(_v) {}
        };

        void constraints() {
          checkConcept<MappableGraphComponent<Base>, _BpGraph>();

          { // int map test
            typedef typename _BpGraph::template RedNodeMap<int>
              IntRedNodeMap;
            checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, int>,
              IntRedNodeMap >();
          } { // bool map test
            typedef typename _BpGraph::template RedNodeMap<bool>
              BoolRedNodeMap;
            checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, bool>,
              BoolRedNodeMap >();
          } { // Dummy map test
            typedef typename _BpGraph::template RedNodeMap<Dummy>
              DummyRedNodeMap;
            checkConcept<GraphMap<_BpGraph, typename _BpGraph::RedNode, Dummy>,
              DummyRedNodeMap >();
          }

          { // int map test
            typedef typename _BpGraph::template BlueNodeMap<int>
              IntBlueNodeMap;
            checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, int>,
              IntBlueNodeMap >();
          } { // bool map test
            typedef typename _BpGraph::template BlueNodeMap<bool>
              BoolBlueNodeMap;
            checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, bool>,
              BoolBlueNodeMap >();
          } { // Dummy map test
            typedef typename _BpGraph::template BlueNodeMap<Dummy>
              DummyBlueNodeMap;
            checkConcept<GraphMap<_BpGraph, typename _BpGraph::BlueNode, Dummy>,
              DummyBlueNodeMap >();
          }
        }

        const _BpGraph& bpgraph;
      };
    };

    /// \brief Skeleton class for extendable directed graphs.
    ///
    /// This class describes the interface of extendable directed graphs.
    /// It extends \ref BaseDigraphComponent with functions for adding
    /// nodes and arcs to the digraph.
    /// This concept requires \ref AlterableDigraphComponent.
    template <typename BAS = BaseDigraphComponent>
    class ExtendableDigraphComponent : public BAS {
    public:
      typedef BAS Base;

      typedef typename Base::Node Node;
      typedef typename Base::Arc Arc;

      /// \brief Add a new node to the digraph.
      ///
      /// This function adds a new node to the digraph.
      Node addNode() {
        return INVALID;
      }

      /// \brief Add a new arc connecting the given two nodes.
      ///
      /// This function adds a new arc connecting the given two nodes
      /// of the digraph.
      Arc addArc(const Node&, const Node&) {
        return INVALID;
      }

      template <typename _Digraph>
      struct Constraints {
        void constraints() {
          checkConcept<Base, _Digraph>();
          typename _Digraph::Node node_a, node_b;
          node_a = digraph.addNode();
          node_b = digraph.addNode();
          typename _Digraph::Arc arc;
          arc = digraph.addArc(node_a, node_b);
        }

        _Digraph& digraph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for extendable undirected graphs.
    ///
    /// This class describes the interface of extendable undirected graphs.
    /// It extends \ref BaseGraphComponent with functions for adding
    /// nodes and edges to the graph.
    /// This concept requires \ref AlterableGraphComponent.
    template <typename BAS = BaseGraphComponent>
    class ExtendableGraphComponent : public BAS {
    public:

      typedef BAS Base;
      typedef typename Base::Node Node;
      typedef typename Base::Edge Edge;

      /// \brief Add a new node to the digraph.
      ///
      /// This function adds a new node to the digraph.
      Node addNode() {
        return INVALID;
      }

      /// \brief Add a new edge connecting the given two nodes.
      ///
      /// This function adds a new edge connecting the given two nodes
      /// of the graph.
      Edge addEdge(const Node&, const Node&) {
        return INVALID;
      }

      template <typename _Graph>
      struct Constraints {
        void constraints() {
          checkConcept<Base, _Graph>();
          typename _Graph::Node node_a, node_b;
          node_a = graph.addNode();
          node_b = graph.addNode();
          typename _Graph::Edge edge;
          edge = graph.addEdge(node_a, node_b);
        }

        _Graph& graph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for extendable undirected bipartite graphs.
    ///
    /// This class describes the interface of extendable undirected
    /// bipartite graphs. It extends \ref BaseGraphComponent with
    /// functions for adding nodes and edges to the graph. This
    /// concept requires \ref AlterableBpGraphComponent.
    template <typename BAS = BaseBpGraphComponent>
    class ExtendableBpGraphComponent : public BAS {
    public:

      typedef BAS Base;
      typedef typename Base::Node Node;
      typedef typename Base::RedNode RedNode;
      typedef typename Base::BlueNode BlueNode;
      typedef typename Base::Edge Edge;

      /// \brief Add a new red node to the digraph.
      ///
      /// This function adds a red new node to the digraph.
      RedNode addRedNode() {
        return INVALID;
      }

      /// \brief Add a new blue node to the digraph.
      ///
      /// This function adds a blue new node to the digraph.
      BlueNode addBlueNode() {
        return INVALID;
      }

      /// \brief Add a new edge connecting the given two nodes.
      ///
      /// This function adds a new edge connecting the given two nodes
      /// of the graph. The first node has to be a red node, and the
      /// second one a blue node.
      Edge addEdge(const RedNode&, const BlueNode&) {
        return INVALID;
      }
      Edge addEdge(const BlueNode&, const RedNode&) {
        return INVALID;
      }

      template <typename _BpGraph>
      struct Constraints {
        void constraints() {
          checkConcept<Base, _BpGraph>();
          typename _BpGraph::RedNode red_node;
          typename _BpGraph::BlueNode blue_node;
          red_node = bpgraph.addRedNode();
          blue_node = bpgraph.addBlueNode();
          typename _BpGraph::Edge edge;
          edge = bpgraph.addEdge(red_node, blue_node);
          edge = bpgraph.addEdge(blue_node, red_node);
        }

        _BpGraph& bpgraph;
      };
    };

    /// \brief Skeleton class for erasable directed graphs.
    ///
    /// This class describes the interface of erasable directed graphs.
    /// It extends \ref BaseDigraphComponent with functions for removing
    /// nodes and arcs from the digraph.
    /// This concept requires \ref AlterableDigraphComponent.
    template <typename BAS = BaseDigraphComponent>
    class ErasableDigraphComponent : public BAS {
    public:

      typedef BAS Base;
      typedef typename Base::Node Node;
      typedef typename Base::Arc Arc;

      /// \brief Erase a node from the digraph.
      ///
      /// This function erases the given node from the digraph and all arcs
      /// connected to the node.
      void erase(const Node&) {}

      /// \brief Erase an arc from the digraph.
      ///
      /// This function erases the given arc from the digraph.
      void erase(const Arc&) {}

      template <typename _Digraph>
      struct Constraints {
        void constraints() {
          checkConcept<Base, _Digraph>();
          const typename _Digraph::Node node(INVALID);
          digraph.erase(node);
          const typename _Digraph::Arc arc(INVALID);
          digraph.erase(arc);
        }

        _Digraph& digraph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for erasable undirected graphs.
    ///
    /// This class describes the interface of erasable undirected graphs.
    /// It extends \ref BaseGraphComponent with functions for removing
    /// nodes and edges from the graph.
    /// This concept requires \ref AlterableGraphComponent.
    template <typename BAS = BaseGraphComponent>
    class ErasableGraphComponent : public BAS {
    public:

      typedef BAS Base;
      typedef typename Base::Node Node;
      typedef typename Base::Edge Edge;

      /// \brief Erase a node from the graph.
      ///
      /// This function erases the given node from the graph and all edges
      /// connected to the node.
      void erase(const Node&) {}

      /// \brief Erase an edge from the digraph.
      ///
      /// This function erases the given edge from the digraph.
      void erase(const Edge&) {}

      template <typename _Graph>
      struct Constraints {
        void constraints() {
          checkConcept<Base, _Graph>();
          const typename _Graph::Node node(INVALID);
          graph.erase(node);
          const typename _Graph::Edge edge(INVALID);
          graph.erase(edge);
        }

        _Graph& graph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for erasable undirected graphs.
    ///
    /// This class describes the interface of erasable undirected
    /// bipartite graphs. It extends \ref BaseBpGraphComponent with
    /// functions for removing nodes and edges from the graph. This
    /// concept requires \ref AlterableBpGraphComponent.
    template <typename BAS = BaseBpGraphComponent>
    class ErasableBpGraphComponent : public ErasableGraphComponent<BAS> {};

    /// \brief Skeleton class for clearable directed graphs.
    ///
    /// This class describes the interface of clearable directed graphs.
    /// It extends \ref BaseDigraphComponent with a function for clearing
    /// the digraph.
    /// This concept requires \ref AlterableDigraphComponent.
    template <typename BAS = BaseDigraphComponent>
    class ClearableDigraphComponent : public BAS {
    public:

      typedef BAS Base;

      /// \brief Erase all nodes and arcs from the digraph.
      ///
      /// This function erases all nodes and arcs from the digraph.
      void clear() {}

      template <typename _Digraph>
      struct Constraints {
        void constraints() {
          checkConcept<Base, _Digraph>();
          digraph.clear();
        }

        _Digraph& digraph;
        Constraints() {}
      };
    };

    /// \brief Skeleton class for clearable undirected graphs.
    ///
    /// This class describes the interface of clearable undirected graphs.
    /// It extends \ref BaseGraphComponent with a function for clearing
    /// the graph.
    /// This concept requires \ref AlterableGraphComponent.
    template <typename BAS = BaseGraphComponent>
    class ClearableGraphComponent : public ClearableDigraphComponent<BAS> {};

    /// \brief Skeleton class for clearable undirected biparite graphs.
    ///
    /// This class describes the interface of clearable undirected
    /// bipartite graphs. It extends \ref BaseBpGraphComponent with a
    /// function for clearing the graph.  This concept requires \ref
    /// AlterableBpGraphComponent.
    template <typename BAS = BaseBpGraphComponent>
    class ClearableBpGraphComponent : public ClearableGraphComponent<BAS> {};

  }

}

#endif