sys.stdout.flush() # ## Execute centrality measures # In[5]: print '# Page Rank execution...' pagerank, iterations, err = pr(g, alpha=1.0e-5, eps=1.0e-3) print '#', iterations, ' iterations. Error:', err top_pr = [a for a, b in topk(pagerank, seed)] # In[6]: print '# Eigenvector Centrality...', cscores, diffsum = ec(g) top_eigenc = [a for a, b in topk(cscores, seed)] print '# Done' # In[7]: print '# Betweennes centrality...', bet = betweenness(g) top_bet = [a for a, b in topk(bet, seed)] print '# Done' sys.stdout.flush() # ## Execute Independent Cascade Model # In[8]:
# ## Execute centrality measures # In[12]: print '# Page Rank execution...' pagerank, iterations, err = pr(g, alpha=1.0e-5, eps=1.0e-3) print '#',iterations, ' iterations. Error:', err top_pr = [a for a,b in topk(pagerank, NODES)] # In[13]: print '# Eigenvector Centrality...', ecscores, _ = ec(g) top_eigenc = [a for a, b in topk(ecscores, NODES)] print '# Done' # In[14]: print '# Betweennes centrality...', bet = betweenness(g) top_bet = [a for a, b in topk(bet, NODES)] print '# Done' # ## Execute Independent Cascade Model seed = [i for i in xrange(200, 7001, 200)]
sys.stdout.flush() # ## Execute centrality measures # In[8]: print '# Page Rank execution...' pagerank, iterations, err = pr(g, alpha=1.0e-5, eps=1.0e-3) print '#',iterations, ' iterations. Error:', err top_pr = [a for a,b in topk(pagerank, nodes)] # In[9]: print '# Eigenvector Centrality...', cscores, diffsum = ec(g) top_eigenc = [a for a, b in topk(cscores, nodes)] print '# Done' # In[10]: print '# Betweennes centrality...', bet = betweenness(g) top_bet = [a for a, b in topk(bet, nodes)] print '# Done' sys.stdout.flush() # ## Execute Independent Cascade Model
und(g))) fi(g) # Fill incoming edges dictionary # ## Execute centrality measures # In[12]: print '# Page Rank execution...' pagerank, iterations, err = pr(g, alpha=1.0e-5, eps=1.0e-3) print '#', iterations, ' iterations. Error:', err top_pr = [a for a, b in topk(pagerank, seed)] # In[13]: print '# Eigenvector Centrality...', ecscores, _ = ec(g) top_eigenc = [a for a, b in topk(ecscores, seed)] print '# Done' # In[14]: print '# Betweennes centrality...', bet = betweenness(g) top_bet = [a for a, b in topk(bet, seed)] print '# Done' # ## Execute Independent Cascade Model # In[15]: seed = 100