當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python NetworkX bethe_hessian_matrix用法及代碼示例

本文簡要介紹 networkx.linalg.bethehessianmatrix.bethe_hessian_matrix 的用法。

用法:

bethe_hessian_matrix(G, r=None, nodelist=None)

返回 G 的 Bethe Hessian 矩陣。

Bethe Hessian 是由 r 參數化的矩陣族,定義為 H(r) = (r^2 - 1) I - r A + D 其中 A 是鄰接矩陣,D 是節點度的對角矩陣,I是識別矩陣。當正則化器 r = 1 時,它等於圖拉普拉斯算子。

正則化器的默認選擇應該是比率 [2]

參數

G圖形

NetworkX 圖

r浮點數

正則化參數

nodelist列表,可選

根據 nodelist 中的節點對行和列進行排序。如果 nodelist 為 None,則排序由 G.nodes() 生成。

返回

Hscipy.sparse.csr_matrix

G 的 Bethe Hessian 矩陣,參數為 r。

參考

1

A. Saade, F. Krzakala and L. Zdeborová “Spectral clustering of graphs with the bethe hessian”, Advances in Neural Information Processing Systems. 2014.

2

C. M. Lee, E. Levina “Estimating the number of communities in networks by spectral methods” arXiv:1507.00827, 2015.

例子

>>> k = [3, 2, 2, 1, 0]
>>> G = nx.havel_hakimi_graph(k)
>>> H = nx.modularity_matrix(G)

相關用法


注:本文由純淨天空篩選整理自networkx.org大神的英文原創作品 networkx.linalg.bethehessianmatrix.bethe_hessian_matrix。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。