def efficiency_targeted():
    targeted_time = []
    for num_nodes in range(10, 1000, 10):
        ugraph = ugraph_UPA(num_nodes, M)

        time1 = time()
        targeted_order(ugraph)
        time2 = time()
        targeted_time.append(time2 - time1)

    return targeted_time
def efficiency_targeted():
    targeted_time = []
    for num_nodes in range(10, 1000, 10):
        ugraph = ugraph_UPA(num_nodes, M)
        
        time1 = time()
        targeted_order(ugraph)
        time2 = time()
        targeted_time.append(time2 - time1)
                
    return targeted_time
def attack_ordered(ugraphs):
    '''
    attack the ugraph with the ordered nodes
    '''
    result = []
    for ugraph in ugraphs:
        nodes_ordered = targeted_order(ugraph)
        resilience = compute_resilience(ugraph, nodes_ordered)
        result.append(resilience)
    data_file = open('data_resilience_ordered.p', 'wb')
    pickle.dump(result, data_file)
    data_file.close()
    return 'data_resilience_ordered.p'
def attack_ordered(ugraphs):
    '''
    attack the ugraph with the ordered nodes
    '''
    result = []
    for ugraph in ugraphs:
        nodes_ordered = targeted_order(ugraph)
        resilience = compute_resilience(ugraph, nodes_ordered)
        result.append(resilience)
    data_file = open('data_resilience_ordered.p', 'wb')
    pickle.dump(result, data_file)
    data_file.close()
    return 'data_resilience_ordered.p'