I have come across a graph-theoretic problem where it would be nice to bound the "sum of squared degrees", in the following sense. We have a graph $G$ with vertex set $[n]$ and let $d(G) = \sum_{i=1}^n \deg(i)^2$.
Has this parameter been studied before, perhaps in some special cases? I would appreciate any pointers to the literature, especially for cases in which the order of $d(G)$ is significantly less than $n^3$. In particular, is this true when $G$ is tripartite and the edge set of $G$ is a union of disjoint triangles?
Edit. Based on the comments below, it seems that the problem reduces to the following. Suppose that a graph $G$ is such that its edge set is a union of triangles (no two triangles share an edge but they may share a vertex). Can one bound the number of cherries (ordered triples $(u,v,w)$ such that $v$ is adjacent to both $u$ and $w$), possibly by $O(n^2)$? I apologise if this is somewhat trivial, I cannot see the argument straightaway.
Edit 2. This should really go in a comment to the answer by Seva, but I cannot figure out how to attach an image. I believe this is a counterexample, as the edge set is the union of four edge-disjoint triangles, but vertices $0$ and $3$ are the endvertices of two distinct cherries.