Location: LEMON/LEMON-main/test/graph_test.cc - annotation

Load file history
gravatar
alpar (Alpar Juttner)
Unify the sources (#339)
  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
 r209:765619b7cbb2
  r57:c1acf0018c0a
 r209:765619b7cbb2
  r57:c1acf0018c0a
 r877:141f9c0db4a3
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
 r109:abddaa08b507
 r353:37557a46e298
 r334:ada5f74d1c9e
 r365:a12eef1f82b2
  r57:c1acf0018c0a
  r57:c1acf0018c0a
 r171:02f4d5d9bfd7
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r736:2e20aad15754
 r736:2e20aad15754
 r736:2e20aad15754
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r228:b6732e0d38c5
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r740:819ca5b50de0
 r740:819ca5b50de0
 r740:819ca5b50de0
 r740:819ca5b50de0
 r740:819ca5b50de0
 r877:141f9c0db4a3
 r740:819ca5b50de0
 r740:819ca5b50de0
 r740:819ca5b50de0
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r365:a12eef1f82b2
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r228:b6732e0d38c5
 r171:02f4d5d9bfd7
  r57:c1acf0018c0a
  r57:c1acf0018c0a
 r209:765619b7cbb2
  r57:c1acf0018c0a
  r57:c1acf0018c0a
 r209:765619b7cbb2
  r57:c1acf0018c0a
  r57:c1acf0018c0a
 r209:765619b7cbb2
  r57:c1acf0018c0a
  r57:c1acf0018c0a
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
  r57:c1acf0018c0a
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r334:ada5f74d1c9e
 r334:ada5f74d1c9e
 r334:ada5f74d1c9e
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
 r228:b6732e0d38c5
 r149:2f7ae34e1333
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
  r57:c1acf0018c0a
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
  r57:c1acf0018c0a
  r57:c1acf0018c0a
 r149:2f7ae34e1333
 r228:b6732e0d38c5
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r149:2f7ae34e1333
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r149:2f7ae34e1333
 r149:2f7ae34e1333
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
  r57:c1acf0018c0a
 r336:052cecabcb71
 r336:052cecabcb71
 r209:765619b7cbb2
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r334:ada5f74d1c9e
  r57:c1acf0018c0a
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
  r57:c1acf0018c0a
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
  r57:c1acf0018c0a
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r228:b6732e0d38c5
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r334:ada5f74d1c9e
 r228:b6732e0d38c5
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r737:9d6c3e8b2421
 r877:141f9c0db4a3
 r365:a12eef1f82b2
 r372:7b6466ed488a
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r372:7b6466ed488a
 r365:a12eef1f82b2
 r372:7b6466ed488a
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r372:7b6466ed488a
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r372:7b6466ed488a
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r372:7b6466ed488a
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
  r57:c1acf0018c0a
 r228:b6732e0d38c5
 r171:02f4d5d9bfd7
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
 r374:49d9a36b3b84
 r374:49d9a36b3b84
 r228:b6732e0d38c5
 r171:02f4d5d9bfd7
 r365:a12eef1f82b2
 r353:37557a46e298
 r353:37557a46e298
 r353:37557a46e298
 r334:ada5f74d1c9e
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r335:160bf92c7cdc
 r334:ada5f74d1c9e
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r365:a12eef1f82b2
 r171:02f4d5d9bfd7
 r171:02f4d5d9bfd7
  r57:c1acf0018c0a
 r228:b6732e0d38c5
 r228:b6732e0d38c5
  r57:c1acf0018c0a
  r57:c1acf0018c0a
/* -*- mode: C++; indent-tabs-mode: nil; -*-
 *
 * This file is a part of LEMON, a generic C++ optimization library.
 *
 * Copyright (C) 2003-2010
 * 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.
 *
 */

#include <lemon/concepts/graph.h>
#include <lemon/list_graph.h>
#include <lemon/smart_graph.h>
#include <lemon/full_graph.h>
#include <lemon/grid_graph.h>
#include <lemon/hypercube_graph.h>

#include "test_tools.h"
#include "graph_test.h"

using namespace lemon;
using namespace lemon::concepts;

template <class Graph>
void checkGraphBuild() {
  TEMPLATE_GRAPH_TYPEDEFS(Graph);

  Graph G;
  checkGraphNodeList(G, 0);
  checkGraphEdgeList(G, 0);
  checkGraphArcList(G, 0);

  G.reserveNode(3);
  G.reserveEdge(3);

  Node
    n1 = G.addNode(),
    n2 = G.addNode(),
    n3 = G.addNode();
  checkGraphNodeList(G, 3);
  checkGraphEdgeList(G, 0);
  checkGraphArcList(G, 0);

  Edge e1 = G.addEdge(n1, n2);
  check((G.u(e1) == n1 && G.v(e1) == n2) || (G.u(e1) == n2 && G.v(e1) == n1),
        "Wrong edge");

  checkGraphNodeList(G, 3);
  checkGraphEdgeList(G, 1);
  checkGraphArcList(G, 2);

  checkGraphIncEdgeArcLists(G, n1, 1);
  checkGraphIncEdgeArcLists(G, n2, 1);
  checkGraphIncEdgeArcLists(G, n3, 0);

  checkGraphConEdgeList(G, 1);
  checkGraphConArcList(G, 2);

  Edge e2 = G.addEdge(n2, n1),
       e3 = G.addEdge(n2, n3);

  checkGraphNodeList(G, 3);
  checkGraphEdgeList(G, 3);
  checkGraphArcList(G, 6);

  checkGraphIncEdgeArcLists(G, n1, 2);
  checkGraphIncEdgeArcLists(G, n2, 3);
  checkGraphIncEdgeArcLists(G, n3, 1);

  checkGraphConEdgeList(G, 3);
  checkGraphConArcList(G, 6);

  checkArcDirections(G);

  checkNodeIds(G);
  checkArcIds(G);
  checkEdgeIds(G);
  checkGraphNodeMap(G);
  checkGraphArcMap(G);
  checkGraphEdgeMap(G);
}

template <class Graph>
void checkGraphAlter() {
  TEMPLATE_GRAPH_TYPEDEFS(Graph);

  Graph G;
  Node n1 = G.addNode(), n2 = G.addNode(),
       n3 = G.addNode(), n4 = G.addNode();
  Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
       e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
       e5 = G.addEdge(n4, n3);

  checkGraphNodeList(G, 4);
  checkGraphEdgeList(G, 5);
  checkGraphArcList(G, 10);

  // Check changeU() and changeV()
  if (G.u(e2) == n2) {
    G.changeU(e2, n3);
  } else {
    G.changeV(e2, n3);
  }

  checkGraphNodeList(G, 4);
  checkGraphEdgeList(G, 5);
  checkGraphArcList(G, 10);

  checkGraphIncEdgeArcLists(G, n1, 3);
  checkGraphIncEdgeArcLists(G, n2, 2);
  checkGraphIncEdgeArcLists(G, n3, 3);
  checkGraphIncEdgeArcLists(G, n4, 2);

  checkGraphConEdgeList(G, 5);
  checkGraphConArcList(G, 10);

  if (G.u(e2) == n1) {
    G.changeU(e2, n2);
  } else {
    G.changeV(e2, n2);
  }

  checkGraphNodeList(G, 4);
  checkGraphEdgeList(G, 5);
  checkGraphArcList(G, 10);

  checkGraphIncEdgeArcLists(G, n1, 2);
  checkGraphIncEdgeArcLists(G, n2, 3);
  checkGraphIncEdgeArcLists(G, n3, 3);
  checkGraphIncEdgeArcLists(G, n4, 2);

  checkGraphConEdgeList(G, 5);
  checkGraphConArcList(G, 10);

  // Check contract()
  G.contract(n1, n4, false);

  checkGraphNodeList(G, 3);
  checkGraphEdgeList(G, 5);
  checkGraphArcList(G, 10);

  checkGraphIncEdgeArcLists(G, n1, 4);
  checkGraphIncEdgeArcLists(G, n2, 3);
  checkGraphIncEdgeArcLists(G, n3, 3);

  checkGraphConEdgeList(G, 5);
  checkGraphConArcList(G, 10);

  G.contract(n2, n3);

  checkGraphNodeList(G, 2);
  checkGraphEdgeList(G, 3);
  checkGraphArcList(G, 6);

  checkGraphIncEdgeArcLists(G, n1, 4);
  checkGraphIncEdgeArcLists(G, n2, 2);

  checkGraphConEdgeList(G, 3);
  checkGraphConArcList(G, 6);
}

template <class Graph>
void checkGraphErase() {
  TEMPLATE_GRAPH_TYPEDEFS(Graph);

  Graph G;
  Node n1 = G.addNode(), n2 = G.addNode(),
       n3 = G.addNode(), n4 = G.addNode();
  Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
       e3 = G.addEdge(n2, n3), e4 = G.addEdge(n1, n4),
       e5 = G.addEdge(n4, n3);

  // Check edge deletion
  G.erase(e2);

  checkGraphNodeList(G, 4);
  checkGraphEdgeList(G, 4);
  checkGraphArcList(G, 8);

  checkGraphIncEdgeArcLists(G, n1, 2);
  checkGraphIncEdgeArcLists(G, n2, 2);
  checkGraphIncEdgeArcLists(G, n3, 2);
  checkGraphIncEdgeArcLists(G, n4, 2);

  checkGraphConEdgeList(G, 4);
  checkGraphConArcList(G, 8);

  // Check node deletion
  G.erase(n3);

  checkGraphNodeList(G, 3);
  checkGraphEdgeList(G, 2);
  checkGraphArcList(G, 4);

  checkGraphIncEdgeArcLists(G, n1, 2);
  checkGraphIncEdgeArcLists(G, n2, 1);
  checkGraphIncEdgeArcLists(G, n4, 1);

  checkGraphConEdgeList(G, 2);
  checkGraphConArcList(G, 4);
}


template <class Graph>
void checkGraphSnapshot() {
  TEMPLATE_GRAPH_TYPEDEFS(Graph);

  Graph G;
  Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
  Edge e1 = G.addEdge(n1, n2), e2 = G.addEdge(n2, n1),
       e3 = G.addEdge(n2, n3);

  checkGraphNodeList(G, 3);
  checkGraphEdgeList(G, 3);
  checkGraphArcList(G, 6);

  typename Graph::Snapshot snapshot(G);

  Node n = G.addNode();
  G.addEdge(n3, n);
  G.addEdge(n, n3);
  G.addEdge(n3, n2);

  checkGraphNodeList(G, 4);
  checkGraphEdgeList(G, 6);
  checkGraphArcList(G, 12);

  snapshot.restore();

  checkGraphNodeList(G, 3);
  checkGraphEdgeList(G, 3);
  checkGraphArcList(G, 6);

  checkGraphIncEdgeArcLists(G, n1, 2);
  checkGraphIncEdgeArcLists(G, n2, 3);
  checkGraphIncEdgeArcLists(G, n3, 1);

  checkGraphConEdgeList(G, 3);
  checkGraphConArcList(G, 6);

  checkNodeIds(G);
  checkEdgeIds(G);
  checkArcIds(G);
  checkGraphNodeMap(G);
  checkGraphEdgeMap(G);
  checkGraphArcMap(G);

  G.addNode();
  snapshot.save(G);

  G.addEdge(G.addNode(), G.addNode());

  snapshot.restore();
  snapshot.save(G);

  checkGraphNodeList(G, 4);
  checkGraphEdgeList(G, 3);
  checkGraphArcList(G, 6);

  G.addEdge(G.addNode(), G.addNode());

  snapshot.restore();

  checkGraphNodeList(G, 4);
  checkGraphEdgeList(G, 3);
  checkGraphArcList(G, 6);
}

void checkFullGraph(int num) {
  typedef FullGraph Graph;
  GRAPH_TYPEDEFS(Graph);

  Graph G(num);
  check(G.nodeNum() == num && G.edgeNum() == num * (num - 1) / 2,
        "Wrong size");

  G.resize(num);
  check(G.nodeNum() == num && G.edgeNum() == num * (num - 1) / 2,
        "Wrong size");

  checkGraphNodeList(G, num);
  checkGraphEdgeList(G, num * (num - 1) / 2);

  for (NodeIt n(G); n != INVALID; ++n) {
    checkGraphOutArcList(G, n, num - 1);
    checkGraphInArcList(G, n, num - 1);
    checkGraphIncEdgeList(G, n, num - 1);
  }

  checkGraphConArcList(G, num * (num - 1));
  checkGraphConEdgeList(G, num * (num - 1) / 2);

  checkArcDirections(G);

  checkNodeIds(G);
  checkArcIds(G);
  checkEdgeIds(G);
  checkGraphNodeMap(G);
  checkGraphArcMap(G);
  checkGraphEdgeMap(G);


  for (int i = 0; i < G.nodeNum(); ++i) {
    check(G.index(G(i)) == i, "Wrong index");
  }

  for (NodeIt u(G); u != INVALID; ++u) {
    for (NodeIt v(G); v != INVALID; ++v) {
      Edge e = G.edge(u, v);
      Arc a = G.arc(u, v);
      if (u == v) {
        check(e == INVALID, "Wrong edge lookup");
        check(a == INVALID, "Wrong arc lookup");
      } else {
        check((G.u(e) == u && G.v(e) == v) ||
              (G.u(e) == v && G.v(e) == u), "Wrong edge lookup");
        check(G.source(a) == u && G.target(a) == v, "Wrong arc lookup");
      }
    }
  }
}

void checkConcepts() {
  { // Checking graph components
    checkConcept<BaseGraphComponent, BaseGraphComponent >();

    checkConcept<IDableGraphComponent<>,
      IDableGraphComponent<> >();

    checkConcept<IterableGraphComponent<>,
      IterableGraphComponent<> >();

    checkConcept<MappableGraphComponent<>,
      MappableGraphComponent<> >();
  }
  { // Checking skeleton graph
    checkConcept<Graph, Graph>();
  }
  { // Checking ListGraph
    checkConcept<Graph, ListGraph>();
    checkConcept<AlterableGraphComponent<>, ListGraph>();
    checkConcept<ExtendableGraphComponent<>, ListGraph>();
    checkConcept<ClearableGraphComponent<>, ListGraph>();
    checkConcept<ErasableGraphComponent<>, ListGraph>();
  }
  { // Checking SmartGraph
    checkConcept<Graph, SmartGraph>();
    checkConcept<AlterableGraphComponent<>, SmartGraph>();
    checkConcept<ExtendableGraphComponent<>, SmartGraph>();
    checkConcept<ClearableGraphComponent<>, SmartGraph>();
  }
  { // Checking FullGraph
    checkConcept<Graph, FullGraph>();
  }
  { // Checking GridGraph
    checkConcept<Graph, GridGraph>();
  }
  { // Checking HypercubeGraph
    checkConcept<Graph, HypercubeGraph>();
  }
}

template <typename Graph>
void checkGraphValidity() {
  TEMPLATE_GRAPH_TYPEDEFS(Graph);
  Graph g;

  Node
    n1 = g.addNode(),
    n2 = g.addNode(),
    n3 = g.addNode();

  Edge
    e1 = g.addEdge(n1, n2),
    e2 = g.addEdge(n2, n3);

  check(g.valid(n1), "Wrong validity check");
  check(g.valid(e1), "Wrong validity check");
  check(g.valid(g.direct(e1, true)), "Wrong validity check");

  check(!g.valid(g.nodeFromId(-1)), "Wrong validity check");
  check(!g.valid(g.edgeFromId(-1)), "Wrong validity check");
  check(!g.valid(g.arcFromId(-1)), "Wrong validity check");
}

template <typename Graph>
void checkGraphValidityErase() {
  TEMPLATE_GRAPH_TYPEDEFS(Graph);
  Graph g;

  Node
    n1 = g.addNode(),
    n2 = g.addNode(),
    n3 = g.addNode();

  Edge
    e1 = g.addEdge(n1, n2),
    e2 = g.addEdge(n2, n3);

  check(g.valid(n1), "Wrong validity check");
  check(g.valid(e1), "Wrong validity check");
  check(g.valid(g.direct(e1, true)), "Wrong validity check");

  g.erase(n1);

  check(!g.valid(n1), "Wrong validity check");
  check(g.valid(n2), "Wrong validity check");
  check(g.valid(n3), "Wrong validity check");
  check(!g.valid(e1), "Wrong validity check");
  check(g.valid(e2), "Wrong validity check");

  check(!g.valid(g.nodeFromId(-1)), "Wrong validity check");
  check(!g.valid(g.edgeFromId(-1)), "Wrong validity check");
  check(!g.valid(g.arcFromId(-1)), "Wrong validity check");
}

void checkGridGraph(int width, int height) {
  typedef GridGraph Graph;
  GRAPH_TYPEDEFS(Graph);
  Graph G(width, height);

  check(G.width() == width, "Wrong column number");
  check(G.height() == height, "Wrong row number");

  G.resize(width, height);
  check(G.width() == width, "Wrong column number");
  check(G.height() == height, "Wrong row number");

  for (int i = 0; i < width; ++i) {
    for (int j = 0; j < height; ++j) {
      check(G.col(G(i, j)) == i, "Wrong column");
      check(G.row(G(i, j)) == j, "Wrong row");
      check(G.pos(G(i, j)).x == i, "Wrong column");
      check(G.pos(G(i, j)).y == j, "Wrong row");
    }
  }

  for (int j = 0; j < height; ++j) {
    for (int i = 0; i < width - 1; ++i) {
      check(G.source(G.right(G(i, j))) == G(i, j), "Wrong right");
      check(G.target(G.right(G(i, j))) == G(i + 1, j), "Wrong right");
    }
    check(G.right(G(width - 1, j)) == INVALID, "Wrong right");
  }

  for (int j = 0; j < height; ++j) {
    for (int i = 1; i < width; ++i) {
      check(G.source(G.left(G(i, j))) == G(i, j), "Wrong left");
      check(G.target(G.left(G(i, j))) == G(i - 1, j), "Wrong left");
    }
    check(G.left(G(0, j)) == INVALID, "Wrong left");
  }

  for (int i = 0; i < width; ++i) {
    for (int j = 0; j < height - 1; ++j) {
      check(G.source(G.up(G(i, j))) == G(i, j), "Wrong up");
      check(G.target(G.up(G(i, j))) == G(i, j + 1), "Wrong up");
    }
    check(G.up(G(i, height - 1)) == INVALID, "Wrong up");
  }

  for (int i = 0; i < width; ++i) {
    for (int j = 1; j < height; ++j) {
      check(G.source(G.down(G(i, j))) == G(i, j), "Wrong down");
      check(G.target(G.down(G(i, j))) == G(i, j - 1), "Wrong down");
    }
    check(G.down(G(i, 0)) == INVALID, "Wrong down");
  }

  checkGraphNodeList(G, width * height);
  checkGraphEdgeList(G, width * (height - 1) + (width - 1) * height);
  checkGraphArcList(G, 2 * (width * (height - 1) + (width - 1) * height));

  for (NodeIt n(G); n != INVALID; ++n) {
    int nb = 4;
    if (G.col(n) == 0) --nb;
    if (G.col(n) == width - 1) --nb;
    if (G.row(n) == 0) --nb;
    if (G.row(n) == height - 1) --nb;

    checkGraphOutArcList(G, n, nb);
    checkGraphInArcList(G, n, nb);
    checkGraphIncEdgeList(G, n, nb);
  }

  checkArcDirections(G);

  checkGraphConArcList(G, 2 * (width * (height - 1) + (width - 1) * height));
  checkGraphConEdgeList(G, width * (height - 1) + (width - 1) * height);

  checkNodeIds(G);
  checkArcIds(G);
  checkEdgeIds(G);
  checkGraphNodeMap(G);
  checkGraphArcMap(G);
  checkGraphEdgeMap(G);

}

void checkHypercubeGraph(int dim) {
  GRAPH_TYPEDEFS(HypercubeGraph);

  HypercubeGraph G(dim);
  check(G.dimension() == dim, "Wrong dimension");

  G.resize(dim);
  check(G.dimension() == dim, "Wrong dimension");

  checkGraphNodeList(G, 1 << dim);
  checkGraphEdgeList(G, dim * (1 << (dim-1)));
  checkGraphArcList(G, dim * (1 << dim));

  Node n = G.nodeFromId(dim);

  for (NodeIt n(G); n != INVALID; ++n) {
    checkGraphIncEdgeList(G, n, dim);
    for (IncEdgeIt e(G, n); e != INVALID; ++e) {
      check( (G.u(e) == n &&
              G.id(G.v(e)) == (G.id(n) ^ (1 << G.dimension(e)))) ||
             (G.v(e) == n &&
              G.id(G.u(e)) == (G.id(n) ^ (1 << G.dimension(e)))),
             "Wrong edge or wrong dimension");
    }

    checkGraphOutArcList(G, n, dim);
    for (OutArcIt a(G, n); a != INVALID; ++a) {
      check(G.source(a) == n &&
            G.id(G.target(a)) == (G.id(n) ^ (1 << G.dimension(a))),
            "Wrong arc or wrong dimension");
    }

    checkGraphInArcList(G, n, dim);
    for (InArcIt a(G, n); a != INVALID; ++a) {
      check(G.target(a) == n &&
            G.id(G.source(a)) == (G.id(n) ^ (1 << G.dimension(a))),
            "Wrong arc or wrong dimension");
    }
  }

  checkGraphConArcList(G, (1 << dim) * dim);
  checkGraphConEdgeList(G, dim * (1 << (dim-1)));

  checkArcDirections(G);

  checkNodeIds(G);
  checkArcIds(G);
  checkEdgeIds(G);
  checkGraphNodeMap(G);
  checkGraphArcMap(G);
  checkGraphEdgeMap(G);
}

void checkGraphs() {
  { // Checking ListGraph
    checkGraphBuild<ListGraph>();
    checkGraphAlter<ListGraph>();
    checkGraphErase<ListGraph>();
    checkGraphSnapshot<ListGraph>();
    checkGraphValidityErase<ListGraph>();
  }
  { // Checking SmartGraph
    checkGraphBuild<SmartGraph>();
    checkGraphSnapshot<SmartGraph>();
    checkGraphValidity<SmartGraph>();
  }
  { // Checking FullGraph
    checkFullGraph(7);
    checkFullGraph(8);
  }
  { // Checking GridGraph
    checkGridGraph(5, 8);
    checkGridGraph(8, 5);
    checkGridGraph(5, 5);
    checkGridGraph(0, 0);
    checkGridGraph(1, 1);
  }
  { // Checking HypercubeGraph
    checkHypercubeGraph(1);
    checkHypercubeGraph(2);
    checkHypercubeGraph(3);
    checkHypercubeGraph(4);
  }
}

int main() {
  checkConcepts();
  checkGraphs();
  return 0;
}