← 返回教程目录
第 6 章 · 第 3 节 共现分析

中心度指标:找出评论里的核心词

Centrality Metrics: Finding the Most Influential Terms

网络图画出来后,老板还会问一个问题:哪个词最重要?网络科学有 3 个常用指标来回答 — 度中心度、接近中心度、介数中心度。

1. 度中心度(谁连接最多)

deg_cent = nx.degree_centrality(G)


top_degree = sorted(deg_cent.items(), key=lambda x: -x[1])[:10]





for word, score in top_degree:


    print(f'{word:8s} 度={score:.4f}')


# 手机     度=0.8231


# 不错     度=0.7692


# 物流     度=0.6410

2. 介数中心度(谁当桥梁)

bet_cent = nx.betweenness_centrality(G, weight='weight')


top_between = sorted(bet_cent.items(), key=lambda x: -x[1])[:5]





for word, score in top_between:


    print(f'{word:8s} 介数={score:.4f}')
介数高 = 桥梁词:性价比横跨硬件和价格两个圈子,是网络里最关键的中转节点。这词被删掉,整个网络会分裂。

3. 接近中心度(谁能最快触达所有人)

close_cent = nx.closeness_centrality(G)


top_close = sorted(close_cent.items(), key=lambda x: -x[1])[:5]





for word, score in top_close:


    print(f'{word:8s} 接近={score:.4f}')

3 个指标配合看:度高 = 关键节点、介数高 = 桥梁、接近高 = 中心 — 三位一体,才能完整描述这个词在网络里多重要。

想跳过代码,直接出可缩放的关系图谱?

配套软件内置共现算法 + 力导向布局 + 中心度,导入即出可交互 HTML 图谱

想跳过 NetworkX 代码,直接出可缩放的关系图谱?

配套软件内置共现算法 + 力导向布局,导入即出可交互 HTML 图谱

查看淘宝软件 →