Social Network Analysis的Centrality總結，以及networkx實現EigenCentrality，PageRank和KatzCentrality的對比

二、Centrality的相關資源

1. wiki: https://en.wikipedia.org/wiki/Centrality

2. ttang pageRank networkx: http://www.cnblogs.com/fstang/archive/2013/06/01/3113352.html

3. 講network的一個網站：https://www.sci.unich.it/~francesc/teaching/network/

4. 各種語言的centrality代碼資源集合： http://www.centiserver.org/?q1=software

http://www.cnblogs.com/fstang/archive/2013/06/01/3113352.html

` 1 import matplotlib.pyplot as plt 2 import networkx as nx 3  4 G=nx.binomial_graph(10, 0.3, directed=True) #the graph 5 G.add_node(10); # add a sole node 6 layout = nx.spring_layout(G) 7  8 plt.figure("source graph") 9 nx.draw(G, pos=layout, node_color=‘y‘)10 11 plt.figure("eigenCentrality without personalization")12 pr=nx.eigenvector_centrality(G)13 print("eigenCentrality without personalization" ,pr)14 nx.draw(G, pos=layout, node_size=[x * 6000 for x in pr.values()],node_color=‘m‘,with_labels=True)15 16 plt.figure("eigenCentrality with personalization")17 pr=nx.eigenvector_centrality(G, nstart={0:1, 1:1, 2:10, 3:1, 4:1, 5:1, 6:1, 7:1, 8:1, 9:1, 10:1})18 print("eigenCentrality with personalization" ,pr)19 nx.draw(G, pos=layout, node_size=[x * 6000 for x in pr.values()],node_color=‘m‘,with_labels=True)20 21 plt.figure("pageRank without personalization")22 pr=nx.pagerank(G,alpha=0.85)23 print("pageRank without personallization", pr)24 nx.draw(G, pos=layout, node_size=[x * 6000 for x in pr.values()],node_color=‘m‘,with_labels=True)25 26 plt.figure("pageRank with personalization ")27 pr=nx.pagerank(G,alpha=0.85, personalization={0:1, 1:1, 2:10, 3:1, 4:1, 5:1, 6:1, 7:1, 8:1, 9:1, 10:1})28 print("pageRank with personalization" , pr)29 nx.draw(G, pos=layout, node_size=[x * 6000 for x in pr.values()],node_color=‘m‘,with_labels=True)30 31 plt.figure("katzcentrality without personalization")32 pr=nx.katz_centrality(G, alpha=0.3);33 print("katzcentrality without personallization ", pr)34 nx.draw(G, pos=layout, node_size=[x * 6000 for x in pr.values()],node_color=‘m‘,with_labels=True)35 36 plt.figure("katzcentrality with personalization")37 pr=nx.katz_centrality(G,alpha=0.3, nstart={0:1, 1:1, 2:10, 3:1, 4:1, 5:1, 6:1, 7:1, 8:1, 9:1, 10:1})38 print("katzcentrality with personalization" , pr)39 nx.draw(G, pos=layout, node_size=[x * 6000 for x in pr.values()],node_color=‘m‘,with_labels=True)40 plt.show()`

Social Network Analysis的Centrality總結，以及networkx實現EigenCentrality，PageRank和KatzCentrality的對比

Beyond APAC's No.1 Cloud

19.6% IaaS Market Share in Asia Pacific - Gartner IT Service report, 2018

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth \$300-1200 USD