spaghetti hoops combinatorics variation You may have heard about the classic spaghetti hoops combinatorics problem, which has been stated like this:
"You have N pieces of rope in a bucket. You reach in and grab one end-piece, then reach in and grab another end-piece, and tie those two together. What is the expected value of the number of loops in the bucket?"
The solution is straight forward and involves defining two events: event that you close the loop, vs. event that you just extend the path you have without forming a loop.

My question is what happens when we generalize this a bit so that the objects no longer need to have 2 endpoints?
For simplicty lets say the objects all still have the same number $E$ of endpoints. But some interesting things happen: if $E$ is odd, the objects can no longer close up on themselves, e.g. for the $E$=2 case a loop could form to connect a single object to itself, but now that cannot happen. When $E$=even, now this can happen again.
So specifically, let's define a "tangle" as the generalization of a loop, i.e. a "tangle" is a group of connected objects, so each object in the tangle is connected by at least 1 edge to at least one other object in that tangle. Let's call the "size" of the tangle the number of objects that are in the tangle.
My question is: given $N$ objects, for number of endpoints per object $E\geq3$, what is the expected number of "tangles"? Bonus points if you can give the expected number of tangles of a given size $S$?
 A: Possible approach?  Not an answer, but too long for a comment. 
The state of the system is completely described by the vector $(a_0, a_1, ...)$ where $a_j = $ the no. of tangles with $j$ endpoints (loose ends).  This is a Markov Chain.  The start state has $a_E = N$ (and all other $a_j = 0$).  At each timestep, you pick two endpoints and connect them.  E.g., if you pick an endpoint belonging to tangle A with 4 endpoints, and another endpoint belonging to tangle B with 6 endpoints, and connect them, that creates a new tangle with $4+6-2 = 8$ endpoints, so the state changes are: $a_4(t+1) = a_4(t) - 1$, $a_6(t+1) = a_6(t) -1$, and $a_8(t+1) = a_8(t) + 1$.  Another example: if you pick two endpoints of a tangle with $j$ endpoints, the state changes are: $a_j(t+1) = a_j(t) - 1$, and $a_{j-2}(t+1) = a_{j-2}(t) + 1$. 
This would seem to be a Markov Chain with a large state space and hard to solve.  Luckily:


*

*Let $T = \sum_j (j \ a_j) = $ the total number of endpoints.  This quantity decreases by $2$ each timeslot.

*The Chain terminates when $T(t) < 2$, so it runs for exactly $\lfloor T(0) / 2 \rfloor$ timeslots, where $T(0) = NE = $ the starting number of loose ends.

*When it terminates, $a_j = 0 \ \forall j \ge 2$, and $a_1 < 2$.  (If $NE$ is odd, then $a_1 = 1$ at termination, i.e. there is one loose end left; otherwise $a_1 = 0$ at termination.)

*The desired result is $E[a_0 + a_1]$ upon termination.  
So at least you have a finite amount of time to work with, and the Chain is conceivably solvable in very complicated closed form.  This is especially true if we can establish recurrences on $E[a_j(t)]$, but I am not sure that is possible.
The case of even $E$ has additional convenient properties, although I don't know how to exploit them.  In this case, $a_j = 0$ for all odd $j$, so we don't have to worry about $a_1$.  Any increment in $a_0$ must obviously come from connecting two endpoints of the same tangle with only two loose ends.  At any time $t$ with $a_2(t)$ such tangles, and $T(t) = NE - 2t$ total loose ends, the probability of that event is exactly $a_2(t) / {T(t) \choose 2} = a_2(t) / {NE - 2t \choose 2}$.  And since expectations are additive, $E[a_0]$ at termination equals $\sum_t E[a_2(t)] / {NE - 2t \choose 2}$.  Unfortunately, I can't think of any easy way to calculate $E[a_2(t)]$ because $a_2$ evolution is affected by $a_4$, which is affected by $a_6$, etc.  So e.g. we cannot lump together all $a_j$ where $j> 2$, and we're back to the same large state space.
