def METHOD_NAME(self):
    """
    Implementation of the efficient bilayer cross counting by insert-sort.
    See https://www.semanticscholar.org/paper/Simple-and-Efficient-Bilayer-Cross-Counting-Barth-Jünger/272d73edce86bcfac3c82945042cf6733ad281a0
    """
    g = self.layout.layoutVertices
    P = []
    for v in self:
        P.extend(sorted([g[x].pos for x in self.neighbors(v)]))
    # count inversions in P:
    s = []
    count = 0
    for i, p in enumerate(P):
        j = bisect(s, p)
        if j < i:
            count += i - j
        s.insert(j, p)
    return count