hits_numpy#
- hits_numpy(G, normalized=True)[源代码]#
返回节点的命中中心和权限值。
2.6 版后已移除: HITS_NUMPY已弃用,将在networkx 3.0中删除。
hits算法为一个节点计算两个数字。当局根据传入链接估计节点值。集线器根据传出链接估计节点值。
- 参数
- G图表
网络X图表
- normalized布尔值(默认值=True)
通过所有值的总和来规格化结果。
- 返回
- (hubs,authorities)二元组词典
以节点为关键字的两个字典,其中包含集线器和权威值。
笔记
特征向量计算使用numpy与lapack的接口。
HITS算法是为有向图而设计的,但是该算法不检查输入图是否有向,并且将在无向图上执行。
工具书类
- 1
A.Langville和C.Meyer,“Web信息检索的特征向量方法调查”,http://citeseer.ist.psu.edu/713792.html
- 2
JonKleinberg,ACM 46(5):604-321999超链接环境期刊的权威来源。doi:10.1145/324133.324140。http://www.cs.cornell.edu/home/kleinber/auth.pdf.
实例
>>> G = nx.path_graph(4)
这个
hubs
和authorities
分别由分别对应于中心矩阵和授权矩阵的最大特征值的特征向量给出。这个
hubs
和authority
矩阵是根据伴随矩阵计算的:>>> adj_ary = nx.to_numpy_array(G) >>> hubs_matrix = adj_ary @ adj_ary.T >>> authority_matrix = adj_ary.T @ adj_ary
hits_numpy
maps the eigenvector corresponding to the maximum eigenvalue of the respective matrices to the nodes inG
:>>> hubs, authority = nx.hits_numpy(G)