This documents the development version of NetworkX. Documentation for the current release can be found here.


resistance_distance(G, nodeA, nodeB, weight=None, invert_weight=True)[source]

Returns the resistance distance between node A and node B on graph G.

The resistance distance between two nodes of a graph is akin to treating the graph as a grid of resistorses with a resistance equal to the provided weight.

If weight is not provided, then a weight of 1 is used for all edges.

GNetworkX graph

A graph


A node within graph G.


A node within graph G, exclusive of Node A.

weightstring or None, optional (default=None)

The edge data key used to compute the resistance distance. If None, then each edge has weight 1.

invert_weightboolean (default=True)

Proper calculation of resistance distance requires building the Laplacian matrix with the reciprocal of the weight. Not required if the weight is already inverted. Weight cannot be zero.


Value of effective resistance distance


Overview discussion: * *

Additional details: Vaya Sapobi Samui Vos, “Methods for determining the effective resistance,” M.S., Mathematisch Instituut, Universiteit Leiden, Leiden, Netherlands, 2016 Available: Link to thesis