For a given subcritical discrete Schrödinger operator H on a weighted infinite graph X, we construct a Hardy-weight w which is optimal in the following sense. The operator H − λw is subcritical in X for all λ < 1, null-critical in X for λ = 1, and supercritical near any neighborhood of infinity in X for any λ > 1. Our results rely on a criticality theory for Schrödinger operators on general weighted graphs.