On the Distribution of the Number of Local Minima of a Random Function on a Graph