@@ -181,7 +181,7 @@ def topological_sort(self):
181181 def strongly_connected_components (self ):
182182 """
183183 Compute the vertices in the strongly connected components
184- :return list of lists, one for each components vertices:
184+ :return list of lists, one for each component's vertices:
185185 """
186186 stack = self .scc_dfs_forward_pass ()
187187 components = self .scc_dfs_reverse_pass (stack )
@@ -310,14 +310,14 @@ def test_dfs():
310310def test_bfs ():
311311 dg1 = get_test_graph_1 ()
312312 p1 = dg1 .bfs ()
313- assert (p1 == {1 : 0 , 2 : 1 , 4 : 2 , 5 : 0 , 6 : 2 , 8 : 5 })
313+ assert (p1 == {1 : 0 , 2 : 1 , 4 : 2 , 5 : 0 , 6 : 2 , 8 : 5 })
314314
315315
316316def test_contains_cycle ():
317- assert (get_test_graph_1 ().contains_cycle () == False )
318- assert (get_test_graph_2 ().contains_cycle () == False )
319- assert (get_test_graph_3 ().contains_cycle () == False )
320- assert (get_test_graph_4 ().contains_cycle () == True )
317+ assert (get_test_graph_1 ().contains_cycle () == False )
318+ assert (get_test_graph_2 ().contains_cycle () == False )
319+ assert (get_test_graph_3 ().contains_cycle () == False )
320+ assert (get_test_graph_4 ().contains_cycle () == True )
321321
322322
323323def test_topological_sort ():
@@ -329,10 +329,10 @@ def test_topological_sort():
329329def test_strongly_connected_components ():
330330 dg = get_test_graph_5 ()
331331
332- assert (dg .contains_cycle ())
332+ assert (dg .contains_cycle ())
333333
334334 components = dg .strongly_connected_components ()
335- assert (components == [[10 , 11 , 9 , 8 ], [7 ], [0 ], [1 , 3 , 2 ], [6 , 4 , 5 ]])
335+ assert (components == [[10 , 11 , 9 , 8 ], [7 ], [0 ], [1 , 3 , 2 ], [6 , 4 , 5 ]])
336336
337337
338338def main ():
@@ -344,5 +344,6 @@ def main():
344344
345345 print ("Tests complete." )
346346
347+
347348if __name__ == "__main__" :
348349 main ()
0 commit comments