Uniform linearized chord diagram (source code)

= Uniform linearized chord diagram

Pair $2n$ linearly ordered endpoints uniformly. Each pair is a chord; its larger endpoint ends a <vertex> block, with all endpoints after the previous right endpoint merged into that <vertex>. Orient the chord from its right-endpoint block to its left-endpoint block. Removing the last endpoint and its mate leaves a uniform smaller pairing. Reinserting the mate into one of $2n-1$ equally likely gaps chooses an existing block proportionally to its endpoint count, or the final gap creates a <self-loop>. This proves equivalence with the <linearized chord diagram model>.

An equivalent continuous representation draws $n$ <independent> pairs of <independent> uniform points on $[0,1]$, orders the pairs by their maxima $R_1<\cdots<R_n$, and calls their minima $L_i$. The $R_i^2$ are <uniform order statistics>; conditional on all the $R_i$, the $L_i$ are <independent> uniform points on $[0,R_i]$.