eff /= den avg_path /= den pos = net_file.find("out.") net = "results/" + net_file[pos+4:] net_n = "results/" + net_file[pos+4:] # Saves the fitted degree distribution l, k = an.power_law_fit(degs) # print l, k plt.savefig(net_n + "_dfit.pdf", dpi=200) # Saves degree distribution an.degree_histogram(degs, True, True, False) plt.savefig(net_n + "_degree.pdf", dpi=200) # Saves accum degree an.degree_histogram_complementar(degs) plt.savefig(net_n + "_degree_compl.pdf", dpi=200) # Saves clustering distribution an.local_cc_acc(clust) plt.savefig(net_n + "_clust.pdf", dpi=200) # local clustering x degree an.local_cc_deg_distr(degs, clust) plt.savefig(net_n + "_cc_deg.pdf", dpi=200)
Y = {} lo = 1e9 hi = 0 for x in X: tam = X[x] lo = min (lo, math.log(tam)) hi = max (hi, math.log(tam)) if tam not in Y: Y[tam] = [] Y[tam].append ([]) Y[tam].append ([]) Y[tam][0].append ( x[0] ) Y[tam][1].append ( x[1] ) for t in Y: sz = math.log(t)/float(hi - lo) * 50 ax.scatter(Y[t][0], Y[t][1], facecolors='black', edgecolors='black', s=30, alpha=0.4) ax.set_xlabel(u'Grau de Entrada', size=15) ax.set_ylabel(u'Grau de Saída', size=15) plt.grid (axis='x',color='grey', linestyle='--', lw=0.5, alpha=0.5) plt.grid (axis='y',color='grey', linestyle='--', lw=0.5, alpha=0.5) plt.savefig('../figs/evolution/chara/inout.pdf') plt.close() an.degree_histogram (in_deg, True, True, True, 'Grau de Entrada') plt.savefig('../figs/evolution/chara/in.pdf') plt.close() an.degree_histogram (out_deg, True, True, True, u'Grau de Saida') plt.savefig('../figs/evolution/chara/out.pdf')
for x in j['values']: if x['user'] not in use: p = get_time (x['date']) if p[1].find("Apr 27") != -1: continue t.append (p[0]) hours[p[0]] = p[1] use[x['user']] = 1 d2 = len(use)/float(len(j['values'])) d2 = round (d2, 3) data.append (len(use)) per.append ( (-len(use), j['name'])) if len(use) > 1: data2.append (d2) per = sorted (per) print data2 for i in range (0, 10): print per[i][1] + ' & ' + str(-per[i][0]) + ' \\\\ \\hline' plt.close() fig = plt.figure() ax = fig.add_subplot(111) # plt.grid (axis='x',color='grey', linestyle='--', lw=0.5, alpha=0.5) an.degree_histogram (data, True, True, True, u'#Usuários Únicos') # plt.grid (axis='y',color='grey', linestyle='--', lw=0.5, alpha=0.5) plt.savefig('../figs/tags/distr.pdf') an.degree_histogram (data2, True, True, False, u'Usuários Totais/Usuários Únicos') plt.savefig('../figs/tags/distr2.pdf')