@@ -278,6 +278,11 @@ def _test_shortest_paths_positive_edges(ds, algorithm):
278
278
GraphNode ('D' )]
279
279
280
280
graph = Graph (* vertices )
281
+ graph .add_vertex ('S' )
282
+ graph .add_vertex ('C' )
283
+ graph .add_vertex ('SLC' )
284
+ graph .add_vertex ('SF' )
285
+ graph .add_vertex ('D' )
281
286
graph .add_edge ('S' , 'SLC' , 2 )
282
287
graph .add_edge ('C' , 'S' , 4 )
283
288
graph .add_edge ('C' , 'D' , 2 )
@@ -304,6 +309,11 @@ def _test_shortest_paths_negative_edges(ds, algorithm):
304
309
GraphNode ('d' )]
305
310
306
311
graph = Graph (* vertices )
312
+ graph .add_vertex ('s' )
313
+ graph .add_vertex ('a' )
314
+ graph .add_vertex ('b' )
315
+ graph .add_vertex ('c' )
316
+ graph .add_vertex ('d' )
307
317
graph .add_edge ('s' , 'a' , 3 )
308
318
graph .add_edge ('s' , 'b' , 2 )
309
319
graph .add_edge ('a' , 'c' , 1 )
@@ -333,6 +343,10 @@ def _test_shortest_paths_negative_edges(ds, algorithm):
333
343
GraphNode ('3' ), GraphNode ('4' )]
334
344
335
345
graph = Graph (* vertices )
346
+ graph .add_vertex ('1' )
347
+ graph .add_vertex ('2' )
348
+ graph .add_vertex ('3' )
349
+ graph .add_vertex ('4' )
336
350
graph .add_edge ('1' , '3' , - 2 )
337
351
graph .add_edge ('2' , '1' , 4 )
338
352
graph .add_edge ('2' , '3' , 3 )
@@ -362,6 +376,14 @@ def _test_topological_sort(func, ds, algorithm, threads=None):
362
376
GraphNode ('11' ), GraphNode ('9' )]
363
377
364
378
graph = Graph (* vertices )
379
+ graph .add_vertex ('2' )
380
+ graph .add_vertex ('3' )
381
+ graph .add_vertex ('5' )
382
+ graph .add_vertex ('7' )
383
+ graph .add_vertex ('8' )
384
+ graph .add_vertex ('10' )
385
+ graph .add_vertex ('11' )
386
+ graph .add_vertex ('9' )
365
387
graph .add_edge ('5' , '11' )
366
388
graph .add_edge ('7' , '11' )
367
389
graph .add_edge ('7' , '8' )
@@ -395,7 +417,11 @@ def _test_max_flow(ds, algorithm):
395
417
e = GraphNode ('e' )
396
418
397
419
G = Graph (a , b , c , d , e )
398
-
420
+ G .add_vertex ('a' )
421
+ G .add_vertex ('b' )
422
+ G .add_vertex ('c' )
423
+ G .add_vertex ('d' )
424
+ G .add_vertex ('e' )
399
425
G .add_edge ('a' , 'b' , 3 )
400
426
G .add_edge ('a' , 'c' , 4 )
401
427
G .add_edge ('b' , 'c' , 2 )
@@ -414,7 +440,12 @@ def _test_max_flow(ds, algorithm):
414
440
f = GraphNode ('f' )
415
441
416
442
G2 = Graph (a , b , c , d , e , f )
417
-
443
+ G2 .add_vertex ('a' )
444
+ G2 .add_vertex ('b' )
445
+ G2 .add_vertex ('c' )
446
+ G2 .add_vertex ('d' )
447
+ G2 .add_vertex ('e' )
448
+ G2 .add_vertex ('f' )
418
449
G2 .add_edge ('a' , 'b' , 16 )
419
450
G2 .add_edge ('a' , 'c' , 13 )
420
451
G2 .add_edge ('b' , 'c' , 10 )
@@ -435,7 +466,10 @@ def _test_max_flow(ds, algorithm):
435
466
d = GraphNode ('d' )
436
467
437
468
G3 = Graph (a , b , c , d )
438
-
469
+ G3 .add_vertex ('a' )
470
+ G3 .add_vertex ('b' )
471
+ G3 .add_vertex ('c' )
472
+ G3 .add_vertex ('d' )
439
473
G3 .add_edge ('a' , 'b' , 3 )
440
474
G3 .add_edge ('a' , 'c' , 2 )
441
475
G3 .add_edge ('b' , 'c' , 2 )
@@ -468,6 +502,11 @@ def _test_find_bridges(ds):
468
502
v4 = GraphNode (4 )
469
503
470
504
G1 = Graph (v0 , v1 , v2 , v3 , v4 , implementation = impl )
505
+ G1 .add_vertex ('0' )
506
+ G1 .add_vertex ('1' )
507
+ G1 .add_vertex ('2' )
508
+ G1 .add_vertex ('3' )
509
+ G1 .add_vertex ('4' )
471
510
G1 .add_edge (v0 .name , v1 .name )
472
511
G1 .add_edge (v1 .name , v2 .name )
473
512
G1 .add_edge (v2 .name , v3 .name )
@@ -482,6 +521,9 @@ def _test_find_bridges(ds):
482
521
u2 = GraphNode (2 )
483
522
484
523
G2 = Graph (u0 , u1 , u2 , implementation = impl )
524
+ G2 .add_vertex ('0' )
525
+ G2 .add_vertex ('1' )
526
+ G2 .add_vertex ('2' )
485
527
G2 .add_edge (u0 .name , u1 .name )
486
528
G2 .add_edge (u1 .name , u2 .name )
487
529
G2 .add_edge (u2 .name , u0 .name )
@@ -496,6 +538,11 @@ def _test_find_bridges(ds):
496
538
w4 = GraphNode (4 )
497
539
498
540
G3 = Graph (w0 , w1 , w2 , w3 , w4 , implementation = impl )
541
+ G3 .add_vertex ('0' )
542
+ G3 .add_vertex ('1' )
543
+ G3 .add_vertex ('2' )
544
+ G3 .add_vertex ('3' )
545
+ G3 .add_vertex ('4' )
499
546
G3 .add_edge (w0 .name , w1 .name )
500
547
G3 .add_edge (w1 .name , w2 .name )
501
548
G3 .add_edge (w3 .name , w4 .name )
0 commit comments