Ejemplo n.º 1
0
def test_recente():
    station1 = Node("Westminster")
    station2 = Node("Waterloo", None, [station1])   
    station3 = Node("Trafalgar Square", None, [station1, station2])
    station4 = Node("Canary Wharf",  None, [station2, station3])

    assert depth_first_search(station3, station4) == False
Ejemplo n.º 2
0
def test_strongly_connected_graph():
    station1 = Node("Westminster")
    station2 = Node("Waterloo", None, [station1])
    station3 = Node("Trafalgar Square", None, [station1, station2])
    station4 = Node("Canary Wharf",  None, [station2, station3])
    station5 = Node("London Bridge",  None, [station4, station3])
    station6 = Node("Tottenham Court Road",  None, [station5, station4])

    assert depth_first_search(station6, station1) == True
Ejemplo n.º 3
0
def test_graph_with_cycles():
    assert depth_first_search(nodea, nodef) == True
Ejemplo n.º 4
0
def test_one_node_graph():
    assert depth_first_search(nodef, nodef) == True
Ejemplo n.º 5
0
def test_two_unconnected_nodes_in_graph():
    assert depth_first_search(nodef, nodee) == False
Ejemplo n.º 6
0
def test_branching_graph():
    assert depth_first_search(nodea, nodee) == True