Suppose we construct an Erdős–Rényi graph $G(n, p)$.
Fix two nodes $u$ and $v$. What is the probability that there is no path connecting the two nodes?
My take: I tried to model the problem as $P(\text{no path between } i \text{ and } j) = 1 - P(\text{at least a path between } i \text{ and } j)$.
- If $n = 2$: $P(\text{no path between } i \text{ and } j) = 1-p$
- If $n = 3$: $P(\text{no path between } i \text{ and } j) = 1 - (p + p^2 - p^3)$
- If $n$ is an arbitrary number: I will try to compute the probablity of existence of a path.
Update: the following is incorrect.
Let $Z_{u \rightarrow v}$ be a boolean variable, denoting the path from $u$ to $v$. $Z_{u \rightarrow v} = 1$ if and only if there is a path from $u$ to $v$. The goal is to find the probabilty of having a path from $u$ to $v$, in other words $\mathbb{P}(Z_{u \rightarrow v})$. Instead of calculating this probability, we use the expected number of path from node $u$ to any other node: $$ \mathbb{P}(Z_{u \rightarrow v}) = \frac{ \mathbb{E} \left( Z_{u \rightarrow ? \neq u} \right) }{ n - 1 } $$
Next we calculate $\mathbb{E} \left( Z_{u \rightarrow ?} \right)$. Suppose we start from $u$ and we visit its neighbors. Next we repeat the same procedure for its neighbors (like, say via BFS). Suppose we have seen all neighbors of distance $k$ from $u$. Define $S_k$ to be the size of nodes accessible from $u$ with at most $k$ steps. Suppose there is an ordering on visiting the elements in this procedure, based on which we sort them. Suppose the size of the elements at distance $k$ is $X_1$, size of elements with distance 2 is $X_2$, and so on. Hence $$ S_i = \sum_{j=0}^i X_j $$
The distribution on $X_{i+1}$ given the previous observed nodes is binomial $ \text{Bin} \left( n - 1 - S_i, p \right)$; in other words the probability of observing $X_{i+1} = k$ neighbors with distance $i+1$ from the starting point is ${ n - 1 -S_i \choose k }p^{k}(1-p)^{n - 1 -S_i-k}$. With this the expected number of the newly discovered neighbors at distance $i$ is $\mathbb{E}_{X_{i+1}|S_i} \left( X_{i+1}|S_i \right) = (n - 1 - S_i)p$. Using the law of total expectations: \begin{align*} \mathbb{E}X_i &= \mathbb{E}_{S_i} \left[ \mathbb{E}_{X_i | S_i } \left( X_i | S_i \right) \right] \\ &= \mathbb{E}_{S_i} \left[ n - 1 - S_i \right] p = (n-1)p - p \mathbb{E} S_i \end{align*}
\begin{align*} \mathbb{E}{S_{i+1}} &= \mathbb{E}{S_i} + \mathbb{E}{X_{i+1}} \\ &= (n-1)p -(1-p) \mathbb{E}{S_i} \\ &= (n-1)p \sum_{j= 0}^i (1-p)^j \\ &= (n-1)p \frac{ 1 - (1-p)^{i+1} }{ 1 - (1-p) } \\ &= (n-1) \left( 1 - (1-p)^{i+1} \right) \end{align*}
Therefore $\mathbb{P}(Z_{u \rightarrow v}) = \frac{n-1}{n-1} \left[ 1 - (1-p)^{(n-1)} \right] $ and $P(\text{no path between } i \text{ and } j) = (1-p)^{(n-1)}$
The confusing part is, I am not sure why this formula does not work for the special case of $n=3$, as I calculated above.
