def test_node_ordering_with_cycle(): example_graph = { "a": ["b", "c", "d"], "b": [], "c": ["d"], "d": ["a"], "e": ["f"], "f": ["e"]} sorted_nodes, removed_edges = StoryGraph.topological_sort(example_graph) check_graph_is_sorted(example_graph, sorted_nodes, removed_edges)
def test_node_ordering_with_cycle(): example_graph = { "a": ["b", "c", "d"], "b": [], "c": ["d"], "d": ["a"], "e": ["f"], "f": ["e"] } sorted_nodes, removed_edges = StoryGraph.topological_sort(example_graph) check_graph_is_sorted(example_graph, sorted_nodes, removed_edges)
def test_node_ordering(): example_graph = { "a": ["b", "c", "d"], "b": [], "c": ["d"], "d": [], "e": ["f"], "f": []} sorted_nodes, removed_edges = StoryGraph.topological_sort(example_graph) assert removed_edges == set() check_graph_is_sorted(example_graph, sorted_nodes, removed_edges)
def test_node_ordering(): example_graph = { "a": ["b", "c", "d"], "b": [], "c": ["d"], "d": [], "e": ["f"], "f": [] } sorted_nodes, removed_edges = StoryGraph.topological_sort(example_graph) assert removed_edges == set() check_graph_is_sorted(example_graph, sorted_nodes, removed_edges)