We prove a stability theorem for the elliptic Harnack inequality: if two weighted graphs are equivalent, then the elliptic Harnack inequality holds for harmonic functions with respect to one of the graphs if and only if it holds for harmonic functions with respect to the other graph. As part of the proof, we give a characterization of the elliptic Harnack inequality.