def test_is_eulerian_no_eulerian(): edges = create_multi_graph(4, [[0, 1], [1, 2], [2, 0], [1, 3]]) assert is_eulerian(edges) is False
from multi_graph import is_eulerian, eulerian_circuit vertices = ["00", "01", "11", "10"] edges = [[0, 1], [3, 2], [2, 3], [0, 1]] print("Le graphe est eulérien :", is_eulerian(edges)) circuit = eulerian_circuit(edges) print("Un circuit eulérien associé est :", circuit) suite = "" for mot in circuit: suite += vertices[mot][1] print("Une suite de brujin : ", suite)
def test_is_eulerian_loop(): assert is_eulerian(create_multi_graph(1, [[0, 0]]))
def test_is_eulerian_cycle(): assert is_eulerian(create_multi_graph(3, [[0, 1], [2, 0], [1, 2]]))
def test_is_eulerian_empty(): assert is_eulerian([])
def test_is_eulerian_one_edge(): assert is_eulerian(create_multi_graph(2, [[0, 1]])) is False
from multi_graph import is_eulerian, eulerian_circuit multi_graph = { "00": ["00", "01"], "01": ["10", "11"], "11": ["11", "10"], "10": ["00", "01"], } print("Le graphe est eulérien :", is_eulerian(multi_graph)) circuit = eulerian_circuit(multi_graph) print("Un circuit eulérien associé est :", circuit) suite = "" for mot in circuit: suite += mot[1] print("Une suite de brujin : ", suite)
def test_is_eulerian_no_eulerian(): assert is_eulerian(create_multi_graph([[1, 2], [2, 3], [3, 1], [2, 4] ])) is False
def test_is_eulerian_cycle(): assert is_eulerian(create_multi_graph([[1, 2], [3, 1], [2, 3]]))
def test_is_eulerian_loop(): assert is_eulerian(create_multi_graph([[1, 1]]))
def test_is_eulerian_empty(): assert is_eulerian(dict())