John lives in the Trees of Ten Houses, and it is a most ideal and idyllic place for him and the other dwellers up in the canopy. They have invested a tremendous amount of time in engineering these houses, and to ensure no house felt isolated from the others, they built a fresh, finely crafted bridge between each and every house!
Unfortunately, the Trees of Ten Houses were not immune to thunderstorms, nor were the bridges well engineered. The night was treacherous, howling with wind and freezing with rain, so the odds for the bridges were not good--each bridge seemed just as likely to survive as to be shattered!
Fortunately, as there were so very many bridges in the Trees of Ten Houses, when John did wake the following morning, he found he was able to make his way to each and every house using only the existing bridges, though round-about routes may have been necessary. As they began rebuilding, John became curious... what were the chances that they'd all be so lucky?
More formally, if P is the probability that, after the storm, John is able to traverse to each and every house, what is ⌊ 1 0 1 0 P ⌋ ?
Details and Assumptions:
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I have to admit this is a very nice question and I enjoy it very much. Truth be told, it takes all my time on Sunday to solve this question since I have no clue what is a graph theory. My first idea used binomial probability since we have ( 2 1 0 ) independent trials and probability 2 1 . At least we need 9 bridges survive, but the hardest part is how to determine the right bridges to survive i.e. the bridges that can connect all the houses. The second idea was I combined the first approach with the Erdős–Rényi model , G ( n , p ) model, and I got the probability of the remaining bridges can connect all the houses (the general approach) Pr [ n , p ] = 1 − k = 1 ∑ n − 1 ( k − 1 n − 1 ) Pr [ k , p ] ( 1 − p ) k ( n − k ) . Setting n = 1 0 and p = 2 1 , we obtain Pr [ 1 0 , 2 1 ] = 1 − k = 1 ∑ 9 ( k − 1 9 ) Pr [ k , 2 1 ] ( 1 − 2 1 ) k ( 1 0 − k ) ≈ 0 . 9 8 0 4 4 9 1 7 5 2 1 1 1 0 6 .
Please can you explain why are there 2^45 graphs ? with isomorphisms and stuff..
Log in to reply
There are C(10,2) edges (i.e bridges) because each pair of houses is connected, so we're counting number of such pairs, which is 45. After the storm, each configuration is obtained by choosing some subset of those 45 bridges. Each bridge can either survive or be destroyed. It's like you have 45 binary places and ask how many binary numbers can be represented.
I wrote some code to solve this problem. Have a look at the repository https://github.com/kpardeshi/Broken-Bridges
Problem Loading...
Note Loading...
Set Loading...
Let's model the village as an undirected graph, with 10 nodes, and, initially, 45 edges for bridge completeness. We are looking for the probability that, if each edge is removed with independent probability 50%, the graph remains connected. Since we require 10 digits of precision, Monte Carlo methods are not going to help us, and since there are, counting isomorphisms, 2 4 5 such graphs, direct counting isn't going to help either!
The first bit we need to understand is that every possible graph is equally likely . That is, by simply numbering the edges of the graph, any number-labeled configuration of edges that remain and edges that are destroyed can occur with probability 2 − 4 5 . So, if we are able to compute the total number of possible connected graphs, then we can easily compute the probability that our graph is one of them.
We'll let T ( n ) be the total number of graphs of size n , with vertices labeled { 1 , 2 , 3 , . . . , n } . Let C ( n ) be the total number of connected graphs of size n , and let D ( n ) be the total number of disconnected graphs of size n . We find that:
T ( n ) = 2 ( 2 n ( n − 1 ) )
C ( n ) = T ( n ) − D ( n )
D ( n ) = ∑ k = 1 n − 1 ( k − 1 n − 1 ) ⋅ C ( k ) ⋅ T ( n − k )
That last definition is the most interesting one, as it allows us to actually compute C ( 1 0 ) , which we need to get P . Let's break it down a bit:
The scale of the problem is such that we don't need to cache values for C ( n ) or D ( n ) to compute C ( 1 0 ) in reasonable time, as it is a mere 1 0 ⋅ 2 1 0 operations to do so. Using dynamic programming, however, would allow us to compute such outlandish values as C ( 1 0 0 ) and D ( 1 0 0 0 ) instantly.
The answer is thus, simply:
⌊ 1 0 1 0 ⋅ T ( 1 0 ) C ( 1 0 ) ⌋ = 9 8 0 4 4 9 1 7 5 2
So John and company actually have a healthy 98% chance of remaining fully connected after the storm. Ten houses seems quite ideal indeed!
Update: Apparently C ( n ) is defined in OEIS . So, if you're skeptical, just grab a ( 1 0 ) from over there, divide by 2 4 5 with a calculator, and see the decimal representation of P for yourself.