Location: LEMON/LEMON-official/lemon/concepts/graph_components.h

Load file history
gravatar
deba@inf.elte.hu
Reorganize header files (Ticket #97) In addition on some places the DefaultMap<G, K, V> is replaced with ItemSetTraits<G, K>::template Map<V>::Type, to decrease the dependencies of different tools. It is obviously better solution.
   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
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2008
* 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 concept of graph components.
#ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H
#define LEMON_CONCEPT_GRAPH_COMPONENTS_H
#include <lemon/core.h>
#include <lemon/concepts/maps.h>
#include <lemon/bits/alteration_notifier.h>
namespace lemon {
namespace concepts {
/// \brief Skeleton class for graph Node and Arc types
///
/// This class describes the interface of Node and Arc (and Edge
/// in undirected graphs) subtypes of 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 than Node
/// and Arc types should \em not derive from the same base class.
/// For Node you should instantiate it with character 'n' and for Arc
/// with 'a'.
#ifndef DOXYGEN
template <char _selector = '0'>
#endif
class GraphItem {
public:
/// \brief 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 Invalid constructor \& conversion.
///
/// This constructor initializes the item to be invalid.
/// \sa Invalid for more details.
GraphItem(Invalid) {}
/// \brief Assign operator for nodes.
///
/// The nodes are assignable.
///
GraphItem& operator=(GraphItem const&) { return *this; }
/// \brief Equality operator.
///
/// Two iterators are equal if and only if they represents the
/// same node in the graph or both are invalid.
bool operator==(GraphItem) const { return false; }
/// \brief Inequality operator.
///
/// \sa operator==(const Node& n)
///
bool operator!=(GraphItem) const { return false; }
/// \brief Artificial ordering operator.
///
/// To allow the use of graph descriptors as key type in std::map or
/// similar associative container we require this.
///
/// \note This operator only have to define some strict ordering of
/// the items; this order has nothing to do with the iteration
/// ordering of the items.
bool operator<(GraphItem) const { return false; }
template<typename _GraphItem>
struct Constraints {
void constraints() {
_GraphItem i1;
_GraphItem i2 = i1;
_GraphItem i3 = INVALID;
i1 = i2 = i3;
bool b;
// b = (ia == ib) && (ia != ib) && (ia < ib);
b = (ia == ib) && (ia != ib);
b = (ia == INVALID) && (ib != INVALID);
b = (ia < ib);
}
const _GraphItem &ia;
const _GraphItem &ib;
};
};
/// \brief An empty base directed graph class.
///
/// This class provides the minimal set of features needed for a
/// directed graph structure. All digraph concepts have to be
/// conform to this base directed graph. It just provides types
/// for nodes and arcs and functions to get the source and the
/// target of the 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<'e'> Arc;
/// \brief Gives back the target node of an arc.
///
/// Gives back the target node of an arc.
///
Node target(const Arc&) const { return INVALID;}
/// \brief Gives back the source node of an arc.
///
/// Gives back the source node of an arc.
///
Node source(const Arc&) const { return INVALID;}
/// \brief Gives back the opposite node on the given arc.
///
/// Gives back 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;
};
};
/// \brief An empty base undirected graph class.
///
/// This class provides the minimal set of features needed for an
/// undirected graph structure. All undirected graph concepts have
/// to be conform to this base graph. It just provides types for
/// nodes, arcs and edges and functions to get the
/// source and the target of the arcs and edges,
/// conversion from arcs to edges and function to get
/// both direction of the edges.
class BaseGraphComponent : public BaseDigraphComponent {
public:
typedef BaseDigraphComponent::Node Node;
typedef BaseDigraphComponent::Arc Arc;
/// \brief Undirected arc class of the graph.
///
/// This class represents the edges of the graph.
/// The undirected graphs can be used as a directed graph which
/// for each arc contains the opposite arc too so the graph is
/// bidirected. The edge represents two opposite
/// directed arcs.
class Edge : public GraphItem<'u'> {
public:
typedef GraphItem<'u'> Parent;
/// \brief 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 Invalid constructor \& conversion.
///
/// This constructor initializes the item to be invalid.
/// \sa Invalid for more details.
Edge(Invalid) {}
/// \brief Converter from arc to edge.
///
/// Besides the core graph item functionality each arc should
/// be convertible to the represented edge.
Edge(const Arc&) {}
/// \brief Assign arc to edge.
///
/// Besides the core graph item functionality each arc should
/// be convertible to the represented edge.
Edge& operator=(const Arc&) { return *this; }
};
/// \brief Returns 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 Returns the directed arc.
///
/// Returns the directed arc from its direction and the
/// represented edge.
Arc direct(const Edge&, bool) const { return INVALID;}
/// \brief Returns the directed arc.
///
/// Returns the directed arc from its source and the
/// represented edge.
Arc direct(const Edge&, const Node&) const { return INVALID;}
/// \brief Returns the opposite arc.
///
/// Returns the opposite arc. It is the arc representing the
/// same edge and has opposite direction.
Arc oppositeArc(const Arc&) const { return INVALID;}
/// \brief Gives back one ending of an edge.
///
/// Gives back one ending of an edge.
Node u(const Edge&) const { return INVALID;}
/// \brief Gives back the other ending of an edge.
///
/// Gives back the other ending of an edge.
Node v(const Edge&) 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<'u'>, 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, n);
e = graph.oppositeArc(e);
ue = e;
bool d = graph.direction(e);
ignore_unused_variable_warning(d);
}
}
const _Graph& graph;
};
};
/// \brief An empty idable base digraph class.
///
/// This class provides beside the core digraph features
/// core id functions for the digraph structure.
/// The most of the base digraphs should be conform to this concept.
/// The id's are unique and immutable.
template <typename _Base = BaseDigraphComponent>
class IDableDigraphComponent : public _Base {
public:
typedef _Base Base;
typedef typename Base::Node Node;
typedef typename Base::Arc Arc;
/// \brief Gives back an unique integer id for the Node.
///
/// Gives back an unique integer id for the Node.
///
int id(const Node&) const { return -1;}
/// \brief Gives back the node by the unique id.
///
/// Gives back the node by the unique id.
/// If the digraph does not contain node with the given id
/// then the result of the function is undetermined.
Node nodeFromId(int) const { return INVALID;}
/// \brief Gives back an unique integer id for the Arc.
///
/// Gives back an unique integer id for the Arc.
///
int id(const Arc&) const { return -1;}
/// \brief Gives back the arc by the unique id.
///
/// Gives back the arc by the unique id.
/// If the digraph does not contain arc with the given id
/// then the result of the function is undetermined.
Arc arcFromId(int) const { return INVALID;}
/// \brief Gives back an integer greater or equal to the maximum
/// Node id.
///
/// Gives back an integer greater or equal to the maximum Node
/// id.
int maxNodeId() const { return -1;}
/// \brief Gives back an integer greater or equal to the maximum
/// Arc id.
///
/// Gives back 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;
int nid = digraph.id(node);
nid = digraph.id(node);
node = digraph.nodeFromId(nid);
typename _Digraph::Arc arc;
int eid = digraph.id(arc);
eid = digraph.id(arc);
arc = digraph.arcFromId(eid);
nid = digraph.maxNodeId();
ignore_unused_variable_warning(nid);
eid = digraph.maxArcId();
ignore_unused_variable_warning(eid);
}
const _Digraph& digraph;
};
};
/// \brief An empty idable base undirected graph class.
///
/// This class provides beside the core undirected graph features
/// core id functions for the undirected graph structure. The
/// most of the base undirected graphs should be conform to this
/// concept. The id's are unique and immutable.
template <typename _Base = BaseGraphComponent>
class IDableGraphComponent : public IDableDigraphComponent<_Base> {
public:
typedef _Base Base;
typedef typename Base::Edge Edge;
using IDableDigraphComponent<_Base>::id;
/// \brief Gives back an unique integer id for the Edge.
///
/// Gives back an unique integer id for the Edge.
///
int id(const Edge&) const { return -1;}
/// \brief Gives back the edge by the unique id.
///
/// Gives back the edge by the unique id. If the
/// graph does not contain arc with the given id then the
/// result of the function is undetermined.
Edge edgeFromId(int) const { return INVALID;}
/// \brief Gives back an integer greater or equal to the maximum
/// Edge id.
///
/// Gives back an integer greater or equal to the maximum Edge
/// id.
int maxEdgeId() const { return -1;}
template <typename _Graph>
struct Constraints {
void constraints() {
checkConcept<Base, _Graph >();
checkConcept<IDableDigraphComponent<Base>, _Graph >();
typename _Graph::Edge edge;
int ueid = graph.id(edge);
ueid = graph.id(edge);
edge = graph.edgeFromId(ueid);
ueid = graph.maxEdgeId();
ignore_unused_variable_warning(ueid);
}
const _Graph& graph;
};
};
/// \brief Skeleton class for graph NodeIt and ArcIt
///
/// Skeleton class for graph NodeIt and ArcIt.
///
template <typename _Graph, typename _Item>
class GraphItemIt : public _Item {
public:
/// \brief Default constructor.
///
/// @warning The default constructor sets the iterator
/// to an undefined value.
GraphItemIt() {}
/// \brief Copy constructor.
///
/// Copy constructor.
///
GraphItemIt(const GraphItemIt& ) {}
/// \brief Sets the iterator to the first item.
///
/// Sets the iterator to the first item of \c the graph.
///
explicit GraphItemIt(const _Graph&) {}
/// \brief Invalid constructor \& conversion.
///
/// This constructor initializes the item to be invalid.
/// \sa Invalid for more details.
GraphItemIt(Invalid) {}
/// \brief Assign operator for items.
///
/// The items are assignable.
///
GraphItemIt& operator=(const GraphItemIt&) { return *this; }
/// \brief Next item.
///
/// Assign the iterator to the next item.
///
GraphItemIt& operator++() { return *this; }
/// \brief 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
///
/// \sa operator==(Node n)
///
bool operator!=(const GraphItemIt&) const { return true;}
template<typename _GraphItemIt>
struct Constraints {
void constraints() {
_GraphItemIt it1(g);
_GraphItemIt it2;
it2 = ++it1;
++it2 = it1;
++(++it1);
_Item bi = it1;
bi = it2;
}
_Graph& g;
};
};
/// \brief Skeleton class for graph InArcIt and OutArcIt
///
/// \note Because InArcIt and OutArcIt may not inherit from the same
/// base class, the _selector is a additional template parameter. For
/// InArcIt you should instantiate it with character 'i' and for
/// OutArcIt with 'o'.
template <typename _Graph,
typename _Item = typename _Graph::Arc,
typename _Base = typename _Graph::Node,
char _selector = '0'>
class GraphIncIt : public _Item {
public:
/// \brief Default constructor.
///
/// @warning The default constructor sets the iterator
/// to an undefined value.
GraphIncIt() {}
/// \brief Copy constructor.
///
/// Copy constructor.
///
GraphIncIt(GraphIncIt const& gi) : _Item(gi) {}
/// \brief Sets the iterator to the first arc incoming into or outgoing
/// from the node.
///
/// Sets the iterator to the first arc incoming into or outgoing
/// from the node.
///
explicit GraphIncIt(const _Graph&, const _Base&) {}
/// \brief Invalid constructor \& conversion.
///
/// This constructor initializes the item to be invalid.
/// \sa Invalid for more details.
GraphIncIt(Invalid) {}
/// \brief Assign operator for iterators.
///
/// The iterators are assignable.
///
GraphIncIt& operator=(GraphIncIt const&) { return *this; }
/// \brief Next item.
///
/// Assign the iterator to the next item.
///
GraphIncIt& operator++() { return *this; }
/// \brief 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
///
/// \sa operator==(Node n)
///
bool operator!=(const GraphIncIt&) const { return true;}
template <typename _GraphIncIt>
struct Constraints {
void constraints() {
checkConcept<GraphItem<_selector>, _GraphIncIt>();
_GraphIncIt it1(graph, node);
_GraphIncIt it2;
it2 = ++it1;
++it2 = it1;
++(++it1);
_Item e = it1;
e = it2;
}
_Item arc;
_Base node;
_Graph graph;
_GraphIncIt it;
};
};
/// \brief An empty iterable digraph class.
///
/// This class provides beside the core digraph features
/// iterator based iterable interface for the digraph structure.
/// This concept is part of the Digraph concept.
template <typename _Base = BaseDigraphComponent>
class IterableDigraphComponent : public _Base {
public:
typedef _Base 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 Gives back the first node in the iterating order.
///
/// Gives back the first node in the iterating order.
///
void first(Node&) const {}
/// \brief Gives back the next node in the iterating order.
///
/// Gives back the next node in the iterating order.
///
void next(Node&) const {}
/// \brief Gives back the first arc in the iterating order.
///
/// Gives back the first arc in the iterating order.
///
void first(Arc&) const {}
/// \brief Gives back the next arc in the iterating order.
///
/// Gives back the next arc in the iterating order.
///
void next(Arc&) const {}
/// \brief Gives back the first of the arcs point to the given
/// node.
///
/// Gives back the first of the arcs point to the given node.
///
void firstIn(Arc&, const Node&) const {}
/// \brief Gives back the next of the arcs points to the given
/// node.
///
/// Gives back the next of the arcs points to the given node.
///
void nextIn(Arc&) const {}
/// \brief Gives back the first of the arcs start from the
/// given node.
///
/// Gives back the first of the arcs start from the given node.
///
void firstOut(Arc&, const Node&) const {}
/// \brief Gives back the next of the arcs start from the given
/// node.
///
/// Gives back the next of the arcs start from the given node.
///
void nextOut(Arc&) const {}
/// @}
/// \name Class based iteration
///
/// This interface provides functions for iteration on 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 node.
///
/// This iterator goes through each node.
///
typedef GraphItemIt<Digraph, Arc> ArcIt;
/// \brief This iterator goes trough the incoming arcs of a node.
///
/// This iterator goes trough the \e inccoming 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.
///
/// Gives back the base node of the iterator.
/// It is always the target of the pointed arc.
Node baseNode(const InArcIt&) const { return INVALID; }
/// \brief The running node of the iterator.
///
/// Gives back the running node of the iterator.
/// It is always the source of the pointed arc.
Node runningNode(const InArcIt&) const { return INVALID; }
/// \brief The base node of the iterator.
///
/// Gives back the base node of the iterator.
/// It is always the source of the pointed arc.
Node baseNode(const OutArcIt&) const { return INVALID; }
/// \brief The running node of the iterator.
///
/// Gives back the running node of the iterator.
/// It is always the target 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;
typename _Digraph::InArcIt ieit(INVALID);
typename _Digraph::OutArcIt oeit(INVALID);
n = digraph.baseNode(ieit);
n = digraph.runningNode(ieit);
n = digraph.baseNode(oeit);
n = digraph.runningNode(oeit);
ignore_unused_variable_warning(n);
}
}
const _Digraph& digraph;
};
};
/// \brief An empty iterable undirected graph class.
///
/// This class provides beside the core graph features iterator
/// based iterable interface for the undirected graph structure.
/// This concept is part of the Graph concept.
template <typename _Base = BaseGraphComponent>
class IterableGraphComponent : public IterableDigraphComponent<_Base> {
public:
typedef _Base 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 graph items
/// @{
using IterableDigraphComponent<_Base>::first;
using IterableDigraphComponent<_Base>::next;
/// \brief Gives back the first edge in the iterating
/// order.
///
/// Gives back the first edge in the iterating order.
///
void first(Edge&) const {}
/// \brief Gives back the next edge in the iterating
/// order.
///
/// Gives back the next edge in the iterating order.
///
void next(Edge&) const {}
/// \brief Gives back the first of the edges from the
/// given node.
///
/// Gives back the first of the edges from the given
/// node. The bool parameter gives back that direction which
/// gives a good direction of the edge so the source of the
/// directed arc is the given node.
void firstInc(Edge&, bool&, const Node&) const {}
/// \brief Gives back the next of the edges from the
/// given node.
///
/// Gives back the next of the edges from the given
/// node. The bool parameter should be used as the \c firstInc()
/// use it.
void nextInc(Edge&, bool&) const {}
using IterableDigraphComponent<_Base>::baseNode;
using IterableDigraphComponent<_Base>::runningNode;
/// @}
/// \name Class based iteration
///
/// This interface provides functions for iteration on graph items
///
/// @{
/// \brief This iterator goes through each node.
///
/// This iterator goes through each node.
typedef GraphItemIt<Graph, Edge> EdgeIt;
/// \brief This iterator goes trough the incident arcs of a
/// node.
///
/// This iterator goes trough the incident arcs of a certain
/// node of a graph.
typedef GraphIncIt<Graph, Edge, Node, 'u'> IncEdgeIt;
/// \brief The base node of the iterator.
///
/// Gives back the base node of the iterator.
Node baseNode(const IncEdgeIt&) const { return INVALID; }
/// \brief The running node of the iterator.
///
/// 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, 'u'>, typename _Graph::IncEdgeIt>();
typename _Graph::Node n;
typename _Graph::IncEdgeIt ueit(INVALID);
n = graph.baseNode(ueit);
n = graph.runningNode(ueit);
}
}
const _Graph& graph;
};
};
/// \brief An empty alteration notifier digraph class.
///
/// This class provides beside the core digraph features alteration
/// notifier interface for the digraph structure. This 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
/// notified about it.
template <typename _Base = BaseDigraphComponent>
class AlterableDigraphComponent : public _Base {
public:
typedef _Base Base;
typedef typename Base::Node Node;
typedef typename Base::Arc Arc;
/// The node observer registry.
typedef AlterationNotifier<AlterableDigraphComponent, Node>
NodeNotifier;
/// The arc observer registry.
typedef AlterationNotifier<AlterableDigraphComponent, Arc>
ArcNotifier;
/// \brief Gives back the node alteration notifier.
///
/// Gives back the node alteration notifier.
NodeNotifier& notifier(Node) const {
return NodeNotifier();
}
/// \brief Gives back the arc alteration notifier.
///
/// Gives back the arc alteration notifier.
ArcNotifier& notifier(Arc) const {
return ArcNotifier();
}
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());
ignore_unused_variable_warning(nn);
ignore_unused_variable_warning(en);
}
const _Digraph& digraph;
};
};
/// \brief An empty alteration notifier undirected graph class.
///
/// This class provides beside the core graph features alteration
/// notifier interface for the graph structure. This implements
/// an observer-notifier pattern for each graph item. More
/// obsevers can be registered into the notifier and whenever an
/// alteration occured in the graph all the observers will
/// notified about it.
template <typename _Base = BaseGraphComponent>
class AlterableGraphComponent : public AlterableDigraphComponent<_Base> {
public:
typedef _Base Base;
typedef typename Base::Edge Edge;
/// The arc observer registry.
typedef AlterationNotifier<AlterableGraphComponent, Edge>
EdgeNotifier;
/// \brief Gives back the arc alteration notifier.
///
/// Gives back the arc alteration notifier.
EdgeNotifier& notifier(Edge) const {
return EdgeNotifier();
}
template <typename _Graph>
struct Constraints {
void constraints() {
checkConcept<AlterableGraphComponent<Base>, _Graph>();
typename _Graph::EdgeNotifier& uen
= graph.notifier(typename _Graph::Edge());
ignore_unused_variable_warning(uen);
}
const _Graph& graph;
};
};
/// \brief Class describing the concept of graph maps
///
/// This class describes the common interface of the graph maps
/// (NodeMap, ArcMap), that is \ref maps-page "maps" which can be used to
/// associate data to graph descriptors (nodes or arcs).
template <typename _Graph, typename _Item, typename _Value>
class GraphMap : public ReadWriteMap<_Item, _Value> {
public:
typedef ReadWriteMap<_Item, _Value> Parent;
/// The graph type of the map.
typedef _Graph Graph;
/// The key type of the map.
typedef _Item Key;
/// The value type of the map.
typedef _Value Value;
/// \brief Construct a new map.
///
/// Construct a new map for the graph.
explicit GraphMap(const Graph&) {}
/// \brief Construct a new map with default value.
///
/// Construct a new map for the graph and initalise the values.
GraphMap(const Graph&, const Value&) {}
/// \brief Copy constructor.
///
/// Copy Constructor.
GraphMap(const GraphMap&) : Parent() {}
/// \brief Assign operator.
///
/// Assign 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;
}
template<typename _Map>
struct Constraints {
void constraints() {
checkConcept<ReadWriteMap<Key, Value>, _Map >();
// Construction with a graph parameter
_Map a(g);
// Constructor with a graph and a default value parameter
_Map a2(g,t);
// Copy constructor.
_Map b(c);
ReadMap<Key, Value> cmap;
b = cmap;
ignore_unused_variable_warning(a2);
ignore_unused_variable_warning(b);
}
const _Map &c;
const Graph &g;
const typename GraphMap::Value &t;
};
};
/// \brief An empty mappable digraph class.
///
/// This class provides beside the core digraph features
/// map interface for the digraph structure.
/// This concept is part of the Digraph concept.
template <typename _Base = BaseDigraphComponent>
class MappableDigraphComponent : public _Base {
public:
typedef _Base Base;
typedef typename Base::Node Node;
typedef typename Base::Arc Arc;
typedef MappableDigraphComponent Digraph;
/// \brief ReadWrite map of the nodes.
///
/// ReadWrite map of the nodes.
///
template <typename _Value>
class NodeMap : public GraphMap<Digraph, Node, _Value> {
public:
typedef GraphMap<MappableDigraphComponent, Node, _Value> Parent;
/// \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 initalise the values.
NodeMap(const MappableDigraphComponent& digraph, const _Value& value)
: Parent(digraph, value) {}
/// \brief Copy constructor.
///
/// Copy Constructor.
NodeMap(const NodeMap& nm) : Parent(nm) {}
/// \brief Assign operator.
///
/// Assign operator.
template <typename CMap>
NodeMap& operator=(const CMap&) {
checkConcept<ReadMap<Node, _Value>, CMap>();
return *this;
}
};
/// \brief ReadWrite map of the arcs.
///
/// ReadWrite map of the arcs.
///
template <typename _Value>
class ArcMap : public GraphMap<Digraph, Arc, _Value> {
public:
typedef GraphMap<MappableDigraphComponent, Arc, _Value> Parent;
/// \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 initalise the values.
ArcMap(const MappableDigraphComponent& digraph, const _Value& value)
: Parent(digraph, value) {}
/// \brief Copy constructor.
///
/// Copy Constructor.
ArcMap(const ArcMap& nm) : Parent(nm) {}
/// \brief Assign operator.
///
/// Assign operator.
template <typename CMap>
ArcMap& operator=(const CMap&) {
checkConcept<ReadMap<Arc, _Value>, 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 >();
}
}
_Digraph& digraph;
};
};
/// \brief An empty mappable base bipartite graph class.
///
/// This class provides beside the core graph features
/// map interface for the graph structure.
/// This concept is part of the Graph concept.
template <typename _Base = BaseGraphComponent>
class MappableGraphComponent : public MappableDigraphComponent<_Base> {
public:
typedef _Base Base;
typedef typename Base::Edge Edge;
typedef MappableGraphComponent Graph;
/// \brief ReadWrite map of the edges.
///
/// ReadWrite map of the edges.
///
template <typename _Value>
class EdgeMap : public GraphMap<Graph, Edge, _Value> {
public:
typedef GraphMap<MappableGraphComponent, Edge, _Value> Parent;
/// \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 initalise the values.
EdgeMap(const MappableGraphComponent& graph, const _Value& value)
: Parent(graph, value) {}
/// \brief Copy constructor.
///
/// Copy Constructor.
EdgeMap(const EdgeMap& nm) : Parent(nm) {}
/// \brief Assign operator.
///
/// Assign operator.
template <typename CMap>
EdgeMap& operator=(const CMap&) {
checkConcept<ReadMap<Edge, _Value>, CMap>();
return *this;
}
};
template <typename _Graph>
struct Constraints {
struct Dummy {
int value;
Dummy() : value(0) {}
Dummy(int _v) : value(_v) {}
};
void constraints() {
checkConcept<MappableGraphComponent<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 >();
}
}
_Graph& graph;
};
};
/// \brief An empty extendable digraph class.
///
/// This class provides beside the core digraph features digraph
/// extendable interface for the digraph structure. The main
/// difference between the base and this interface is that the
/// digraph alterations should handled already on this level.
template <typename _Base = BaseDigraphComponent>
class ExtendableDigraphComponent : public _Base {
public:
typedef _Base Base;
typedef typename _Base::Node Node;
typedef typename _Base::Arc Arc;
/// \brief Adds a new node to the digraph.
///
/// Adds a new node to the digraph.
///
Node addNode() {
return INVALID;
}
/// \brief Adds a new arc connects the given two nodes.
///
/// Adds a new arc connects the the given two nodes.
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;
};
};
/// \brief An empty extendable base undirected graph class.
///
/// This class provides beside the core undirected graph features
/// core undircted graph extend interface for the graph structure.
/// The main difference between the base and this interface is
/// that the graph alterations should handled already on this
/// level.
template <typename _Base = BaseGraphComponent>
class ExtendableGraphComponent : public _Base {
public:
typedef _Base Base;
typedef typename _Base::Node Node;
typedef typename _Base::Edge Edge;
/// \brief Adds a new node to the graph.
///
/// Adds a new node to the graph.
///
Node addNode() {
return INVALID;
}
/// \brief Adds a new arc connects the given two nodes.
///
/// Adds a new arc connects the the given two nodes.
Edge addArc(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;
};
};
/// \brief An empty erasable digraph class.
///
/// This class provides beside the core digraph features core erase
/// functions for the digraph structure. The main difference between
/// the base and this interface is that the digraph alterations
/// should handled already on this level.
template <typename _Base = BaseDigraphComponent>
class ErasableDigraphComponent : public _Base {
public:
typedef _Base Base;
typedef typename Base::Node Node;
typedef typename Base::Arc Arc;
/// \brief Erase a node from the digraph.
///
/// Erase a node from the digraph. This function should
/// erase all arcs connecting to the node.
void erase(const Node&) {}
/// \brief Erase an arc from the digraph.
///
/// Erase an arc from the digraph.
///
void erase(const Arc&) {}
template <typename _Digraph>
struct Constraints {
void constraints() {
checkConcept<Base, _Digraph>();
typename _Digraph::Node node;
digraph.erase(node);
typename _Digraph::Arc arc;
digraph.erase(arc);
}
_Digraph& digraph;
};
};
/// \brief An empty erasable base undirected graph class.
///
/// This class provides beside the core undirected graph features
/// core erase functions for the undirceted graph structure. The
/// main difference between the base and this interface is that
/// the graph alterations should handled already on this level.
template <typename _Base = BaseGraphComponent>
class ErasableGraphComponent : public _Base {
public:
typedef _Base Base;
typedef typename Base::Node Node;
typedef typename Base::Edge Edge;
/// \brief Erase a node from the graph.
///
/// Erase a node from the graph. This function should erase
/// arcs connecting to the node.
void erase(const Node&) {}
/// \brief Erase an arc from the graph.
///
/// Erase an arc from the graph.
///
void erase(const Edge&) {}
template <typename _Graph>
struct Constraints {
void constraints() {
checkConcept<Base, _Graph>();
typename _Graph::Node node;
graph.erase(node);
typename _Graph::Edge edge;
graph.erase(edge);
}
_Graph& graph;
};
};
/// \brief An empty clearable base digraph class.
///
/// This class provides beside the core digraph features core clear
/// functions for the digraph structure. The main difference between
/// the base and this interface is that the digraph alterations
/// should handled already on this level.
template <typename _Base = BaseDigraphComponent>
class ClearableDigraphComponent : public _Base {
public:
typedef _Base Base;
/// \brief Erase all nodes and arcs from the digraph.
///
/// Erase all nodes and arcs from the digraph.
///
void clear() {}
template <typename _Digraph>
struct Constraints {
void constraints() {
checkConcept<Base, _Digraph>();
digraph.clear();
}
_Digraph digraph;
};
};
/// \brief An empty clearable base undirected graph class.
///
/// This class provides beside the core undirected graph features
/// core clear functions for the undirected graph structure. The
/// main difference between the base and this interface is that
/// the graph alterations should handled already on this level.
template <typename _Base = BaseGraphComponent>
class ClearableGraphComponent : public ClearableDigraphComponent<_Base> {
public:
typedef _Base Base;
template <typename _Graph>
struct Constraints {
void constraints() {
checkConcept<ClearableGraphComponent<Base>, _Graph>();
}
_Graph graph;
};
};
}
}
#endif