Exemplo n.º 1
0
def test_depth():
    g = SimpleGraph()
    g.add_edge('a', 'b')
    g.add_edge('a', 'c')
    g.add_edge('b', 'd')
    g.add_edge('b', 'e')
    g.add_edge('e', 'f')
    g.add_edge('f', 'g')
    assert g.depth_first_traversal('a') == ['a', 'c', 'b', 'e', 'f', 'g', 'd']
Exemplo n.º 2
0
def test_depth():
    g = SimpleGraph()
    g.add_edge('a', 'b')
    g.add_edge('a', 'c')
    g.add_edge('b', 'd')
    g.add_edge('b', 'e')
    g.add_edge('e', 'f')
    g.add_edge('f', 'g')
    assert g.depth_first_traversal('a') == ['a', 'c', 'b', 'e', 'f', 'g', 'd']
Exemplo n.º 3
0
def test_one_loop_depth():
    g = SimpleGraph()
    g.add_edge('a', 'a')
    assert g.depth_first_traversal('a') == ['a']
Exemplo n.º 4
0
def test_one_depth():
    g = SimpleGraph()
    g.add_node('a')
    assert g.depth_first_traversal('a') == ['a']
Exemplo n.º 5
0
def test_one_loop_depth():
    g = SimpleGraph()
    g.add_edge('a', 'a')
    assert g.depth_first_traversal('a') == ['a']
Exemplo n.º 6
0
def test_one_depth():
    g = SimpleGraph()
    g.add_node('a')
    assert g.depth_first_traversal('a') == ['a']