add method to get distance between nodes