def test_should_find_long_nontrivial_cycle_in_graph_when_there_are_two( self): graph_with_long_cycle = Graph({ "a": "b", "b": "c", "c": "a", "d": "e", "e": "f", "f": "d" }) self.assertIsNotNone(graph_with_long_cycle.assert_no_cycles_present())
def test_should_find_simple_nontrivial_cycle_in_graph_when_there_is_one( self): graph_with_simple_cycle = Graph({"a": "b", "b": "a"}) self.assertIsNotNone( graph_with_simple_cycle.assert_no_cycles_present())
def test_should_find_trivial_cycle_in_graph_when_searching_for_cycles( self): graph_with_trivial_cycle = Graph({"a": "a"}) self.assertIsNotNone( graph_with_trivial_cycle.assert_no_cycles_present())
def test_should_not_find_cycles_in_graph_when_there_are_none(self): graph_without_cycle = Graph({"a": "b", "b": "c", "d": "e"}) graph_without_cycle.assert_no_cycles_present()
def test_should_not_find_cycles_in_graph_when_there_are_none(self): graph_without_cycle = Graph({"a": "b", "b": "c", "d": "e"}) graph_without_cycle.assert_no_cycles_present()