Element 'shortest path algorithm'