We will use indicator functions to compute the expected number of edges between vertices \(i\) and \(j\text{.}\) Let \(X\) be the random variable that counts the number of edges between vertices \(i\) and \(j\text{.}\) We can express \(X\) as the sum of indicator functions:
\begin{equation*}
X = \sum_{a=1}^{d_i} \sum_{b=1}^{d_j} X_{a,b}
\end{equation*}
where \(X_{a,b}\) is the indicator function that is \(1\) if the \(a\)-th stub of vertex \(i\) is matched with the \(b\)-th stub of vertex \(j\text{,}\) and \(0\) otherwise. By the linearity of expectation, we have:
\begin{equation*}
\mathbb{E}[X] = \mathbb{E}\left[\sum_{a=1}^{d_i} \sum_{b=1}^{d_j} X_{a,b}\right] = \sum_{a=1}^{d_i} \sum_{b=1}^{d_j} \mathbb{E}[X_{a,b}]\, .
\end{equation*}
Since \(X_{a,b}\) is an indicator function, its expectation is equal to the probability that the \(a\)-th stub of vertex \(i\) is matched with the \(b\)-th stub of vertex \(j\text{.}\) The number of perfect matchings where these two stubs are matched together is equal to the total number of perfect matchings of the remaining \(2m - 2\) stubs. By our preceding result, this number is \((2m - 3)!!\text{.}\) The total number of perfect matchings of all \(2m\) stubs is \((2m - 1)!!\text{.}\) Thus, the probability that the \(a\)-th stub of vertex \(i\) is matched with the \(b\)-th stub of vertex \(j\) is:
\begin{equation*}
\mathbb{P}(X_{a,b} = 1) = \frac{(2m - 3)!!}{(2m - 1)!!} = \frac{1}{2m - 1}\, .
\end{equation*}
Substituting this back into our expression for the expectation, we get:
\begin{equation*}
\mathbb{E}[X] = \sum_{a=1}^{d_i} \sum_{b=1}^{d_j} \frac{1}{2m - 1} = \frac{d_i d_j}{2m - 1}\, .
\end{equation*}