Moments in graphs
Let $G$ be a connected graph with vertex set $V$ and a {\em weight function} $ρ$ that assigns a nonnegative number to each of its vertices. Then, the {\em $ρ$-moment} of $G$ at vertex $u$ is defined to be $M_G^ρ(u)=\sum_{v\in V} ρ(v)\dist (u,v) $, where $\dist(\cdot,\cdot)$ stands for the distance function. Adding up all these numbers, we obtain the {\em $ρ$-moment of $G$}: $$ M_G^ρ=\sum_{u\in V}M_G^ρ(u)=1/2\sum_{u,v\in V}\dist(u,v)[ρ(u)+ρ(v)]. $$ This parameter generalizes, or it is closely related to, some well-known graph invariants, such as the {\em Wiener index} $W(G)$, when $ρ(u)=1/2$ for every $u\in V$, and the {\em degree distance} $D'(G)$, obtained when $ρ(u)=δ(u)$, the degree of vertex $u$. In this paper we derive some exact formulas for computing the $ρ$-moment of a graph obtained by a general operation called graft product, which can be seen as a generalization of the hierarchical product, in terms of the corresponding $ρ$-moments of its factors. As a consequence, we provide a method for obtaining nonisomorphic graphs with the same $ρ$-moment for every $ρ$ (and hence with equal mean distance, Wiener index, degree distance, etc.). In the case when the factors are trees and/or cycles, techniques from linear algebra allow us to give formulas for the degree distance of their product.