Esempio n. 1
0
def test_shortest_delay_txt_topology_simple(graph_topology_simple):
    result_path, result_delays = shortest_path(graph_topology_simple, 'A', 'D')
    assert result_path == ['A', 'C', 'D']
    assert result_delays == 23
    result_path, result_delays = shortest_path(graph_topology_simple, 'B', 'C')
    assert result_path == ['B', 'C']
    assert result_delays == 20
    result_path, result_delays = shortest_path(graph_topology_simple, 'B', 'D')
    assert result_path == ['B', 'C', 'D']
    assert result_delays == 28
Esempio n. 2
0
def test_shortest_hop_txt_topology(graph_topology):
    result_path, result_hops = shortest_path(
        graph_topology, 'D', 'N', path_type='SHP')
    assert result_path == ['D', 'F', 'O', 'N']
    assert result_hops == 3
    result_path, result_hops = shortest_path(
        graph_topology, 'I', 'H', path_type='SHP')
    assert result_path == ['I', 'B', 'A', 'H']
    assert result_hops == 3
    result_path, result_delays = shortest_path(
        graph_topology, 'A', 'O', path_type='SHP')
    assert result_path == ['A', 'H', 'G', 'O'
                           ] or result_path == ['A', 'H', 'F', 'O']
    assert result_hops == 3
Esempio n. 3
0
def test_shortest_delay_txt_topology(graph_topology):
    result_path, result_delays = shortest_path(
        graph_topology, 'D', 'N', path_type='SDP')
    assert result_path == ['D', 'F', 'P', 'O', 'N']
    assert result_delays == 180
    result_path, result_delays = shortest_path(
        graph_topology, 'I', 'H', path_type='SDP')
    assert result_path == ['I', 'J', 'K', 'N', 'O', 'G', 'H']
    assert result_delays == 245
    result_path, result_delays = shortest_path(
        graph_topology, 'A', 'O', path_type='SDP')
    assert result_path == ['A', 'B', 'I', 'J', 'K', 'N', 'O']
    assert result_delays == 235
    result_path, result_delays = shortest_path(
        graph_topology, 'I', 'C', path_type='SDP')
    assert result_path == ['I', 'B', 'C']
    assert result_delays == 180
Esempio n. 4
0
def test_shortest_delay_path(graph):
    result_path, result_delays = shortest_path(graph, 'a', 'i')
    assert result_path == ['a', 'c', 'd', 'g', 'i']
    assert result_delays == 8
Esempio n. 5
0
def test_shortest_hop_txt_topology_simple(graph_topology_simple):
    result_path, result_hops = shortest_path(
        graph_topology_simple, 'A', 'D', path_type='SHP')
    assert result_path == ['A', 'B', 'D'] or result_path == ['A', 'C', 'D']
    assert result_hops == 2
Esempio n. 6
0
def test_shortest_hop_path(graph):
    result_path, result_hops = shortest_path(graph, 'a', 'i', path_type='SHP')
    assert result_path == ['a', 'e', 'i']
    assert result_hops == 2