adding shortest path code