def Pathlen_ULdigraph_Intermediate(N):
    """
    Largest possible pathlength for a digraph with L = (N-1) + 1/2 N(N-1) arcs.

    Calculates the pathlength of a digraph consisting of the superposition of
    a directed ring with a complete directed acyclic graph whose arcs are
    pointing in the opposite orientations as the ring. That is, each vertex j
    points to all other vertices with i < j.

    Reference and citation
    ^^^^^^^^^^^^^^^^^^^^^^
    G. Zamora-López & R. Brasselet "Sizing complex networks" Commun Phys 2:144 (2019)

    Parameters
    ----------
    N : integer
        Number of nodes in the digraph.

    Returns
    -------
    avpathlen : float
        The average pathlength of the digraph.

    See Also
    --------
    Pathlen_ULdigraph :
    Pathlen_ULdigraph_Range1_MBS :
    Pathlen_ULdigraph_Range1_Approx :
    Pathlen_ULdigraph_Range2 :
    """
    if N < 2:
        raise ValueError('Network needs at least two nodes, N > 1')
    avpathlen = float(N + 4) / 6
    return avpathlen
