Random Graphs – How to Calculate Number of Paths of Length 2

random-graphs

Suppose you have several random graphs. Each one has $n$ nodes, connected among them with probability $p$. There are $r$ random graphs.
Now, each node is connected to nodes of another random graph with probability $q$, in general different from $p$.
Suppose that any node is a friend of anybody to whom he is either directly connected to by an edge, or by anyone with whom they share an endnode, i.e. anyone with whom there exists a path of length at most 2.

First question: How many friends each node has in expectation?

Second question: now suppose that half nodes in each graph are men, half women. How many expected women friends each male node has?

The answer must be a generalization of this one:
Probability of friendship

Furthermore, the probability that node x is not a friend of someone in his own graph is something like

$(1-p) \sum^n_k \sum^{r(n-1)}_h p^k q^h (1-p)^{n-k} (1-q)^{(r-1)n-h} (1-p)^{k} (1-q)^{h}$

and the probability that node x is not a friend of someone in a different graph is something like

$(1-q) \sum^n_k \sum^{r(n-1)}_h p^k q^h (1-p)^{n-k} (1-q)^{(r-1)n-h} (1-p)^{k} (1-q)^{h}$

but in both cases I am missing a combinatorial factor.

Best Answer

It is easier to understand the probability that, given a node $v$, another node $w$ is not connected to it by a path of length $1$ or $2$.

For example, to answer question $2$, we can assume both nodes $v$ and $w$ are in the same $n$-vertex graph. In that case,

  • There is no edge $vw$, which happens with probability $(1-p)$.
  • For any node $x$ in the same $n$-vertex graph, edges $vx$ and $wx$ are not both present, which happens with probability $1-p^2$.
  • For any node $x$ in another $n$-vertex graph, edges $vx$ and $wx$ are not both present, which happens with probability $1-q^2$.

Combining these, there is a probability $$(1-p)(1-p^2)^{n-2}(1-q^2)^{n(r-1)}$$ that there is not a path of length $1$ or $2$ between $v$ and $w$. So the expected number of vertices in the same $n$-vertex graph that do have such a path is $$(n-1)\left(1 - (1-p)(1-p^2)^{n-2}(1-q^2)^{n(r-1)}\right)$$ which is the number of other vertices in the same $n$-vertex graph multiplied by the probability that each one of them has such a path.

We can find the expected number of vertices connected to $v$ in other $n$-vertex graphs in a similar way.

Related Question