def Effic_USgraph(N,L):
    """
    Largest possible global efficiency for graphs (ultra-short limit).

    Calculates the largest possible efficiency that a graph of arbitrary number
    of nodes N and number of undirected edges L could possibly have. Networks
    with shortest possible pathlength have largest efficiency. In case
    L < N-1, the graph is necessarily disconnected and the function returns the
    efficiency of a disconnected star graph.

    Reference and citation
    ^^^^^^^^^^^^^^^^^^^^^^
    G. Zamora-López & R. Brasselet "Sizing complex networks" Commun Phys 2:144 (2019)
    For the connected case, see also
    D. Barnpoutis & R.M. Murray *Extremal properties of complex networks*
    arXiv:1104.5532 (2011).

    Parameters
    ----------
    N : integer
        Number of nodes in the graph.
    L : integer
        Number of undirected edges in the graph.

    Returns
    -------
    efficiency : float
        The efficiency of an undirected ultra-short graph.

    See Also
    --------
    Pathlen_USgraph :
    USgraph :
    USdigraph :
    """
    # 0) SECURITY CHECKS
    if N < 2: raise ValueError( "Network needs at least two nodes, N > 1" )
    Ltot = 0.5*N*(N-1)
    if L < 0:         raise ValueError( "L does not take negative values" )
    if L > int(Ltot): raise ValueError( "L out of bounds. max(L) = 1/2 * N*(N-1)" )

    # 1) CHOOSE CORRECT MODEL AND CALCULATE CORRESPONDING EFFICIENCY
    if L < N:
        # Network is disconnected, return efficiency of incomplete star graph
        efficiency = 0.25 * (L**2 + 3*L) / Ltot
    else:
        # Network is connected and dense enough to form a star graph (diam = 2)
        efficiency = 0.5 * ( 1.0 + L / Ltot )

    return efficiency