networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturns
total_spanning_tree_weight(G, weight=None)

The theorem states that the determinant of any cofactor of the Laplacian matrix of a graph is the number of spanning trees in the graph. For a weighted Laplacian matrix, it is the sum across all spanning trees of the multiplicative weight of each tree. That is, the weight of each tree is the product of its edge weights.

Parameters

G : NetworkX Graph

The graph to use Kirchhoff's theorem on.

weight : string or None

The key for the edge attribute holding the edge weight. If :None:None:`None`, then each edge is assumed to have a weight of 1.

Returns

float

The sum of the total multiplicative weight for all spanning trees in the graph.

Apply Kirchhoff's Tree Matrix Theorem a graph in order to find the total weight of all spanning trees.

Examples

See :

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/algorithms/approximation/traveling_salesman.py#801
type: <class 'function'>
Commit: