def test_find_eulerian_cycle_directed(self): is_oriented = True num_vertices = 5 edges_list = [(0, 1, 1), (1, 2, 2), (2, 3, 3), (3, 4, 4), (4, 0, 5)] g = (num_vertices, edges_list, is_oriented) self.assertEqual(True, sa.is_eulerian_cycle(*g, sa.find_eulerian_cycle(*g)))
def test_find_eulerian_bug_fixed(self): is_oriented = False edges_list =\ [(0, 29, 355.427), (1, 6, 864.748), (1, 29, 296.667), (2, 17, 710.343), (2, 21, 661.4780000000001), (2, 5, 542.428), (2, 19, 933.705), (3, 9, 9.612), (3, 26, 1011.4849999999999), (3, 18, 1173.4869999999999), (4, 18, 20.198), (4, 17, 243.967), (4, 23, 611.3299999999998), (5, 11, 869.11), (6, 26, 3.155), (7, 14, 25.393), (7, 9, 211.382), (7, 10, 110.475), (8, 10, 216.413), (9, 10, 168.06900000000002), (11, 12, 281), (13, 14, 176), (15, 18, 247), (16, 17, 271.433), (19, 20, 314.212), (21, 24, 1493.3), (22, 24, 261.903), (23, 25, 294.418), (23, 26, 954.615), (24, 25, 60.786), (25, 27, 215.65300000000002), (28, 29, 275.92), (0, 29, 355.427), (29, 1, 296.667), (1, 6, 864.748), (6, 26, 3.155), (26, 3, 1011.4849999999999), (4, 18, 20.198), (18, 3, 1173.4869999999999), (3, 9, 9.612), (9, 7, 211.382), (8, 10, 216.413), (10, 9, 168.06900000000002), (10, 9, 168), (9, 3, 9.612), (3, 18, 1173), (18, 4, 20.198), (4, 17, 243.967), (17, 2, 710.343), (2, 5, 542.428), (5, 11, 869), (11, 12, 281), (13, 14, 176), (14, 7, 25.393), (7, 9, 211.382), (9, 3, 9.612), (3, 18, 1173), (18, 15, 247), (16, 17, 271.433), (18, 4, 20.198), (4, 17, 243.967), (17, 2, 710.343), (2, 19, 933), (19, 20, 314.212), (22, 24, 261.903), (24, 25, 60), (25, 23, 294), (24, 25, 60.786), (26, 23, 954.615), (23, 25, 294.418), (25, 27, 215), (28, 29, 275.92)] num_vertices = 30 g = (num_vertices, edges_list, is_oriented) self.assertEqual(True, sa.is_eulerian_cycle(*g, sa.find_eulerian_cycle(*g)))
def test_find_eulerian_cycle_one_edge(self): g = (2, [(1, 1, 0)], False) self.assertEqual(True, sa.is_eulerian_cycle(*g, sa.find_eulerian_cycle(*g)))
def test_find_eulerian_cycle_non_oriented_empty(self): g = (4, [], False) self.assertEqual(True, sa.is_eulerian_cycle(*g, sa.find_eulerian_cycle(*g)))
def test_find_eulerian_cycle_non_oriented_long(self): g = (4, [(2, 0, 0), (2, 1, 0), (3, 1, 0), (1, 2, 0), (0, 2, 0), (2, 3, 0), (3, 0, 0), (3, 2, 0), (0, 1, 0), (0, 0, 0)], False) self.assertEqual(True, sa.is_eulerian_cycle(*g, sa.find_eulerian_cycle(*g)))