Optimized shortest path