-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_ccdf_plot.py
43 lines (40 loc) · 1.86 KB
/
test_ccdf_plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 30 13:56:11 2019
@author: dingluo
"""
def gen_results_accessiblity_ccdf(graph_dict,city_list,city_names):
marker_list = ['s','o','v','p','*','<','+','p','d']
color_list = ['tab:purple','tab:blue','tab:green','r','c','m','tab:orange','k']
#---- hop-based accessibility
f1 = plt.figure()
for x in range(len(city_list)):
cur_city = city_list[x]
cur_cityname = city_names[cur_city]
G_L = graph_dict[cur_city]['L']
G_P = graph_dict[cur_city]['P']
# computation
result_by_hops = compute_hopbased_accessibility(G_L,min_connected_nodes_perc)
dist_dict = derive_pdf_ccdf(result_by_hops['df']['values'])
line, = plt.plot(dist_dict['variable'],dist_dict['ccdf'],'--',markersize=1,
marker = marker_list[x],color = color_list[x],label = cur_cityname)
plt.legend(loc = 'upper right')
plt.xlabel('# Hops')
plt.ylabel('Probability')
plt.savefig('ccdf_hop_based.png', format='png', dpi=300)
#---- GTC-based accessibility
f2 = plt.figure()
for x in range(len(city_list)):
cur_city = city_list[x]
cur_cityname = city_names[cur_city]
G_L = graph_dict[cur_city]['L']
G_P = graph_dict[cur_city]['P']
# computation
result_by_hops = compute_GTCbased_accessibility(G_P,transfer_penalty_cost,min_connected_nodes_perc)
dist_dict = derive_pdf_ccdf(result_by_hops['df']['values'])
line, = plt.plot(dist_dict['variable'],dist_dict['ccdf'],'--',markersize=1,
marker = marker_list[x],color = color_list[x],label = cur_cityname)
plt.legend(loc = 'upper right')
plt.xlabel('Generalized Travel Cost [min]')
plt.ylabel('Probability')
plt.savefig('ccdf_GTC_based.png', format='png', dpi=300)