節點層級指標

使用 Python 分析社群媒體資料

Alex Hanna

Computational Social Scientist

中心性:節點重要性

  • 中心性
    • 衡量節點在網路中的重要性
    • 「重要性」有多種定義
使用 Python 分析社群媒體資料

Degree 中心性

Degree

  • 與節點相連的邊數
  • 有向網路的兩種 degree
    • In-degree-邊指向節點
    • Out-degree-邊自節點指出
nx.in_degree_centrality(T)
nx.out_degree_centrality(T)

入度中心性

使用 Python 分析社群媒體資料

介數中心性(Betweenness)

  • 兩節點之間的最短路徑,有多少條經過此節點
  • 作為網路中介者的重要性
nx.betweenness_centrality(T)

介數中心性

使用 Python 分析社群媒體資料

印出最高中心性

bc = nx.betweenness_centrality(T)

betweenness = pd.DataFrame( list(bc.items()), columns = ['Name', 'Cent'])
print(betweenness.sort_values( 'Cent', ascending = False).head())
    Name  Centrality
0      0    0.232540
23    23    0.158514
7      7    0.158514
15    15    0.158514
21    21    0.157588

介數中心性

使用 Python 分析社群媒體資料

不同網路的中心性

中心性 2x3 表

使用 Python 分析社群媒體資料

比值

degree_rt = pd.DataFrame(list(G_rt.in_degree()), 
                         columns = ['screen_name', 'degree'])
degree_reply = pd.DataFrame(list(G_reply.in_degree()),
                            columns = ['screen_name', 'degree'])

ratio = degree_rt.merge(degree_reply, on = 'screen_name', suffixes = ('_rt', '_reply'))
ratio['ratio'] = ratio['degree_reply'] / ratio['degree_rt']
使用 Python 分析社群媒體資料

一起來練習吧!

使用 Python 分析社群媒體資料

Preparing Video For Download...