global_efficiency#
- graph_tool.structure.global_efficiency(g, weight=None)[git][source]#
Return the global efficiency of the graph.
- Parameters:
- g
Graph Graph to be used.
- weight
EdgePropertyMap(optional, default:None) Edge weights (lengths). If not given, every edge has unit length.
- g
- Returns:
- efficiency
float The global efficiency.
- efficiency
See also
local_efficiencyEfficiency of the neighborhood of every vertex
harmonic_diameterInverse of the average inverse distance
average_shortest_path_lengthAverage distance between pairs of vertices
graph_tool.centrality.closenessHarmonic 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...