Estimation of a centrality parameter and random sampling time. I. Necessary conditions for optimality