We introduce and implement a method to compute stationary states of nonlinear Schr\''odinger equations on metric graphs. Stationary states are obtained as local minimizers of the nonlinear Schr\''odinger energy at fixed mass. Our method is based on a normalized gradient flow for the energy (i.e. a gradient flow projected on a fixed mass sphere) adapted to the context of nonlinear quantum graphs. We first prove that, at the continuous level, the normalized gradient flow is well-posed, mass-preserving, energy diminishing and converges (at least locally) towards stationary states. We then establish the link between the continuous flow and its discretized version. We conclude by conducting a series of numerical experiments in model situations showing the good performance of the discrete flow to compute stationary states. Further experiments as well as detailed explanation of our numerical algorithm are given in a companion paper.