Corrected distance method for two nodes