I'm really sorry for this question. I'm new to a graph theory, and I hope you will help me to understand one statement.
Consider $ER(n,p)$ graph with $n \geq 3$ and $p \in [0,1]$. The statement says that the expected number of triangles incident of one vertex is $(p(n-1)(p(n-1)-1)/2)*p$.
When I'm trying to parse this statement I understand that $p(n-1)$ is the expected number of edges incident to a vertex, but when I'm trying to go further I'm getting a little bit confused! So,can you help me to read this formula and understand it? Thank you!
The number of potential triangles containing some specific vertex $v$ is ${n-1 \choose 2}$. Let $[n]$ be the set of vertices of the random graph and let $L = \{ \{s, t\}: s, t \in [n] \setminus \{v\}, s \neq t\}.$ Clearly, $|L| = {n-1 \choose 2}$. Moreover, any triangle containing $v$ corresponds to an element of $L$ and vice versa.
So $$ \# \text{ of triangles containing }v = \sum_{\{s,t\} \in L} 1_{\{v \sim s \sim t \sim v\}}, $$ where $1_{\{v \sim s \sim t \sim v\}}$ is 1 when all three edges $\{v, s\}, \{s, t\}, \{t, v\}$ are present and 0 otherwise. For any $\{s, t\} \in L$, we have that $$ E\left[ 1_{\{v \sim s \sim t \sim v\}} \right] = p^3. $$ By linearity of expectation, $$ E\left[\# \text{ of triangles containing }v\right] = \sum_{\{s,t\} \in L} p^3 = {n-1 \choose 2}p^3. $$ Now this expression can be rewritten as $$ (n-1)p \, \frac{( (n-1)-1)p}{2} \, p $$ which is quite similar to your expression.