Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.efficiency.efficiency

efficiency(G, u, v)[source]

Returns the efficiency of a pair of nodes in a graph.

The efficiency of a pair of nodes is the multiplicative inverse of the shortest path distance between the nodes [1]. Returns 0 if no path between nodes.

Parameters:
  • G (networkx.Graph) – An undirected graph for which to compute the average local efficiency.
  • u, v (node) – Nodes in the graph G.
Returns:

Multiplicative inverse of the shortest path distance between the nodes.

Return type:

float

Notes

Edge weights are ignored when computing the shortest path distances.

References

[1]Latora, Vito, and Massimo Marchiori. “Efficient behavior of small-world networks.” Physical Review Letters 87.19 (2001): 198701. <http://dx.doi.org/10.1103/PhysRevLett.87.198701>