global_efficiency

global_efficiency#

graph_tool.structure.global_efficiency(g, weight=None)[git][source]#

Return the global efficiency of the graph.

Parameters:
gGraph

Graph to be used.

weightEdgePropertyMap (optional, default: None)

Edge weights (lengths). If not given, every edge has unit length.

Returns:
efficiencyfloat

The global efficiency.

See also

local_efficiency

Efficiency of the neighborhood of every vertex

harmonic_diameter

Inverse of the average inverse distance

average_shortest_path_length

Average distance between pairs of vertices

graph_tool.centrality.closeness

Harmonic closeness centrality

Notes

The global efficiency [latora-efficient-2001] is the average of the inverse distances between all ordered pairs of distinct vertices,

\[E = \frac{1}{V(V-1)}\sum_{u\ne v}\frac{1}{d(u,v)},\]

where \(1/d(u,v) = 0\) if \(v\) cannot be reached from \(u\). The distances are computed with a search from every vertex, in parallel, in time \(O(VE)\) without weights, or \(O(V(E + V\log V))\) with them.

Parallel implementation.

If enabled during compilation, this algorithm will run in parallel using OpenMP. See the parallel algorithms section for information about how to control several aspects of parallelization.

References

[latora-efficient-2001]

Vito Latora and Massimo Marchiori, “Efficient behavior of small-world networks”, Physical Review Letters 87, 198701 (2001), DOI: 10.1103/PhysRevLett.87.198701 [sci-hub, @tor], arXiv: cond-mat/0101396

Examples

>>> g = gt.collection.data["karate"]
>>> print(gt.global_efficiency(g))
0.4920083...