shortest path algorithm example