PathDist function

Path distance