ch5-e17 : shortest path