Ordered Parent Paths, Distance function for paths