networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
bethe_hessian_matrix(G, r=None, nodelist=None)

The Bethe Hessian is a family of matrices parametrized by r, defined as H(r) = (r^2 - 1) I - r A + D where A is the adjacency matrix, D is the diagonal matrix of node degrees, and I is the identify matrix. It is equal to the graph laplacian when the regularizer r = 1.

The default choice of regularizer should be the ratio

$$r_m = \left(\sum k_i \right)^{-1}\left(\sum k_i^2 \right) - 1$$

Parameters

G : Graph

A NetworkX graph

r : float

Regularizer parameter

nodelist : list, optional

The rows and columns are ordered according to the nodes in nodelist. If nodelist is None, then the ordering is produced by G.nodes() .

Returns

H : scipy.sparse.csr_matrix

The Bethe Hessian matrix of G, with parameter r.

Returns the Bethe Hessian matrix of G.

See Also

adjacency_matrix
bethe_hessian_spectrum
laplacian_matrix

Examples

>>> k = [3, 2, 2, 1, 0]
... G = nx.havel_hakimi_graph(k)
... H = nx.bethe_hessian_matrix(G)
... H.toarray() array([[ 3.5625, -1.25 , -1.25 , -1.25 , 0. ], [-1.25 , 2.5625, -1.25 , 0. , 0. ], [-1.25 , -1.25 , 2.5625, 0. , 0. ], [-1.25 , 0. , 0. , 1.5625, 0. ], [ 0. , 0. , 0. , 0. , 0.5625]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.linalg.spectrum.bethe_hessian_spectrum networkx.linalg.bethehessianmatrix.bethe_hessian_matrix

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/linalg/bethehessianmatrix.py#8
type: <class 'function'>
Commit: