Ejemplo n.º 1
0
    random.shuffle(list1)
    return list1

p = 0.5
vertex = 500
    
#print_ER(vertex, p)
#print_Eros(vertex, p)
slowT = []
fastT = []
nodes = []

for n in range(10, 1000, 10):
    upa_gr = printUPA(n, 5)
    start = time.clock()
    upa_attack_slow = LoadGraph.targeted_order(upa_gr)
    end = time.clock()
    #startF = time.clock()
    #upa_attack_fast = LoadGraph.fast_targeted_order(upa_gr)
    #endF = time.clock()
    grafTime = end - start
    #grafTimeF = endF - startF
    
    slowT.append(grafTime)
    #fastT.append(grafTimeF)
    
    nodes.append(n)

for n in range(10, 1000, 10):
    upa_gr = printUPA(n, 5)
    #start = time.clock()
Ejemplo n.º 2
0
def random_order(graph):
    list1 = graph.keys()
    random.shuffle(list1)
    return list1


p = 0.5
vertex = 500

# print_ER(vertex, p)
# print_Eros(vertex, p)
upa_gr = printUPA(1347, 2)
er_gr = print_Eros(1347, 0.0035)
net_gr = LoadGraph.load_graph(LoadGraph.NETWORK_URL)

upa_attack = LoadGraph.targeted_order(upa_gr)
er_attack = LoadGraph.targeted_order(er_gr)
net_attack = LoadGraph.targeted_order(net_gr)
# print "upa_attack = ", upa_attack

upa_res = Resiliance.compute_resilience(upa_gr, upa_attack)
er_res = Resiliance.compute_resilience(er_gr, er_attack)
net_res = Resiliance.compute_resilience(net_gr, net_attack)
# print "upa_res = ", upa_res
# targeted2
upa_attack2 = LoadGraph.fast_targeted_order(upa_gr)
er_attack2 = LoadGraph.fast_targeted_order(er_gr)
net_attack2 = LoadGraph.fast_targeted_order(net_gr)
print "upa_attack2 = ", upa_attack2

upa_res2 = Resiliance.compute_resilience(upa_gr, upa_attack2)