Fix linear shortest path.