Let $(G, \omega)$ be a hyperelliptic vertex-weighted graph of genus $g \geq 2$. We give a characterization of $(G, \omega)$ for which there exists a smooth projective curve $X$ of genus $g$ over a complete discrete valuation field with reduction graph $(G, \omega)$ such that the ranks of any divisors are preserved under specialization. We explain, for a given vertex-weighted graph $(G, \omega)$ in general, how the existence of such $X$ relates the Riemann--Roch formulae for $X$ and $(G, \omega)$, and also how the existence of such $X$ is related to a conjecture of Caporaso.