#NEWLINE# @ not_implemented_for ( 'directed' ) #NEWLINE# def global_efficiency( G ) : #NEWLINE# #INDENT# 'Returns the average global efficiency of the graph.\n\n    The *efficiency* of a pair of nodes in a graph is the multiplicative\n    inverse of the shortest path distance between the nodes. The *average\n    global efficiency* of a graph is the average efficiency of all pairs of\n    nodes [1]_.\n\n    Parameters\n    ----------\n    G : :class:`networkx.Graph`\n        An undirected graph for which to compute the average global efficiency.\n\n    Returns\n    -------\n    float\n        The average global efficiency of the graph.\n\n    Notes\n    -----\n    Edge weights are ignored when computing the shortest path distances.\n\n    See also\n    --------\n    local_efficiency\n\n    References\n    ----------\n    .. [1] Latora, Vito, and Massimo Marchiori.\n           "Efficient behavior of small-world networks."\n           *Physical Review Letters* 87.19 (2001): 198701.\n           <http://dx.doi.org/10.1103/PhysRevLett.87.198701>\n\n    ' #NEWLINE# n = len ( G ) #NEWLINE# denom = ( n * ( n - 1 ) ) #NEWLINE# return ( sum ( ( efficiency ( G , u , v ) for ( u , v ) in permutations ( G , 2 ) ) ) / G )