@@ -278,6 +278,11 @@ def _test_shortest_paths_positive_edges(ds, algorithm):
278278 GraphNode ('D' )]
279279
280280 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' )
281286 graph .add_edge ('S' , 'SLC' , 2 )
282287 graph .add_edge ('C' , 'S' , 4 )
283288 graph .add_edge ('C' , 'D' , 2 )
@@ -304,6 +309,11 @@ def _test_shortest_paths_negative_edges(ds, algorithm):
304309 GraphNode ('d' )]
305310
306311 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' )
307317 graph .add_edge ('s' , 'a' , 3 )
308318 graph .add_edge ('s' , 'b' , 2 )
309319 graph .add_edge ('a' , 'c' , 1 )
@@ -333,6 +343,10 @@ def _test_shortest_paths_negative_edges(ds, algorithm):
333343 GraphNode ('3' ), GraphNode ('4' )]
334344
335345 graph = Graph (* vertices )
346+ graph .add_vertex ('1' )
347+ graph .add_vertex ('2' )
348+ graph .add_vertex ('3' )
349+ graph .add_vertex ('4' )
336350 graph .add_edge ('1' , '3' , - 2 )
337351 graph .add_edge ('2' , '1' , 4 )
338352 graph .add_edge ('2' , '3' , 3 )
@@ -362,6 +376,14 @@ def _test_topological_sort(func, ds, algorithm, threads=None):
362376 GraphNode ('11' ), GraphNode ('9' )]
363377
364378 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' )
365387 graph .add_edge ('5' , '11' )
366388 graph .add_edge ('7' , '11' )
367389 graph .add_edge ('7' , '8' )
@@ -395,7 +417,11 @@ def _test_max_flow(ds, algorithm):
395417 e = GraphNode ('e' )
396418
397419 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' )
399425 G .add_edge ('a' , 'b' , 3 )
400426 G .add_edge ('a' , 'c' , 4 )
401427 G .add_edge ('b' , 'c' , 2 )
@@ -414,7 +440,12 @@ def _test_max_flow(ds, algorithm):
414440 f = GraphNode ('f' )
415441
416442 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' )
418449 G2 .add_edge ('a' , 'b' , 16 )
419450 G2 .add_edge ('a' , 'c' , 13 )
420451 G2 .add_edge ('b' , 'c' , 10 )
@@ -435,7 +466,10 @@ def _test_max_flow(ds, algorithm):
435466 d = GraphNode ('d' )
436467
437468 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' )
439473 G3 .add_edge ('a' , 'b' , 3 )
440474 G3 .add_edge ('a' , 'c' , 2 )
441475 G3 .add_edge ('b' , 'c' , 2 )
@@ -468,6 +502,11 @@ def _test_find_bridges(ds):
468502 v4 = GraphNode (4 )
469503
470504 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' )
471510 G1 .add_edge (v0 .name , v1 .name )
472511 G1 .add_edge (v1 .name , v2 .name )
473512 G1 .add_edge (v2 .name , v3 .name )
@@ -482,6 +521,9 @@ def _test_find_bridges(ds):
482521 u2 = GraphNode (2 )
483522
484523 G2 = Graph (u0 , u1 , u2 , implementation = impl )
524+ G2 .add_vertex ('0' )
525+ G2 .add_vertex ('1' )
526+ G2 .add_vertex ('2' )
485527 G2 .add_edge (u0 .name , u1 .name )
486528 G2 .add_edge (u1 .name , u2 .name )
487529 G2 .add_edge (u2 .name , u0 .name )
@@ -496,6 +538,11 @@ def _test_find_bridges(ds):
496538 w4 = GraphNode (4 )
497539
498540 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' )
499546 G3 .add_edge (w0 .name , w1 .name )
500547 G3 .add_edge (w1 .name , w2 .name )
501548 G3 .add_edge (w3 .name , w4 .name )
0 commit comments