Adds a Graph distance function, to compare with rms